From 7aea9bac4de06e7438b049063bceddef451a148d Mon Sep 17 00:00:00 2001 From: Kristine Karstens Date: Tue, 18 Jun 2024 13:27:26 +0200 Subject: [PATCH] bugfix attributes for residues from nr to c --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/Residues.R | 7 ++++--- R/SOM2.R | 2 +- R/reportResidues.R | 1 - README.md | 6 +++--- man/Residues.Rd | 1 - man/SOM2.Rd | 2 +- man/reportResidues.Rd | 2 -- 10 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index f67e6c7..fe1e751 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '4773840' +ValidationKey: '4793972' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 6577023..b056593 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: 'magpie4: MAgPIE outputs R package for MAgPIE version 4.x' -version: 2.4.0 -date-released: '2024-06-17' +version: 2.4.1 +date-released: '2024-06-18' abstract: Common output routines for extracting results from the MAgPIE framework (versions 4.x). authors: diff --git a/DESCRIPTION b/DESCRIPTION index e1952e2..6a73f84 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: magpie4 Title: MAgPIE outputs R package for MAgPIE version 4.x -Version: 2.4.0 -Date: 2024-06-17 +Version: 2.4.1 +Date: 2024-06-18 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Florian", "Humpenoeder", , "humpenoeder@pik-potsdam.de", role = "aut"), diff --git a/R/Residues.R b/R/Residues.R index 4e7d0da..3ba7313 100644 --- a/R/Residues.R +++ b/R/Residues.R @@ -16,11 +16,11 @@ #' \dontrun{ #' x <- Residues(gdx) #' } -#' @importFrom madrat toolAggregate +#' @importFrom madrat toolAggregate Residues <- function(gdx, level = "regglo", products = "kres", waterAggr = TRUE, output = "all"){ - attr <- "nr" # before dm + attr <- "c" # before dm kres <- readGDX(gdx, "kres") kresfull <- c(kres, "res_nouse") kcr <- readGDX(gdx, "kcr") @@ -51,7 +51,7 @@ Residues <- function(gdx, level = "regglo", products = "kres", waterAggr = TRUE, # When aggregating to kres no water specific results are possible wSpecific <- any(grepl("^w$", getSets(biomassAgKcr))) if (waterAggr == FALSE && "wSpecific != TRUE" ) { - note("No water-type specific output available.") + stop("No water-type specific output available.") } if (products == "kres"){ @@ -226,3 +226,4 @@ Residues <- function(gdx, level = "regglo", products = "kres", waterAggr = TRUE, return(out) } + diff --git a/R/SOM2.R b/R/SOM2.R index 147c9e3..4bb22a5 100644 --- a/R/SOM2.R +++ b/R/SOM2.R @@ -18,7 +18,7 @@ #' @author Kristine Karstens #' @examples #' \dontrun{ -#' x <- SOM2(gdx) +#' x <- SOM2(gdx) #' } #' SOM2 <- function(gdx, type = "stock", level = "regglo", noncropAggr = TRUE) { diff --git a/R/reportResidues.R b/R/reportResidues.R index c40769b..3f14711 100644 --- a/R/reportResidues.R +++ b/R/reportResidues.R @@ -4,7 +4,6 @@ #' @export #' #' @param gdx GDX file -#' @param baseyear baseyear for calculating carbon stock change #' @author Kristine Karstens #' @examples #' \dontrun{ diff --git a/README.md b/README.md index 864d719..7a4de46 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MAgPIE outputs R package for MAgPIE version 4.x -R package **magpie4**, version **2.4.0** +R package **magpie4**, version **2.4.1** [![CRAN status](https://www.r-pkg.org/badges/version/magpie4)](https://cran.r-project.org/package=magpie4) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158582.svg)](https://doi.org/10.5281/zenodo.1158582) [![R build status](https://github.com/pik-piam/magpie4/workflows/check/badge.svg)](https://github.com/pik-piam/magpie4/actions) [![codecov](https://codecov.io/gh/pik-piam/magpie4/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/magpie4) [![r-universe](https://pik-piam.r-universe.dev/badges/magpie4)](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.4.0, . +Bodirsky B, Humpenoeder F, Dietrich J, Stevanovic M, Weindl I, Karstens K, Wang X, Mishra A, Beier F, Breier J, Yalew A, Chen D, Biewald A, Wirth S, von Jeetze P, Leip D, Crawford M, Alves M (2024). _magpie4: MAgPIE outputs R package for MAgPIE version 4.x_. doi:10.5281/zenodo.1158582 , R package version 2.4.1, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is title = {magpie4: MAgPIE outputs R package for MAgPIE version 4.x}, author = {Benjamin Leon Bodirsky and Florian Humpenoeder and Jan Philipp Dietrich and Miodrag Stevanovic and Isabelle Weindl and Kristine Karstens and Xiaoxi Wang and Abhijeet Mishra and Felicitas Beier and Jannes Breier and Amsalu Woldie Yalew and David Chen and Anne Biewald and Stephen Wirth and Patrick {von Jeetze} and Debbora Leip and Michael Crawford and Marcos Alves}, year = {2024}, - note = {R package version 2.4.0}, + note = {R package version 2.4.1}, doi = {10.5281/zenodo.1158582}, url = {https://github.com/pik-piam/magpie4}, } diff --git a/man/Residues.Rd b/man/Residues.Rd index 47e5aaa..9fb92c9 100644 --- a/man/Residues.Rd +++ b/man/Residues.Rd @@ -34,7 +34,6 @@ reads various crop residue (carbon) outputs out of a MAgPIE gdx file \dontrun{ x <- Residues(gdx) } - @importFrom madrat toolAggregate } \seealso{ \code{\link{ResidueBiomass}} diff --git a/man/SOM2.Rd b/man/SOM2.Rd index 5124f7a..4757a2c 100644 --- a/man/SOM2.Rd +++ b/man/SOM2.Rd @@ -29,7 +29,7 @@ Calculates soil organic carbon stock size } \examples{ \dontrun{ -x <- SOM2(gdx) + x <- SOM2(gdx) } } diff --git a/man/reportResidues.Rd b/man/reportResidues.Rd index baae94a..b247403 100644 --- a/man/reportResidues.Rd +++ b/man/reportResidues.Rd @@ -8,8 +8,6 @@ reportResidues(gdx) } \arguments{ \item{gdx}{GDX file} - -\item{baseyear}{baseyear for calculating carbon stock change} } \description{ Report soil organic carbon stock size for future MAgPIE projections