From 1ca952efc7446c218654107023bc60fbe5012430 Mon Sep 17 00:00:00 2001 From: bodirsky Date: Mon, 19 Feb 2024 08:39:52 +0100 Subject: [PATCH] added more feed validation indicators --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/calcValidFeedConversion.R | 16 ++++++++++++++++ README.md | 8 ++++---- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index d4b6567..69a1b11 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '504281680' +ValidationKey: '50616320' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 34e8f7f..c918a60 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.55.10 -date-released: '2024-02-15' +version: 2.56.0 +date-released: '2024-02-19' abstract: Package contains routines to prepare data for validation exercises. authors: - family-names: Bodirsky diff --git a/DESCRIPTION b/DESCRIPTION index 3fa8644..c4089c6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrvalidation Title: madrat data preparation for validation purposes -Version: 2.55.10 -Date: 2024-02-15 +Version: 2.56.0 +Date: 2024-02-19 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Stephen", "Wirth", role = "aut"), diff --git a/R/calcValidFeedConversion.R b/R/calcValidFeedConversion.R index 2957735..19239bc 100644 --- a/R/calcValidFeedConversion.R +++ b/R/calcValidFeedConversion.R @@ -157,15 +157,31 @@ calcValidFeedConversion <- function(livestockSystem = TRUE, subtractBalanceflow indicatorTmp <- dimSums( feedProductspecific[, , c("Other roughage intensity", "Pasture intensity")], dim = "ItemCodeItem") / quotientTmp + indicatorTmp2 <- dimSums( + feedProductspecific[, , c("Pasture intensity")], + dim = "ItemCodeItem") / quotientTmp if (livestockSystem == TRUE) { quotientTmp <- quotientTmp[, , "Ruminant meat and dairy"] indicatorTmp <- indicatorTmp[, , "Ruminant meat and dairy"] + indicatorTmp2 <- indicatorTmp[, , "Ruminant meat and dairy"] } prefix <- "Productivity|Roughage share|" nameIndicator <- paste0(prefix, getNames(indicatorTmp, dim = 1), " (", "GE per GE", ")") x <- mbind(x, setNames(collapseNames(indicatorTmp[, , "ge"]), nameIndicator)) weight <- mbind(weight, setNames(quotientTmp[, , "ge"], nameIndicator)) + prefix <- "Productivity|Pasture share|" + nameIndicator <- paste0(prefix, getNames(indicatorTmp2, dim = 1), " (", "GE per GE", ")") + x <- mbind(x, setNames(collapseNames(indicatorTmp2[, , "ge"]), nameIndicator)) + weight <- mbind(weight, setNames(quotientTmp[, , "ge"], nameIndicator)) + + # add livestock yields + livestockYield <- calcOutput("LivestockProductivity", future = FALSE, aggregate = FALSE, supplementary = TRUE) + prefix <- "Productivity|Livestock system yield|" + nameIndicator <- paste0(prefix, getNames(livestockYield$x, dim = 1), " (", "DM per live animal", ")") + x <- mbind(x, setNames(livestockYield$x, nameIndicator)) + weight <- mbind(weight, setNames(livestockYield$weight, nameIndicator)) + x <- add_dimension(x, dim = 3.1, add = "scenario", nm = "historical") x <- add_dimension(x, dim = 3.2, add = "model", nm = "Weindl_et_al2017") diff --git a/README.md b/README.md index 2c07ef7..7189b7e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # madrat data preparation for validation purposes -R package **mrvalidation**, version **2.55.10** +R package **mrvalidation**, version **2.56.0** [![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.55.10, . +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.0, . A BibTeX entry for LaTeX users is @@ -48,8 +48,8 @@ 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.55.10}, - url = {https://github.com/pik-piam/mrvalidation}, + note = {R package version 2.56.0}, doi = {10.5281/zenodo.4317826}, + url = {https://github.com/pik-piam/mrvalidation}, } ```