From 1eb20b364e98a8e6e7742670ede5f105cd106694 Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Tue, 12 Sep 2023 16:30:59 +0200 Subject: [PATCH 1/6] set negative FE values to zero --- R/reportFE.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/reportFE.R b/R/reportFE.R index 21ec8971..2f3b3a7f 100644 --- a/R/reportFE.R +++ b/R/reportFE.R @@ -1656,7 +1656,8 @@ reportFE <- function(gdx, regionSubsetList = NULL, } else { # TODO: correct once feedstocks are calculated within the model - # The variable FE|w/o Non-energy Use|Industry currently contains Non-Energy Use. Non-Energy Use should be subtracted from this variable as soon as feedstocks are calculated within the model.") + # The variable FE|w/o Non-energy Use|Industry currently contains Non-Energy Use. Non-Energy Use should be subtracted + # from this variable as soon as feedstocks are calculated within the model.") out <- mbind( out, setNames(out[, , "FE|++|Industry (EJ/yr)"], "FE|w/o Non-energy Use|Industry (EJ/yr)"), @@ -1668,6 +1669,12 @@ reportFE <- function(gdx, regionSubsetList = NULL, out <- add_columns(out, addnm = "FE|Non-energy Use|Industry (EJ/yr)", dim = 3.1, fill = 0) } + # in case the current non-energy use implementation creates negative values, set them to 0 + if (any(out < 0)) { + out[out < 0] <- 0 + warning("Negative values found in one or more FE variables (likely non-energy use related). They were set to 0.") + } + # add global values out <- mbind(out,dimSums(out,dim=1)) # add other region aggregations From d5c6fa69d8301fb4dc91c24a9740dfcab727cf60 Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Tue, 12 Sep 2023 17:01:12 +0200 Subject: [PATCH 2/6] remove warning --- R/reportFE.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/reportFE.R b/R/reportFE.R index 2f3b3a7f..0ded93a6 100644 --- a/R/reportFE.R +++ b/R/reportFE.R @@ -1672,7 +1672,6 @@ reportFE <- function(gdx, regionSubsetList = NULL, # in case the current non-energy use implementation creates negative values, set them to 0 if (any(out < 0)) { out[out < 0] <- 0 - warning("Negative values found in one or more FE variables (likely non-energy use related). They were set to 0.") } # add global values From 0f82b62b2309622dfdfa2badd6d7e129075e1f5a Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Tue, 12 Sep 2023 17:29:02 +0200 Subject: [PATCH 3/6] increment version --- .buildlibrary | 2 +- CITATION.cff | 4 +++- DESCRIPTION | 5 +++-- README.md | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 2717c592..e9f9be06 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '219164100' +ValidationKey: '219183712' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index b70597e0..b8a36d12 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,7 +2,7 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'remind2: The REMIND R package (2nd generation)' -version: 1.117.5 +version: 1.117.6 date-released: '2023-09-12' abstract: Contains the REMIND-specific routines for data and model output manipulation. authors: @@ -65,6 +65,8 @@ authors: given-names: Jessica - family-names: Verpoort given-names: Philipp +- family-names: Weigmann + given-names: Pascal license: LGPL-3.0 repository-code: https://github.com/pik-piam/remind2 diff --git a/DESCRIPTION b/DESCRIPTION index 2e547c2f..ea6b29ed 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: remind2 Title: The REMIND R package (2nd generation) -Version: 1.117.5 +Version: 1.117.6 Date: 2023-09-12 Authors@R: c( person("Renato", "Rodrigues", , "renato.rodrigues@pik-potsdam.de", role = c("aut", "cre")), @@ -32,7 +32,8 @@ Authors@R: c( person("Björn", "Sörgel", role = "aut"), person("Mike", "Spahr", role = "aut"), person("Jessica", "Strefler", role = "aut"), - person("Philipp", "Verpoort", role = "aut") + person("Philipp", "Verpoort", role = "aut"), + person("Pascal", "Weigmann", role = "aut") ) Description: Contains the REMIND-specific routines for data and model output manipulation. diff --git a/README.md b/README.md index 4d0259d5..1ecaf09e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # The REMIND R package (2nd generation) -R package **remind2**, version **1.117.5** +R package **remind2**, version **1.117.6** [![CRAN status](https://www.r-pkg.org/badges/version/remind2)](https://cran.r-project.org/package=remind2) [![R build status](https://github.com/pik-piam/remind2/workflows/check/badge.svg)](https://github.com/pik-piam/remind2/actions) [![codecov](https://codecov.io/gh/pik-piam/remind2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/remind2) [![r-universe](https://pik-piam.r-universe.dev/badges/remind2)](https://pik-piam.r-universe.dev/builds) @@ -49,7 +49,7 @@ In case of questions / problems please contact Renato Rodrigues . +Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.117.6, . A BibTeX entry for LaTeX users is @@ -58,7 +58,7 @@ A BibTeX entry for LaTeX users is title = {remind2: The REMIND R package (2nd generation)}, author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort}, year = {2023}, - note = {R package version 1.117.5}, + note = {R package version 1.117.6}, url = {https://github.com/pik-piam/remind2}, } ``` From 73d97bd0d7ddf63dc7559a3de064f26d7a532939 Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Tue, 26 Sep 2023 14:28:28 +0200 Subject: [PATCH 4/6] avoid writing to package repository --- R/compareScenarios2.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/R/compareScenarios2.R b/R/compareScenarios2.R index 98774679..5244587a 100644 --- a/R/compareScenarios2.R +++ b/R/compareScenarios2.R @@ -150,8 +150,15 @@ compareScenarios2 <- function( } else if (outputFormat == "rmd") { return(.compareScenarios2Rmd(yamlParams, outputDir, outputFile)) } + + # copy the template directory from the package to the outputDir because rmarkdown writes to the folder + # containing the template. + templateInOutputDir <- file.path(outputDir, "compareScenarios2", "cs2_main.Rmd") + file.copy(system.file("markdown/compareScenarios2/", package = "remind2"), + outputDir, recursive = TRUE) + rmarkdown::render( - system.file("markdown/compareScenarios2/cs2_main.Rmd", package = "remind2"), + templateInOutputDir, intermediates_dir = outputDir, output_dir = outputDir, output_file = outputFile, @@ -159,6 +166,7 @@ compareScenarios2 <- function( params = yamlParams, envir = envir, quiet = quiet) + unlink(file.path(outputDir, "compareScenarios2"), recursive = TRUE) } # Copies the CompareScenarios2-Rmds to the specified location and modifies From 175c1188a2e52351b0134aeb8a01121e4daf18a1 Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Tue, 26 Sep 2023 14:52:51 +0200 Subject: [PATCH 5/6] increment version --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 3e08613f..2da88bfb 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '219589802' +ValidationKey: '219654192' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index 4f2a5962..b58c0bc5 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: 'remind2: The REMIND R package (2nd generation)' -version: 1.119.1 -date-released: '2023-09-22' +version: 1.119.2 +date-released: '2023-09-26' abstract: Contains the REMIND-specific routines for data and model output manipulation. authors: - family-names: Rodrigues diff --git a/DESCRIPTION b/DESCRIPTION index 6300eddb..a32df714 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: remind2 Title: The REMIND R package (2nd generation) -Version: 1.119.1 -Date: 2023-09-22 +Version: 1.119.2 +Date: 2023-09-26 Authors@R: c( person("Renato", "Rodrigues", , "renato.rodrigues@pik-potsdam.de", role = c("aut", "cre")), person("Lavinia", "Baumstark", role = "aut"), diff --git a/README.md b/README.md index 2b20f371..fd8c4b22 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # The REMIND R package (2nd generation) -R package **remind2**, version **1.119.1** +R package **remind2**, version **1.119.2** [![CRAN status](https://www.r-pkg.org/badges/version/remind2)](https://cran.r-project.org/package=remind2) [![R build status](https://github.com/pik-piam/remind2/workflows/check/badge.svg)](https://github.com/pik-piam/remind2/actions) [![codecov](https://codecov.io/gh/pik-piam/remind2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/remind2) [![r-universe](https://pik-piam.r-universe.dev/badges/remind2)](https://pik-piam.r-universe.dev/builds) @@ -49,7 +49,7 @@ In case of questions / problems please contact Renato Rodrigues . +Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.119.2, . A BibTeX entry for LaTeX users is @@ -58,7 +58,7 @@ A BibTeX entry for LaTeX users is title = {remind2: The REMIND R package (2nd generation)}, author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort}, year = {2023}, - note = {R package version 1.119.1}, + note = {R package version 1.119.2}, url = {https://github.com/pik-piam/remind2}, } ``` From 9f67e60d7f4f4da86af334633b5d59777b3b8366 Mon Sep 17 00:00:00 2001 From: Pascal Weigmann Date: Thu, 28 Sep 2023 11:16:17 +0200 Subject: [PATCH 6/6] increment version --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 2da88bfb..44f95c37 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '219654192' +ValidationKey: '219696204' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index c23079d4..52c699fa 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: 'remind2: The REMIND R package (2nd generation)' -version: 1.119.2 -date-released: '2023-09-26' +version: 1.119.3 +date-released: '2023-09-28' abstract: Contains the REMIND-specific routines for data and model output manipulation. authors: - family-names: Rodrigues diff --git a/DESCRIPTION b/DESCRIPTION index fcad18f3..cc9b26cc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: remind2 Title: The REMIND R package (2nd generation) -Version: 1.119.2 -Date: 2023-09-26 +Version: 1.119.3 +Date: 2023-09-28 Authors@R: c( person("Renato", "Rodrigues", , "renato.rodrigues@pik-potsdam.de", role = c("aut", "cre")), person("Lavinia", "Baumstark", role = "aut"), diff --git a/README.md b/README.md index fd8c4b22..0417eaba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # The REMIND R package (2nd generation) -R package **remind2**, version **1.119.2** +R package **remind2**, version **1.119.3** [![CRAN status](https://www.r-pkg.org/badges/version/remind2)](https://cran.r-project.org/package=remind2) [![R build status](https://github.com/pik-piam/remind2/workflows/check/badge.svg)](https://github.com/pik-piam/remind2/actions) [![codecov](https://codecov.io/gh/pik-piam/remind2/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/remind2) [![r-universe](https://pik-piam.r-universe.dev/badges/remind2)](https://pik-piam.r-universe.dev/builds) @@ -49,16 +49,16 @@ In case of questions / problems please contact Renato Rodrigues . +Rodrigues R, Baumstark L, Benke F, Dietrich J, Dirnaichner A, Führlich P, Giannousakis A, Hasse R, Hilaire J, Klein D, Koch J, Kowalczyk K, Levesque A, Malik A, Merfort A, Merfort L, Morena-Leiva S, Pehl M, Pietzcker R, Rauner S, Richters O, Rottoli M, Schötz C, Schreyer F, Siala K, Sörgel B, Spahr M, Strefler J, Verpoort P, Weigmann P (2023). _remind2: The REMIND R package (2nd generation)_. R package version 1.119.3, . A BibTeX entry for LaTeX users is ```latex @Manual{, title = {remind2: The REMIND R package (2nd generation)}, - author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort}, + author = {Renato Rodrigues and Lavinia Baumstark and Falk Benke and Jan Philipp Dietrich and Alois Dirnaichner and Pascal Führlich and Anastasis Giannousakis and Robin Hasse and Jérome Hilaire and David Klein and Johannes Koch and Katarzyna Kowalczyk and Antoine Levesque and Aman Malik and Anne Merfort and Leon Merfort and Simón Morena-Leiva and Michaja Pehl and Robert Pietzcker and Sebastian Rauner and Oliver Richters and Marianna Rottoli and Christof Schötz and Felix Schreyer and Kais Siala and Björn Sörgel and Mike Spahr and Jessica Strefler and Philipp Verpoort and Pascal Weigmann}, year = {2023}, - note = {R package version 1.119.2}, + note = {R package version 1.119.3}, url = {https://github.com/pik-piam/remind2}, } ```