From 9e3a76c839d32561be3e17d61c1a810ecd9a423a Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Wed, 8 May 2024 15:33:02 +0200 Subject: [PATCH] temporarily toolAggregate warning is just note --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/toolAggregate.R | 11 ++++++++--- README.md | 6 +++--- tests/testthat/test-toolAggregate.R | 2 +- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index b732b8e..05a2736 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '61721060' +ValidationKey: '61756461' 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 bb1eaa2..172aa90 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: 'madrat: May All Data be Reproducible and Transparent (MADRaT) *' -version: 3.11.0 -date-released: '2024-05-03' +version: 3.11.1 +date-released: '2024-05-08' abstract: Provides a framework which should improve reproducibility and transparency in data processing. It provides functionality such as automatic meta data creation and management, rudimentary quality management, data caching, work-flow management diff --git a/DESCRIPTION b/DESCRIPTION index 6588939..9b688d2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: madrat Title: May All Data be Reproducible and Transparent (MADRaT) * -Version: 3.11.0 -Date: 2024-05-03 +Version: 3.11.1 +Date: 2024-05-08 Authors@R: c( person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = c("aut", "cre")), person("Lavinia", "Baumstark", , "lavinia@pik-potsdam.de", role = "aut"), diff --git a/R/toolAggregate.R b/R/toolAggregate.R index 6131ddb..eb915e7 100644 --- a/R/toolAggregate.R +++ b/R/toolAggregate.R @@ -252,9 +252,14 @@ toolAggregate <- function(x, rel, weight = NULL, from = NULL, to = NULL, dim = 1 tmp <- toolAggregate(weight, rel, from = from, to = to, dim = wdim, partrel = partrel, verbosity = 10) if (zeroWeight != "allow" && any(tmp == 0, na.rm = TRUE)) { if (zeroWeight == "warn") { - warning("Weight sum is 0, so cannot normalize and will return 0 for some ", - "aggregation targets. This changes the total sum of the magpie object! ", - 'If this is really intended set zeroWeight = "allow".') + msg <- paste0("Weight sum is 0, so cannot normalize and will return 0 for some ", + "aggregation targets. This changes the total sum of the magpie object! ", + 'If this is really intended set zeroWeight = "allow".') + if (Sys.Date() < "2024-06-01") { + message(msg) + } else { + warning(msg) + } } else { stop("Weight sum is 0, so cannot normalize. This changes the total sum of the magpie object!") } diff --git a/README.md b/README.md index 0c7d092..c7ad94b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # May All Data be Reproducible and Transparent (MADRaT) * -R package **madrat**, version **3.11.0** +R package **madrat**, version **3.11.1** [![CRAN status](https://www.r-pkg.org/badges/version/madrat)](https://cran.r-project.org/package=madrat) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1115490.svg)](https://doi.org/10.5281/zenodo.1115490) [![R build status](https://github.com/pik-piam/madrat/workflows/check/badge.svg)](https://github.com/pik-piam/madrat/actions) [![codecov](https://codecov.io/gh/pik-piam/madrat/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/madrat) [![r-universe](https://pik-piam.r-universe.dev/badges/madrat)](https://pik-piam.r-universe.dev/builds) @@ -55,7 +55,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 3.11.0, . +Dietrich J, Baumstark L, Wirth S, Giannousakis A, Rodrigues R, Bodirsky B, Leip D, Kreidenweis U, Klein D, Sauer P (2024). _madrat: May All Data be Reproducible and Transparent (MADRaT)_. doi:10.5281/zenodo.1115490 , R package version 3.11.1, . A BibTeX entry for LaTeX users is @@ -64,7 +64,7 @@ A BibTeX entry for LaTeX users is title = {madrat: May All Data be Reproducible and Transparent (MADRaT)}, author = {Jan Philipp Dietrich and Lavinia Baumstark and Stephen Wirth and Anastasis Giannousakis and Renato Rodrigues and Benjamin Leon Bodirsky and Debbora Leip and Ulrich Kreidenweis and David Klein and Pascal Sauer}, year = {2024}, - note = {R package version 3.11.0}, + note = {R package version 3.11.1}, url = {https://github.com/pik-piam/madrat}, doi = {10.5281/zenodo.1115490}, } diff --git a/tests/testthat/test-toolAggregate.R b/tests/testthat/test-toolAggregate.R index ccf79d4..667c6d8 100644 --- a/tests/testthat/test-toolAggregate.R +++ b/tests/testthat/test-toolAggregate.R @@ -222,7 +222,7 @@ test_that("Edge cases work", { test_that("columns with only zeros in weight produce a warning", { weight <- pm weight[, , ] <- 0 - expect_warning(toolAggregate(pm, rel, weight = weight), "Weight sum is 0") + expect_message(toolAggregate(pm, rel, weight = weight), "Weight sum is 0") expect_error(toolAggregate(pm, rel, weight = weight, zeroWeight = "stop"), "Weight sum is 0") expect_silent(toolAggregate(pm, rel, weight = weight, zeroWeight = "allow")) })