diff --git a/.buildlibrary b/.buildlibrary index 5b3e6b1..fa5b96a 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '11715040' +ValidationKey: '11753808' 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 6e0da49..644faa3 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: 'mrland: MadRaT land data package' -version: 0.59.0 -date-released: '2024-05-13' +version: 0.59.1 +date-released: '2024-06-14' abstract: The package provides land related data via the madrat framework. authors: - family-names: Dietrich @@ -40,6 +40,7 @@ authors: - family-names: Sauer given-names: Pascal license: LGPL-3.0 +keywords: ~ repository-code: https://github.com/pik-piam/mrland doi: 10.5281/zenodo.3822083 diff --git a/DESCRIPTION b/DESCRIPTION index 5304249..2c6cec7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrland Title: MadRaT land data package -Version: 0.59.0 -Date: 2024-05-13 +Version: 0.59.1 +Date: 2024-06-14 Authors@R: c( person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = c("aut", "cre")), person("Abhijeet", "Mishra", role = "aut"), diff --git a/R/calcCroplandTreecover.R b/R/calcCroplandTreecover.R index 88af601..622ca04 100644 --- a/R/calcCroplandTreecover.R +++ b/R/calcCroplandTreecover.R @@ -5,6 +5,8 @@ #' @param maginput Whether data should be corrected to align with cropland #' initialised in MAgPIE. #' @param cells magpiecell (59199 cells) or lpjcell (67420 cells) +#' @param countryLevel Whether output shall be at country level. +#' Requires aggregate=FALSE in calcOutput. #' #' @return List with a magpie object #' @author Patrick v. Jeetze @@ -18,7 +20,7 @@ #' #' @importFrom mstools toolCoord2Isocell #' -calcCroplandTreecover <- function(maginput = TRUE, cells = "magpiecell") { +calcCroplandTreecover <- function(maginput = TRUE, cells = "magpiecell", countryLevel = FALSE) { treecover <- readSource("Copernicus", subtype = "CroplandTreecover", convert = "onlycorrect") if (maginput) { @@ -45,6 +47,10 @@ calcCroplandTreecover <- function(maginput = TRUE, cells = "magpiecell") { out <- collapseDim(out, dim = 3) + if (countryLevel) { + out <- toolCountryFill(dimSums(out, dim = c("x", "y")), fill = 0) + } + return(list( x = out, weight = NULL, diff --git a/README.md b/README.md index 9757ae9..3770f10 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRaT land data package -R package **mrland**, version **0.59.0** +R package **mrland**, version **0.59.1** [![CRAN status](https://www.r-pkg.org/badges/version/mrland)](https://cran.r-project.org/package=mrland) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3822083.svg)](https://doi.org/10.5281/zenodo.3822083) [![R build status](https://github.com/pik-piam/mrland/workflows/check/badge.svg)](https://github.com/pik-piam/mrland/actions) [![codecov](https://codecov.io/gh/pik-piam/mrland/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrland) [![r-universe](https://pik-piam.r-universe.dev/badges/mrland)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 0.59.0, . +Dietrich J, Mishra A, Weindl I, Bodirsky B, Wang X, Baumstark L, Kreidenweis U, Klein D, Steinmetz N, Chen D, Humpenoeder F, von Jeetze P, Wirth S, Beier F, Hoetten D, Sauer P (2024). _mrland: MadRaT land data package_. doi:10.5281/zenodo.3822083 , R package version 0.59.1, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is title = {mrland: MadRaT land data package}, author = {Jan Philipp Dietrich and Abhijeet Mishra and Isabelle Weindl and Benjamin Leon Bodirsky and Xiaoxi Wang and Lavinia Baumstark and Ulrich Kreidenweis and David Klein and Nele Steinmetz and David Chen and Florian Humpenoeder and Patrick {von Jeetze} and Stephen Wirth and Felicitas Beier and David Hoetten and Pascal Sauer}, year = {2024}, - note = {R package version 0.59.0}, + note = {R package version 0.59.1}, url = {https://github.com/pik-piam/mrland}, doi = {10.5281/zenodo.3822083}, } diff --git a/man/calcCroplandTreecover.Rd b/man/calcCroplandTreecover.Rd index 9ea1947..adcba8c 100644 --- a/man/calcCroplandTreecover.Rd +++ b/man/calcCroplandTreecover.Rd @@ -4,13 +4,20 @@ \alias{calcCroplandTreecover} \title{calcCroplandTreecover} \usage{ -calcCroplandTreecover(maginput = TRUE, cells = "magpiecell") +calcCroplandTreecover( + maginput = TRUE, + cells = "magpiecell", + countryLevel = FALSE +) } \arguments{ \item{maginput}{Whether data should be corrected to align with cropland initialised in MAgPIE.} \item{cells}{magpiecell (59199 cells) or lpjcell (67420 cells)} + +\item{countryLevel}{Whether output shall be at country level. +Requires aggregate=FALSE in calcOutput.} } \value{ List with a magpie object