diff --git a/.buildlibrary b/.buildlibrary index 31bd586c..e941221f 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '14816816' +ValidationKey: '14836500' 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 4486f8d0..1ee78f6b 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "mrremind: MadRat REMIND Input Data Package", - "version": "0.78.4", + "version": "0.78.5", "description": "

The mrremind packages contains data preprocessing for the REMIND model.<\/p>", "creators": [ { diff --git a/DESCRIPTION b/DESCRIPTION index c8b151b3..7a074c7a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: mrremind Type: Package Title: MadRat REMIND Input Data Package -Version: 0.78.4 -Date: 2021-09-29 +Version: 0.78.5 +Date: 2021-09-30 Authors@R: c(person("Lavinia", "Baumstark", email = "lavinia@pik-potsdam.de", role = c("aut","cre")), person("Renato", "Rodrigues", role = "aut"), person("Antoine", "Levesque", role = "aut"), diff --git a/R/calcFEdemand.R b/R/calcFEdemand.R index d3c1a492..93783029 100644 --- a/R/calcFEdemand.R +++ b/R/calcFEdemand.R @@ -697,7 +697,7 @@ calcFEdemand <- function(subtype = "FE") { scenario = paste0('gdp_', .data$Data1), item = paste0('ue_', sub('_(production|VA)$', '', .data$Data2))) %>% select('Region', 'year', 'scenario', 'item', 'Value') %>% - filter(.data$year %in% unique(getYears(reminditems))) %>% + filter(.data$year %in% unique(getYears(reminditems))) %>% as.magpie(tidy = TRUE) ## Steel activity ---- @@ -716,7 +716,7 @@ calcFEdemand <- function(subtype = "FE") { # t * 1e-9 Gt/t = t value = .data$Value * 1e-9) %>% select('Region', 'year', 'scenario', 'item', 'value') %>% - filter(.data$year %in% unique(getYears(reminditems))) %>% + filter(.data$year %in% unique(getYears(reminditems))) %>% as.magpie(tidy = TRUE) ## extend to SSP2_lowEn ---- @@ -724,25 +724,35 @@ calcFEdemand <- function(subtype = "FE") { # tech assumptions as in SDP", so that's what we do ... foo_pop <- calcOutput('Population', aggregate = FALSE, FiveYearSteps = FALSE) + industry_subsectors_ue_SSP2_lowEn <- ( + dimSums(industry_subsectors_ue[,,'gdp_SDP'], dim = 3.1) %>% + `/`(dimSums(foo_pop[,getYears(industry_subsectors_ue),'pop_SDP'])) %>% + `*`(dimSums(foo_pop[,getYears(industry_subsectors_ue),'pop_SSP2'])) + ) + + getNames(industry_subsectors_ue_SSP2_lowEn) <- paste( + 'gdp_SSP2_lowEn', getNames(industry_subsectors_ue_SSP2_lowEn), sep = '.') + industry_subsectors_ue <- mbind( - industry_subsectors_ue, - - dimSums(industry_subsectors_ue[,,'gdp_SDP'], dim = 3.1) %>% - `/`(dimSums(foo_pop[,getYears(industry_subsectors_ue),'pop_SDP'])) %>% - `*`(dimSums(foo_pop[,getYears(industry_subsectors_ue),'pop_SSP2'])) %>% - setNames(paste('gdp_SSP2_lowEn', getNames(.data), sep = '.')) + industry_subsectors_ue, + industry_subsectors_ue_SSP2_lowEn ) + industry_steel_SSP2_lowEn <- ( + dimSums(industry_steel[,,'gdp_SDP'], dim = 3.1) + / dimSums(foo_pop[,getYears(industry_steel),'pop_SDP']) + * dimSums(foo_pop[,getYears(industry_steel),'pop_SSP2']) + ) + + getNames(industry_steel_SSP2_lowEn) <- paste( + 'gdp_SSP2_lowEn', getNames(industry_steel_SSP2_lowEn), sep = '.') + industry_steel <- mbind( - industry_steel, - - dimSums(industry_steel[,,'gdp_SDP'], dim = 3.1) %>% - `/`(dimSums(foo_pop[,getYears(industry_steel),'pop_SDP'])) %>% - `*`(dimSums(foo_pop[,getYears(industry_steel),'pop_SSP2'])) %>% - setNames(paste('gdp_SSP2_lowEn', getNames(.data), sep = '.')) + industry_steel, + industry_steel_SSP2_lowEn ) - rm(foo_pop) + rm(foo_pop, industry_subsectors_ue_SSP2_lowEn, industry_steel_SSP2_lowEn) industry_subsectors_en <- calcOutput( type = 'IO', subtype = 'output_Industry_subsectors', round = 8, diff --git a/README.md b/README.md index 8ef4c6ec..df561d40 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat REMIND Input Data Package -R package **mrremind**, version **0.78.4** +R package **mrremind**, version **0.78.5** [![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