From 81a282f0941b41c3a506d3db06ed0568bb9f569a Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Thu, 24 Oct 2024 11:35:05 +0200 Subject: [PATCH 1/2] remove INNOPATHS from historical.mif --- .buildlibrary | 3 +- .github/workflows/check.yaml | 2 +- CITATION.cff | 4 +-- DESCRIPTION | 4 +-- R/calcINNOPATHS.R | 58 ------------------------------------ R/convertINNOPATHS.R | 25 ---------------- R/fullVALIDATIONREMIND.R | 9 ------ R/readINNOPATHS.R | 11 ------- README.md | 6 ++-- man/readINNOPATHS.Rd | 11 ------- 10 files changed, 10 insertions(+), 123 deletions(-) delete mode 100644 R/calcINNOPATHS.R delete mode 100644 R/convertINNOPATHS.R delete mode 100644 R/readINNOPATHS.R delete mode 100644 man/readINNOPATHS.Rd diff --git a/.buildlibrary b/.buildlibrary index dd0d44a5..706f6b2c 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '38795512' +ValidationKey: '386586200' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' @@ -13,3 +13,4 @@ AcceptedNotes: AutocreateReadme: yes allowLinterWarnings: yes enforceVersionUpdate: yes +skipCoverage: yes diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 23545e6c..d85a3165 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -63,6 +63,6 @@ jobs: shell: Rscript {0} run: | nonDummyTests <- setdiff(list.files("./tests/testthat/"), c("test-dummy.R", "_snaps")) - if(length(nonDummyTests) > 0) covr::codecov(quiet = FALSE) + if(length(nonDummyTests) > 0 && !lucode2:::loadBuildLibraryConfig()[["skipCoverage"]]) covr::codecov(quiet = FALSE) env: NOT_CRAN: "true" diff --git a/CITATION.cff b/CITATION.cff index 791be7e6..eaf51b34 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.193.9 -date-released: '2024-10-12' +version: 0.193.10 +date-released: '2024-10-24' abstract: The mrremind packages contains data preprocessing for the REMIND model. authors: - family-names: Baumstark diff --git a/DESCRIPTION b/DESCRIPTION index 99f93a38..35527e87 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrremind Title: MadRat REMIND Input Data Package -Version: 0.193.9 -Date: 2024-10-12 +Version: 0.193.10 +Date: 2024-10-24 Authors@R: c( person("Lavinia", "Baumstark", , "lavinia@pik-potsdam.de", role = c("aut", "cre")), person("Renato", "Rodrigues", role = "aut"), diff --git a/R/calcINNOPATHS.R b/R/calcINNOPATHS.R deleted file mode 100644 index 2e227584..00000000 --- a/R/calcINNOPATHS.R +++ /dev/null @@ -1,58 +0,0 @@ -calcINNOPATHS <- function() { - - x <- readSource("INNOPATHS") - - # merge variable and unit to one dimension - getNames(x, dim = 1) <- paste0(gsub("\\.", " (", getNames(x)), ")") - x <- collapseDim(x, dim = 3.2) - - map <- toolGetMapping("Mapping_INNOPATHS.csv", type = "reportingVariables", where = "mrremind") %>% - filter(!is.na(.data$REMIND)) - - for (var in intersect(getNames(x, dim = 1), unique(map$Variable))) { - - conv <- map[map$Variable == var, "factor"] - - # there should be a distinct conversion factor in the mapping - # if there is more than one conversion factor, it means that one source variable - # is converted two more than one target variable using a different conversion - # this case is not covered by the logic - if (length(unique(conv)) > 1) { - stop(paste0("Cannot apply conversion factor for variable ", var)) - } - - x[, , var] <- x[, , var] * unique(conv) - } - - x <- toolAggregate(x, - dim = 3.1, rel = map, from = "Variable", - to = "REMIND", partrel = TRUE, verbosity = 2 - ) - - # convert currency units from EUR 2015 to $2017 - tmp <- x[, , "EUR2015", pmatch = TRUE] - x <- x[, , getNames(tmp), invert = TRUE] - getNames(tmp) <- gsub("EUR2015", "US$2017", getNames(tmp)) - - tmp <- GDPuc::toolConvertGDP( - gdp = tmp, - unit_in = "constant 2015 EUR", - unit_out = mrdrivers::toolGetUnitDollar(), - replace_NAs = "with_USA" - ) - - x <- mbind(x, tmp) - - weights <- x - weights[, , ] <- NA - weights[, , "US$2017", pmatch = TRUE] <- 1 - weights[, , "GDP|MER (billion US$2017/yr)"] <- NA - - return(list( - x = x, - weight = weights, - mixed_aggregation = TRUE, - unit = "Various", - description = "INNOPATHS projections as REMIND variables" - )) -} diff --git a/R/convertINNOPATHS.R b/R/convertINNOPATHS.R deleted file mode 100644 index a60253ae..00000000 --- a/R/convertINNOPATHS.R +++ /dev/null @@ -1,25 +0,0 @@ -convertINNOPATHS <- function(x) { - - regmapping <- toolGetMapping("regionmapping_21_EU11.csv", type = "regional", where = "mappingfolder") - - gdpPerCapita <- calcOutput("GDPpc", scenario = "SSP2EU", aggregate = FALSE) - - # ensure that regions match for disaggregation - commonRegions <- intersect(getItems(x, dim = 1), regmapping$RegionCode) - - # restrict disaggregation to EU28 countries - Non28EUcountries <- c("ALA", "FRO", "GIB", "GGY", "IMN", "JEY") - - regmapping <- regmapping %>% filter( - !!sym("RegionCode") %in% commonRegions, - !(!!sym("CountryCode") %in% Non28EUcountries) - ) - x <- x[commonRegions, , ] - w <- gdpPerCapita[regmapping$CountryCode, 2005, "gdppc_SSP2EU"] - - x <- toolAggregate(x, regmapping, from = "RegionCode", to = "CountryCode", weight = w) - - x <- toolCountryFill(x, fill = NA, verbosity = 2) - x[Non28EUcountries, , ] <- 0 - return(x) -} diff --git a/R/fullVALIDATIONREMIND.R b/R/fullVALIDATIONREMIND.R index 1c3e926b..cf2169e2 100644 --- a/R/fullVALIDATIONREMIND.R +++ b/R/fullVALIDATIONREMIND.R @@ -192,15 +192,6 @@ fullVALIDATIONREMIND <- function(rev = 0) { writeArgs = list(scenario = "historical") ) - # INNOPATHS ---- - - calcOutput( - type = "INNOPATHS", file = valfile, - aggregate = columnsForAggregation, append = TRUE, warnNA = FALSE, - try = FALSE, years = years, - writeArgs = list(scenario = "historical", model = "INNOPATHS") - ) - # JRC IDEES ---- calcOutput( diff --git a/R/readINNOPATHS.R b/R/readINNOPATHS.R deleted file mode 100644 index 2ca7c9e2..00000000 --- a/R/readINNOPATHS.R +++ /dev/null @@ -1,11 +0,0 @@ -#' Read INNOPATHS -readINNOPATHS <- function() { - utils::read.csv(file = "INNPATHS database.csv", sep = ";") %>% - tidyr::pivot_longer(tidyselect::starts_with("X"), - names_to = "period", - names_pattern = "X(.*)", - names_transform = as.numeric) %>% - dplyr::filter(!is.na(.data$value)) %>% - dplyr::select(-"MODEL", -"SCENARIO") %>% - as.magpie(spatial = 1, temporal = 4) -} diff --git a/README.md b/README.md index 3b5e7853..2e8fd3fb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat REMIND Input Data Package -R package **mrremind**, version **0.193.9** +R package **mrremind**, version **0.193.10** [![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 (2024). _mrremind: MadRat REMIND Input Data Package_. R package version 0.193.10, . A BibTeX entry for LaTeX users is @@ -48,7 +48,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 and Pascal Weigmann and Oliver Richters and Robin Hasse and Sophie Fuchs and Rahel Mandaroux and Johannes Koch}, year = {2024}, - note = {R package version 0.193.9}, + note = {R package version 0.193.10}, url = {https://github.com/pik-piam/mrremind}, } ``` diff --git a/man/readINNOPATHS.Rd b/man/readINNOPATHS.Rd deleted file mode 100644 index c1e6a8f6..00000000 --- a/man/readINNOPATHS.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/readINNOPATHS.R -\name{readINNOPATHS} -\alias{readINNOPATHS} -\title{Read INNOPATHS} -\usage{ -readINNOPATHS() -} -\description{ -Read INNOPATHS -} From 6e3f155b8bd5dbf2fbe9f921f2d706e7f3a1bc8d Mon Sep 17 00:00:00 2001 From: Falk Benke Date: Thu, 24 Oct 2024 15:21:20 +0200 Subject: [PATCH 2/2] increment version --- .buildlibrary | 3 ++- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 121bdb9a..d1498702 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '38825220' +ValidationKey: '38858820' AcceptedWarnings: - Invalid URL: .* AcceptedNotes: @@ -7,3 +7,4 @@ AcceptedNotes: AutocreateReadme: yes allowLinterWarnings: yes enforceVersionUpdate: yes +skipCoverage: yes diff --git a/CITATION.cff b/CITATION.cff index b846b619..e663861c 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.194.0 -date-released: '2024-10-17' +version: 0.194.1 +date-released: '2024-10-24' abstract: The mrremind packages contains data preprocessing for the REMIND model. authors: - family-names: Baumstark diff --git a/DESCRIPTION b/DESCRIPTION index 823ed99c..d798d626 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrremind Title: MadRat REMIND Input Data Package -Version: 0.194.0 -Date: 2024-10-17 +Version: 0.194.1 +Date: 2024-10-24 Authors@R: c( person("Lavinia", "Baumstark", , "lavinia@pik-potsdam.de", role = c("aut", "cre")), person("Renato", "Rodrigues", role = "aut"), diff --git a/README.md b/README.md index e6beac73..47bf87d7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat REMIND Input Data Package -R package **mrremind**, version **0.194.0** +R package **mrremind**, version **0.194.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 (2024). _mrremind: MadRat REMIND Input Data Package_. R package version 0.194.1, . A BibTeX entry for LaTeX users is @@ -48,7 +48,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 and Pascal Weigmann and Oliver Richters and Robin Hasse and Sophie Fuchs and Rahel Mandaroux and Johannes Koch}, year = {2024}, - note = {R package version 0.194.0}, + note = {R package version 0.194.1}, url = {https://github.com/pik-piam/mrremind}, } ```