From 1050540c6c2e69bd4183111a120fb8b46bf9374c Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 12 Nov 2024 10:34:21 +0100 Subject: [PATCH] bugfix --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/calcBiomeType.R | 20 ++++++++------------ README.md | 6 +++--- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index faafc0f0..169bb41c 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '29332704' +ValidationKey: '29357135' 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 0d3b18e1..d72a65bc 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: 'mrcommons: MadRat commons Input Data Library' -version: 1.46.4 -date-released: '2024-11-09' +version: 1.46.5 +date-released: '2024-11-12' abstract: Provides useful functions and a common structure to all the input data required to run models like MAgPIE and REMIND of model input data. authors: diff --git a/DESCRIPTION b/DESCRIPTION index c11b28ad..255638b1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: mrcommons Type: Package Title: MadRat commons Input Data Library -Version: 1.46.4 -Date: 2024-11-09 +Version: 1.46.5 +Date: 2024-11-12 Authors@R: c(person("Benjamin Leon", "Bodirsky", email = "bodirsky@pik-potsdam.de", role = "aut"), person("Kristine", "Karstens", role = "aut"), person("Lavinia", "Baumstark", role = "aut"), diff --git a/R/calcBiomeType.R b/R/calcBiomeType.R index b0e65001..f3f6398b 100644 --- a/R/calcBiomeType.R +++ b/R/calcBiomeType.R @@ -19,7 +19,6 @@ #' } #' calcBiomeType <- function(cells = "lpjcell") { - # get processed data from 'the nature conservancy' x <- readSource("TNC2019", convert = "onlycorrect") @@ -29,24 +28,21 @@ calcBiomeType <- function(cells = "lpjcell") { stop("Please specify cells argument") } - weight <- calcOutput("LanduseInitialisation", - aggregate = FALSE, cellular = TRUE, cells = cells, - input_magpie = TRUE, years = "y1995", round = 6) - weight <- dimSums(weight, dim = 3) + landArea <- calcOutput("LanduseInitialisation", + aggregate = FALSE, cellular = TRUE, cells = cells, + input_magpie = TRUE, years = "y1995", round = 6) + landArea <- dimSums(landArea, dim = 3) if (length(unique(dimSums(x, dim = 3))) > 2) { stop("Sum over all biome types != 1 or 0. Check readTNC2019 for errors.") } - # do not apply weight where sum over all biome types is zero - weight <- weight * dimSums(x, dim = 3) - # add a small weight to deal with regions that have only zeros - weight <- weight + 1e-10 + x <- x * landArea return(list(x = x, - weight = weight, - unit = "Share", - description = "Share of biome type of each + weight = NULL, + unit = "Mha", + description = "Mha of biome type of each biogeographic realm in each spatial unit (cell)", isocountries = FALSE)) } diff --git a/README.md b/README.md index 012f31e9..f9333777 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRat commons Input Data Library -R package **mrcommons**, version **1.46.4** +R package **mrcommons**, version **1.46.5** [![CRAN status](https://www.r-pkg.org/badges/version/mrcommons)](https://cran.r-project.org/package=mrcommons) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3822009.svg)](https://doi.org/10.5281/zenodo.3822009) [![R build status](https://github.com/pik-piam/mrcommons/workflows/check/badge.svg)](https://github.com/pik-piam/mrcommons/actions) [![codecov](https://codecov.io/gh/pik-piam/mrcommons/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrcommons) [![r-universe](https://pik-piam.r-universe.dev/badges/mrcommons)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 1.46.4, . +Bodirsky B, Karstens K, Baumstark L, Weindl I, Wang X, Mishra A, Wirth S, Stevanovic M, Steinmetz N, Kreidenweis U, Rodrigues R, Popov R, Humpenoeder F, Giannousakis A, Levesque A, Klein D, Araujo E, Beier F, Oeser J, Pehl M, Leip D, Crawford M, Molina Bacca E, von Jeetze P, Martinelli E, Schreyer F, Soergel B, Sauer P, Hötten D, Hasse R, Abrahão G, Weigmann P, Dietrich J (2024). _mrcommons: MadRat commons Input Data Library_. doi:10.5281/zenodo.3822009 , R package version 1.46.5, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is title = {mrcommons: MadRat commons Input Data Library}, author = {Benjamin Leon Bodirsky and Kristine Karstens and Lavinia Baumstark and Isabelle Weindl and Xiaoxi Wang and Abhijeet Mishra and Stephen Wirth and Mishko Stevanovic and Nele Steinmetz and Ulrich Kreidenweis and Renato Rodrigues and Roman Popov and Florian Humpenoeder and Anastasis Giannousakis and Antoine Levesque and David Klein and Ewerton Araujo and Felicitas Beier and Julian Oeser and Michaja Pehl and Debbora Leip and Michael Crawford and Edna {Molina Bacca} and Patrick {von Jeetze} and Eleonora Martinelli and Felix Schreyer and Bjoern Soergel and Pascal Sauer and David Hötten and Robin Hasse and Gabriel Abrahão and Pascal Weigmann and Jan Philipp Dietrich}, year = {2024}, - note = {R package version 1.46.4}, + note = {R package version 1.46.5}, url = {https://github.com/pik-piam/mrcommons}, doi = {10.5281/zenodo.3822009}, }