diff --git a/.buildlibrary b/.buildlibrary index 9cf3f7e..1084dea 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '50106580' +ValidationKey: '50128848' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 3d38abd..b55484c 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.54.0 -date-released: '2024-01-05' +version: 2.54.1 +date-released: '2024-01-06' abstract: Package contains routines to prepare data for validation exercises. authors: - family-names: Bodirsky diff --git a/DESCRIPTION b/DESCRIPTION index ec5f853..14bfc01 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrvalidation Title: madrat data preparation for validation purposes -Version: 2.54.0 -Date: 2024-01-05 +Version: 2.54.1 +Date: 2024-01-06 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Stephen", "Wirth", role = "aut"), diff --git a/R/calcValidEmisLucGlo.R b/R/calcValidEmisLucGlo.R index 5242464..c267725 100644 --- a/R/calcValidEmisLucGlo.R +++ b/R/calcValidEmisLucGlo.R @@ -1,7 +1,7 @@ #' @title calcValidEmisLucGlo -#' +#' #' @description Returns historical and projected water usage from different sources -#' +#' #' @param subtype Available subtypes are: #' \itemize{ #' \item historical: @@ -15,21 +15,25 @@ #' } #' @return list of magpie object with data and weight #' @author Florian Humpenoeder -calcValidEmisLucGlo <- function(subtype="Canadell_2007") { - - if (subtype %in% c("Canadell_2007","Friedlingstein_2010","Harris_2013", "Houghton_2012","RCP")) { - out <- readSource("EmisLucGlo", subtype, convert=F) - if(subtype %in% c("Canadell_2007","Friedlingstein_2010","Harris_2013", "Houghton_2012")) out <- out[,,"data"] * (44/12) ## Original Data in C, We validate as CO2 - out <- add_dimension(out, dim=3.1, add="scenario", nm="historical") - out <- add_dimension(out, dim=3.2, add="model", nm=subtype) - getNames(out, dim=3) <- "Emissions|CO2|Land|+|Land-use Change (Mt CO2/yr)" +calcValidEmisLucGlo <- function(subtype = "Canadell_2007") { + + if (subtype %in% c("Canadell_2007", "Friedlingstein_2010", "Harris_2013", "Houghton_2012", "RCP")) { + out <- readSource("EmisLucGlo", subtype, convert = FALSE) + if (subtype %in% c("Canadell_2007", "Friedlingstein_2010", "Harris_2013", "Houghton_2012", "RCP")) { + out <- out[, , "data"] * (44 / 12) ## Original Data in C, We validate as CO2 + } + out <- add_dimension(out, dim = 3.1, add = "scenario", nm = "historical") + out <- add_dimension(out, dim = 3.2, add = "model", nm = subtype) + getNames(out, dim = 3) <- "Emissions|CO2|Land|+|Land-use Change (Mt CO2/yr)" names(dimnames(out))[3] <- "scenario.model.variable" - } else stop("Given subtype currently not supported!") - - return(list(x=out, - weight=NULL, - unit="Mt CO2/yr", - min=0, - description="Historical land-use change CO2 emissions from different sources in Mt CO2/yr") - ) + } else { + stop("Given subtype currently not supported!") } + + return(list(x = out, + weight = NULL, + unit = "Mt CO2/yr", + min = 0, + description = "Historical land-use change CO2 emissions from different sources in Mt CO2/yr") + ) +} diff --git a/README.md b/README.md index bc8031b..9e10e84 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # madrat data preparation for validation purposes -R package **mrvalidation**, version **2.54.0** +R package **mrvalidation**, version **2.54.1** [![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 . +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.54.1, . 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.54.0}, + note = {R package version 2.54.1}, doi = {10.5281/zenodo.4317826}, url = {https://github.com/pik-piam/mrvalidation}, }