diff --git a/.buildlibrary b/.buildlibrary index a2f01567..d133b11f 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '43903020' +ValidationKey: '43925340' AcceptedWarnings: - Invalid URL: .* - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 1bccd1b8..20b0af22 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'mrremind: MadRat REMIND Input Data Package' -version: 0.218.0 -date-released: '2025-02-20' +version: 0.218.1 +date-released: '2025-02-21' abstract: The mrremind packages contains data preprocessing for the REMIND model. authors: - family-names: Baumstark diff --git a/DESCRIPTION b/DESCRIPTION index a173597f..ccd94462 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrremind Title: MadRat REMIND Input Data Package -Version: 0.218.0 -Date: 2025-02-20 +Version: 0.218.1 +Date: 2025-02-21 Authors@R: c( person("Lavinia", "Baumstark", , "lavinia@pik-potsdam.de", role = c("aut", "cre")), person("Renato", "Rodrigues", role = "aut"), diff --git a/R/convertStationary.R b/R/convertStationary.R index 4e5156ed..548c440e 100644 --- a/R/convertStationary.R +++ b/R/convertStationary.R @@ -91,8 +91,8 @@ convertStationary <- function(x) { } # Select last year of X available in the historical data set - maxYear_X_in_FE <- max(getYears(x, as.integer = TRUE)[getYears(x, as.integer = TRUE) %in% - getYears(wfe, as.integer = TRUE)]) + maxYear_X_in_FE <- max(intersect(getYears(x, as.integer = TRUE), + getYears(wfe, as.integer = TRUE))) # Deduce the scenario periods exceeding_years <- getYears(x, as.integer = TRUE)[getYears(x, as.integer = TRUE) > maxYear_X_in_FE] @@ -102,11 +102,19 @@ convertStationary <- function(x) { # before the FE_stationary projections are fully taken up # The years exceeding maxYear might not be meaningful. Therefore we exclude them - helper <- getYears(hist_fe_stationary)[getYears(hist_fe_stationary, TRUE) <= maxYear_X_in_FE] - fe_stationary <- time_interpolate(hist_fe_stationary[, helper, ], + yearsWithData <- getYears(hist_fe_stationary)[getYears(hist_fe_stationary, TRUE) <= maxYear_X_in_FE] + fe_stationary <- time_interpolate(hist_fe_stationary[, yearsWithData, ], interpolated_year = c(maxYear_X_in_FE, exceeding_years), integrate_interpolated_years = TRUE, extrapolation_type = "constant") + + # TODO: remove this hot fix + # We add 2 EJ/yr of unspecified electric demand allocated to buildings + # to future years to lift up the final 2025 point by this amount. + iFix <- "feothelec" + fe_stationary["CHN", exceeding_years, iFix] <- fe_stationary["CHN", exceeding_years, iFix] + 2 + xFix <- x["CHN", , iFix] + fe_stationary <- addSSPnames(fe_stationary) # change the regional resolution of fe_stationary to match the EDGE_stationary resolution @@ -127,6 +135,15 @@ convertStationary <- function(x) { x[, , stationary_items] <- fe_stationary[, getYears(x), stationary_items] * (1 - lambda) + x[, , stationary_items] * lambda + # TODO: remove this hot fix + # shift transition by one time step to maintain the +2EJ we added and stretch + # it to smooth the peak a bit + lambdaFix <- calcLambda(setdiff(exceeding_years, 2025), 2055, + getYears(x)[getYears(x, TRUE) <= min(exceeding_years)]) + x["CHN", , iFix] <- fe_stationary["CHN", getYears(x), iFix] * (1 - lambdaFix) + + xFix * lambdaFix + + # Scale GDP and FE weights so that they can be added wg <- wg / dimSums(wg, dim = 1, na.rm = TRUE) wfe <- wfe / dimSums(wfe, dim = 1, na.rm = TRUE) diff --git a/README.md b/README.md index b0db1888..3471cc43 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat REMIND Input Data Package -R package **mrremind**, version **0.218.0** +R package **mrremind**, version **0.218.1** [![CRAN status](https://www.r-pkg.org/badges/version/mrremind)](https://cran.r-project.org/package=mrremind) [![R build status](https://github.com/pik-piam/mrremind/workflows/check/badge.svg)](https://github.com/pik-piam/mrremind/actions) [![codecov](https://codecov.io/gh/pik-piam/mrremind/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrremind) [![r-universe](https://pik-piam.r-universe.dev/badges/mrremind)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Lavinia Baumstark . +Baumstark L, Rodrigues R, Levesque A, Oeser J, Bertram C, Mouratiadou I, Malik A, Schreyer F, Soergel B, Rottoli M, Mishra A, Dirnaichner A, Pehl M, Giannousakis A, Klein D, Strefler J, Feldhaus L, Brecha R, Rauner S, Dietrich J, Bi S, Benke F, Weigmann P, Richters O, Hasse R, Fuchs S, Mandaroux R, Koch J (2025). "mrremind: MadRat REMIND Input Data Package." Version: 0.218.1, . A BibTeX entry for LaTeX users is @@ -47,9 +47,9 @@ A BibTeX entry for LaTeX users is @Misc{, title = {mrremind: MadRat REMIND Input Data Package}, author = {Lavinia Baumstark and Renato Rodrigues and Antoine Levesque and Julian Oeser and Christoph Bertram and Ioanna Mouratiadou and Aman Malik and Felix Schreyer and Bjoern Soergel and Marianna Rottoli and Abhijeet Mishra and Alois Dirnaichner and Michaja Pehl and Anastasis Giannousakis and David Klein and Jessica Strefler and Lukas Feldhaus and Regina Brecha and Sebastian Rauner and Jan Philipp Dietrich and Stephen Bi and Falk Benke and Pascal Weigmann and Oliver Richters and Robin Hasse and Sophie Fuchs and Rahel Mandaroux and Johannes Koch}, - date = {2025-02-20}, + date = {2025-02-21}, year = {2025}, url = {https://github.com/pik-piam/mrremind}, - note = {Version: 0.218.0}, + note = {Version: 0.218.1}, } ```