From f877a9c50f3702f527b5242f7e21a0019db054d1 Mon Sep 17 00:00:00 2001 From: Lavinia Baumstark Date: Mon, 27 Sep 2021 16:49:45 +0200 Subject: [PATCH] adapt to renamed scenario SSP2Ariadne to SSP2EU --- .buildlibrary | 2 +- .zenodo.json | 2 +- DESCRIPTION | 2 +- R/calcBiomassPrices.R | 2 +- R/calcCapital.R | 8 ++++---- R/calcFEdemand.R | 2 +- R/calcLabour.R | 10 +++++----- R/convertEDGE.R | 6 +++--- R/readEDGE.R | 12 ++++++------ README.md | 6 +++--- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 2fff1443..90e5b1ea 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '14569587' +ValidationKey: '14739660' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/.zenodo.json b/.zenodo.json index 47016428..0c23c676 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "mrremind: MadRat REMIND Input Data Package", - "version": "0.77.1", + "version": "0.78.0", "description": "

The mrremind packages contains data preprocessing for the REMIND model.<\/p>", "creators": [ { diff --git a/DESCRIPTION b/DESCRIPTION index ca79e4f6..22dc7326 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mrremind Type: Package Title: MadRat REMIND Input Data Package -Version: 0.77.1 +Version: 0.78.0 Date: 2021-09-27 Authors@R: c(person("Lavinia", "Baumstark", email = "lavinia@pik-potsdam.de", role = c("aut","cre")), person("Renato", "Rodrigues", role = "aut"), diff --git a/R/calcBiomassPrices.R b/R/calcBiomassPrices.R index 05ec2d02..42f75e45 100644 --- a/R/calcBiomassPrices.R +++ b/R/calcBiomassPrices.R @@ -15,7 +15,7 @@ calcBiomassPrices <- function(){ getNames(x) <- gsub("NPI-Base","none",getNames(x)) # Introduce new SSP/SDP dimension by replacing "-" with "." - getNames(x) <- gsub("(SSP[0-9]|SSP2Ariadne|SDP|SDP_EI|SDP_RC|SDP_MC)-","\\1.",getNames(x)) + getNames(x) <- gsub("(SSP[0-9]|SSP2EU|SDP|SDP_EI|SDP_RC|SDP_MC)-","\\1.",getNames(x)) # if fit coefficients of a country are NA for all years (there is no supplycurve at all for this country) # generate artificial supplycurve with VERY high prices diff --git a/R/calcCapital.R b/R/calcCapital.R index 20c15a60..b2570e6f 100644 --- a/R/calcCapital.R +++ b/R/calcCapital.R @@ -39,7 +39,7 @@ calcCapital <- function(subtype = "Capital") { gdpppp= calcOutput("GDPppp", aggregate = F) gdpppp <- mselect(gdpppp, period=paste0("y",c(2005:2150,5))) #getNames(gdpppp) <- sub("gdp_","",getNames(gdpppp)) - my_scen <- c("gdp_SSP1", "gdp_SSP2", "gdp_SSP3", "gdp_SSP4", "gdp_SSP5", "gdp_SSP2Ariadne", + my_scen <- c("gdp_SSP1", "gdp_SSP2", "gdp_SSP3", "gdp_SSP4", "gdp_SSP5", "gdp_SSP2EU", "gdp_SDP", "gdp_SDP_EI", "gdp_SDP_RC", "gdp_SDP_MC") gdpppp <- mselect(gdpppp, variable = my_scen) @@ -59,7 +59,7 @@ calcCapital <- function(subtype = "Capital") { convtime[,,"gdp_SDP_EI"] = 150 convtime[,,"gdp_SDP_RC"] = 150 convtime[,,"gdp_SDP_MC"] = 150 - convtime[,,"gdp_SSP2Ariadne"] = 250 + convtime[,,"gdp_SSP2EU"] = 250 for (t in c("y1995","y2000","y2005")){ cap_intensity_future[,t,] <- cap_intensity[,t,] @@ -99,9 +99,9 @@ calcCapital <- function(subtype = "Capital") { y = intersect(getYears(cap_future), getYears(cap_macro)) - # Add SSP2Ariadne and SDP scenarios + # Add SSP2EU and SDP scenarios cap_macro_SSP2A <- cap_macro[,,"gdp_SSP2"] - getNames(cap_macro_SSP2A) <- gsub("SSP2", "SSP2Ariadne", getNames(cap_macro_SSP2A)) + getNames(cap_macro_SSP2A) <- gsub("SSP2", "SSP2EU", getNames(cap_macro_SSP2A)) cap_macro <- mbind(cap_macro, cap_macro_SSP2A) cap_macro_SDP <- cap_macro[,,"gdp_SSP1"] diff --git a/R/calcFEdemand.R b/R/calcFEdemand.R index ac0553f7..6f16deb8 100644 --- a/R/calcFEdemand.R +++ b/R/calcFEdemand.R @@ -646,7 +646,7 @@ calcFEdemand <- function(subtype = "FE") { mod_factors %>% filter('gdp_SSP2' == .data$scenario) %>% - mutate(scenario = 'gdp_SSP2Ariadne') + mutate(scenario = 'gdp_SSP2EU') ) mod_r <- unique(mod_factors$region) diff --git a/R/calcLabour.R b/R/calcLabour.R index 5d256474..08221208 100644 --- a/R/calcLabour.R +++ b/R/calcLabour.R @@ -61,12 +61,12 @@ calcLabour <- function() { data <- mbind(data,data_SDP_RC) } } - # add SSP2Ariadne scenario as copy of SSP2, might be substituted by real data later + # add SSP2EU scenario as copy of SSP2, might be substituted by real data later if("pop_SSP2" %in% getNames(data,dim=1)){ - if(!("pop_SSP2Ariadne" %in% getNames(data,dim=1))){ - data_SSP2Ariadne <- data[,,"pop_SSP1"] - getNames(data_SSP2Ariadne) <- gsub("pop_SSP1","pop_SSP2Ariadne",getNames(data_SSP2Ariadne)) - data <- mbind(data,data_SSP2Ariadne) + if(!("pop_SSP2EU" %in% getNames(data,dim=1))){ + data_SSP2EU <- data[,,"pop_SSP1"] + getNames(data_SSP2EU) <- gsub("pop_SSP1","pop_SSP2EU",getNames(data_SSP2EU)) + data <- mbind(data,data_SSP2EU) } } diff --git a/R/convertEDGE.R b/R/convertEDGE.R index 60b9cba9..cde4eb6e 100644 --- a/R/convertEDGE.R +++ b/R/convertEDGE.R @@ -12,7 +12,7 @@ convertEDGE <- function(x, subtype = "FE_stationary") { #---- Functions ------------- noYearDim <- function(x) setYears(x,NULL) addSSPnames <- function(x) { - out <- lapply(c("SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SDP", "SDP_EI", "SDP_RC", "SDP_MC", "SSP2Ariadne"), + out <- lapply(c("SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SDP", "SDP_EI", "SDP_RC", "SDP_MC", "SSP2EU"), function(y) {setNames(x, paste0(y, ".", getNames(x)))}) mbind(out) } @@ -211,7 +211,7 @@ convertEDGE <- function(x, subtype = "FE_stationary") { feShares[,,"fedie"] <- (1-setNames(setNames(share[getRegions(share),getYears(feShares),"share_LDV_totliq"],"fepet"),NULL)) feTransp <- new.magpie(cells_and_regions = getRegions(share), years = getYears(feShares), names = getNames(result[,,c("fepet","fedie")])) - for (i in c("SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SDP", "SDP_EI", "SDP_RC", "SDP_MC", "SSP2Ariadne")) { + for (i in c("SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SDP", "SDP_EI", "SDP_RC", "SDP_MC", "SSP2EU")) { i1 <- paste0(i, ".fepet") i2 <- paste0(i, ".fedie") feTransp[, getYears(feShares), i1] <- feShares[, getYears(feShares), i1] * setNames(feTotal[, getYears(feShares), i], i1) @@ -226,7 +226,7 @@ convertEDGE <- function(x, subtype = "FE_stationary") { # Attribute the growth in water heating demand of the EDGE Region OCD to TUR, # and retrieve it from AUS, CAN, CHE (Swiss), NOR, NZL # For SSP1, SSP2 and SDP - names_2_change = grep("(SSP1|SSP2|SDP|SDP_EI|SDP_RC|SDP_MC|SSP2Ariadne).*water_heating", getNames(result), value = TRUE) + names_2_change = grep("(SSP1|SSP2|SDP|SDP_EI|SDP_RC|SDP_MC|SSP2EU).*water_heating", getNames(result), value = TRUE) names_2_change_elec = grep("elec",names_2_change,value = T) names_2_change_nonelec = grep("elec",names_2_change,value = T, invert = T) regs_OCD = c("AUS","CAN","CHE","NOR","NZL") diff --git a/R/readEDGE.R b/R/readEDGE.R index 8b21a754..3cdb70c3 100644 --- a/R/readEDGE.R +++ b/R/readEDGE.R @@ -31,10 +31,10 @@ readEDGE <- function(subtype = c("FE_stationary", "FE_buildings", "Capital", "Ca mstationary <- read.magpie(file.path(ver, "EDGE_TradMod.cs4r")) mstationary[is.na(mstationary)] <- 0 - # use SSP2 data also for SSP2Ariadne - mstationary_SSP2Ariadne <- mstationary[,,"SSP2"] - getNames(mstationary_SSP2Ariadne) <- gsub("SSP2", "SSP2Ariadne", getNames(mstationary_SSP2Ariadne)) - mstationary <- mbind(mstationary, mstationary_SSP2Ariadne) + # use SSP2 data also for SSP2EU + mstationary_SSP2EU <- mstationary[,,"SSP2"] + getNames(mstationary_SSP2EU) <- gsub("SSP2", "SSP2EU", getNames(mstationary_SSP2EU)) + mstationary <- mbind(mstationary, mstationary_SSP2EU) # use SSP1 data also for SDPs mstationary_SDP <- mstationary[,,"SSP1"] for (i in c("SDP", "SDP_EI", "SDP_RC", "SDP_MC")) { @@ -55,9 +55,9 @@ readEDGE <- function(subtype = c("FE_stationary", "FE_buildings", "Capital", "Ca mbuildingSDPs <- addDim( mselect(mbuilding, scenario = "SDP", collapseNames = TRUE), c("SDP_EI", "SDP_RC", "SDP_MC"), "scenario", 3.1) - # use SSP2 data also for SSP2Ariadne + # use SSP2 data also for SSP2EU mbuildingAriadne <- mselect(mbuilding, scenario = "SSP2") - getNames(mbuildingAriadne) <- gsub("SSP2", "SSP2Ariadne", + getNames(mbuildingAriadne) <- gsub("SSP2", "SSP2EU", getNames(mbuildingAriadne)) # combine all to one magpie object mbuilding <- mbind(mbuilding, mbuildingSDPs, mbuildingAriadne) diff --git a/README.md b/README.md index f7f81fce..b5acc6b4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat REMIND Input Data Package -R package **mrremind**, version **0.77.1** +R package **mrremind**, version **0.78.0** [![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://codecov.io/gh/pik-piam/mrremind) [![r-universe](https://pik-piam.r-universe.dev/badges/mrremind)](https://pik-piam.r-universe.dev/ui#builds) @@ -38,7 +38,7 @@ In case of questions / problems please contact Lavinia Baumstark