Skip to content

Commit

Permalink
adapt to renamed scenario SSP2Ariadne to SSP2EU
Browse files Browse the repository at this point in the history
  • Loading branch information
LaviniaBaumstark committed Sep 27, 2021
1 parent ba36f20 commit f877a9c
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "mrremind: MadRat REMIND Input Data Package",
"version": "0.77.1",
"version": "0.78.0",
"description": "<p>The mrremind packages contains data preprocessing for the REMIND model.<\/p>",
"creators": [
{
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion R/calcBiomassPrices.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions R/calcCapital.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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,]
Expand Down Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion R/calcFEdemand.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions R/calcLabour.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
6 changes: 3 additions & 3 deletions R/convertEDGE.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand Down
12 changes: 6 additions & 6 deletions R/readEDGE.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -38,7 +38,7 @@ In case of questions / problems please contact Lavinia Baumstark <lavinia@pik-po

To cite package **mrremind** in publications use:

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 (2021). _mrremind: MadRat REMIND Input Data Package_. R package version 0.77.1.
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 (2021). _mrremind: MadRat REMIND Input Data Package_. R package version 0.78.0.

A BibTeX entry for LaTeX users is

Expand All @@ -47,7 +47,7 @@ A BibTeX entry for LaTeX users is
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},
year = {2021},
note = {R package version 0.77.1},
note = {R package version 0.78.0},
}
```

0 comments on commit f877a9c

Please sign in to comment.