From 7a67f9efb08bf4896d418a9422b13c417a2f770c Mon Sep 17 00:00:00 2001 From: bodirsky Date: Mon, 26 Feb 2024 10:10:07 +0100 Subject: [PATCH] reporting fix, yields dont add up --- .buildlibrary | 3 ++- .github/workflows/check.yaml | 5 +++++ CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/calcValidCroparea.R | 2 +- R/calcValidYield.R | 12 ++++++++---- README.md | 6 +++--- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 93f70fa..02ce032 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '50636092' +ValidationKey: '50673798' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' @@ -7,3 +7,4 @@ AcceptedNotes: - unable to verify current time - Depends: includes the non-default packages allowLinterWarnings: no +enforceVersionUpdate: no diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 870f216..46f518a 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -49,6 +49,11 @@ jobs: shell: Rscript {0} run: lucode2:::validkey(stopIfInvalid = TRUE) + - name: Verify that lucode2::buildLibrary was successful + if: github.event_name == 'pull_request' + shell: Rscript {0} + run: lucode2:::isVersionUpdated() + - name: Checks shell: Rscript {0} run: | diff --git a/CITATION.cff b/CITATION.cff index a97d320..293451d 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: 'mrvalidation: madrat data preparation for validation purposes' -version: 2.56.1 -date-released: '2024-02-19' +version: 2.56.2 +date-released: '2024-02-26' abstract: Package contains routines to prepare data for validation exercises. authors: - family-names: Bodirsky diff --git a/DESCRIPTION b/DESCRIPTION index 191b62f..1c5856a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrvalidation Title: madrat data preparation for validation purposes -Version: 2.56.1 -Date: 2024-02-19 +Version: 2.56.2 +Date: 2024-02-26 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Stephen", "Wirth", role = "aut"), diff --git a/R/calcValidCroparea.R b/R/calcValidCroparea.R index 6e05aa3..6e56c39 100644 --- a/R/calcValidCroparea.R +++ b/R/calcValidCroparea.R @@ -35,7 +35,7 @@ calcValidCroparea <- function(datasource = "FAO", detail = FALSE) { cellular = FALSE), paste("Resources|Land Cover|Cropland|+|", reportingnames("fallow"), sep = "")) cropland <- setNames(dimSums(mbind(data, fallow), dim = 3.1), - "Resources|Land Cover|+|Cropland") + "Resources|Land Cover|Cropland|+|Croparea") out <- mbind(cropland, fallow, croparea) getNames(out) <- paste(getNames(out), "(million ha)", sep = " ") out <- add_dimension(out, dim = 3.1, add = "scenario", nm = "historical") diff --git a/R/calcValidYield.R b/R/calcValidYield.R index f285d30..6d32e74 100644 --- a/R/calcValidYield.R +++ b/R/calcValidYield.R @@ -41,7 +41,8 @@ calcValidYield <- function(datasource = "FAO", future = NULL) { "pasture") area <- mbind(croparea, pastarea) area <- summationhelper(reporthelper(area, - level_zero_name = "Productivity|Yield")) + level_zero_name = "Productivity|Yield"), + sep = NULL) # Calculate production histproduction <- calcOutput("FAOmassbalance", aggregate = FALSE) @@ -57,7 +58,8 @@ calcValidYield <- function(datasource = "FAO", future = NULL) { # Calculate Yields production <- summationhelper(reporthelper(production, - level_zero_name = "Productivity|Yield")) + level_zero_name = "Productivity|Yield"), + sep = NULL) yield <- production / area # Check for NaN values @@ -113,7 +115,8 @@ calcValidYield <- function(datasource = "FAO", future = NULL) { "pasture") area <- mbind(croparea[, getYears(pastarea), ], pastarea) area <- summationhelper(reporthelper(area, - level_zero_name = "Productivity|Yield by physical area")) + level_zero_name = "Productivity|Yield by physical area"), + sep = NULL) # Calculate production histproduction <- calcOutput("FAOmassbalance", aggregate = FALSE) @@ -129,7 +132,8 @@ calcValidYield <- function(datasource = "FAO", future = NULL) { # Calculate Yields production <- summationhelper(reporthelper(production, - level_zero_name = "Productivity|Yield by physical area")) + level_zero_name = "Productivity|Yield by physical area"), + sep = NULL) yield <- production / area # Check for NaN values diff --git a/README.md b/README.md index 03554c3..98ada74 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # madrat data preparation for validation purposes -R package **mrvalidation**, version **2.56.1** +R package **mrvalidation**, version **2.56.2** [![CRAN status](https://www.r-pkg.org/badges/version/mrvalidation)](https://cran.r-project.org/package=mrvalidation) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4317826.svg)](https://doi.org/10.5281/zenodo.4317826) [![R build status](https://github.com/pik-piam/mrvalidation/workflows/check/badge.svg)](https://github.com/pik-piam/mrvalidation/actions) [![codecov](https://codecov.io/gh/pik-piam/mrvalidation/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrvalidation) [![r-universe](https://pik-piam.r-universe.dev/badges/mrvalidation)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Benjamin Leon Bodirsky , R package version 2.56.1, . +Bodirsky B, Wirth S, Karstens K, Humpenoeder F, Stevanovic M, Mishra A, Biewald A, Weindl I, Beier F, Chen D, Crawford M, Leip D, Molina Bacca E, Kreidenweis U, W. Yalew A, von Jeetze P, Wang X, Dietrich J, Alves M (2024). _mrvalidation: madrat data preparation for validation purposes_. doi:10.5281/zenodo.4317826 , R package version 2.56.2, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is title = {mrvalidation: madrat data preparation for validation purposes}, author = {Benjamin Leon Bodirsky and Stephen Wirth and Kristine Karstens and Florian Humpenoeder and Mishko Stevanovic and Abhijeet Mishra and Anne Biewald and Isabelle Weindl and Felicitas Beier and David Chen and Michael Crawford and Debbora Leip and Edna {Molina Bacca} and Ulrich Kreidenweis and Amsalu {W. Yalew} and Patrick {von Jeetze} and Xiaoxi Wang and Jan Philipp Dietrich and Marcos Alves}, year = {2024}, - note = {R package version 2.56.1}, + note = {R package version 2.56.2}, doi = {10.5281/zenodo.4317826}, url = {https://github.com/pik-piam/mrvalidation}, }