From 9f47b7f331f515f181ca84d13b39f1e485229ce2 Mon Sep 17 00:00:00 2001 From: caviddhen Date: Wed, 10 Jan 2024 18:26:19 +0100 Subject: [PATCH] add grid pop to clustering calculations --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- R/calcClusterBase.R | 6 ++++++ README.md | 8 ++++---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 9f783341..00f3d3a3 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '27487080' +ValidationKey: '27545872' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 41b03d2f..a6576d9e 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: 'mrmagpie: madrat based MAgPIE Input Data Library' -version: 1.39.5 -date-released: '2023-12-13' +version: 1.39.6 +date-released: '2024-01-10' abstract: Provides functions for MAgPIE country and cellular input data generation. authors: - family-names: Karstens diff --git a/DESCRIPTION b/DESCRIPTION index 1e75b54e..be2b59a3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrmagpie Title: madrat based MAgPIE Input Data Library -Version: 1.39.5 -Date: 2023-12-13 +Version: 1.39.6 +Date: 2024-01-10 Authors@R: c( person("Kristine", "Karstens", , "karstens@pik-potsdam.de", role = c("aut", "cre")), person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = "aut"), diff --git a/R/calcClusterBase.R b/R/calcClusterBase.R index 0556d9ea..3a3810b2 100755 --- a/R/calcClusterBase.R +++ b/R/calcClusterBase.R @@ -23,6 +23,9 @@ calcClusterBase <- function(clusterdata = "yield_airrig", years = 1995, aggregate = FALSE) d$td <- calcOutput("TransportTime", cells = "lpjcell", aggregate = FALSE)[, , rep(1, floor(ndata(d$yld) / 2))] + gridpop <- collapseNames(calcOutput("GridPop", source = "Gao", urban = FALSE, + aggregate = FALSE, years = 1995)[, , "SSP2"]) + d$gp <- gridpop[, , rep(1, floor(ndata(d$yld) / 2))] } else if (clusterdata == "yield_increment") { @@ -33,6 +36,9 @@ calcClusterBase <- function(clusterdata = "yield_airrig", - collapseNames(yield[, , "rainfed"][, , "pasture", invert = TRUE])) d$td <- calcOutput("TransportTime", cells = "lpjcell", aggregate = FALSE)[, , rep(1, ndata(d$yld))] + gridpop <- collapseNames(calcOutput("GridPop", source = "Gao", urban = FALSE, + aggregate = FALSE, years = 1995)[, , "SSP2"]) + d$gp <- gridpop[, , rep(1, floor(ndata(d$yld)))] } else { stop("Specify clusterdata argument: yield_airrig (old clustering data) diff --git a/README.md b/README.md index ec0ee632..3f29947c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # madrat based MAgPIE Input Data Library -R package **mrmagpie**, version **1.39.5** +R package **mrmagpie**, version **1.39.6** [![CRAN status](https://www.r-pkg.org/badges/version/mrmagpie)](https://cran.r-project.org/package=mrmagpie) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4319612.svg)](https://doi.org/10.5281/zenodo.4319612) [![R build status](https://github.com/pik-piam/mrmagpie/workflows/check/badge.svg)](https://github.com/pik-piam/mrmagpie/actions) [![codecov](https://codecov.io/gh/pik-piam/mrmagpie/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrmagpie) [![r-universe](https://pik-piam.r-universe.dev/badges/mrmagpie)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Kristine Karstens . +Karstens K, Dietrich J, Chen D, Windisch M, Alves M, Beier F, Köberle A, v. Jeetze P, Mishra A, Humpenoeder F, Sauer P (2024). _mrmagpie: madrat based MAgPIE Input Data Library_. doi: 10.5281/zenodo.4319612 (URL: https://doi.org/10.5281/zenodo.4319612), R package version 1.39.6, . A BibTeX entry for LaTeX users is @@ -47,8 +47,8 @@ A BibTeX entry for LaTeX users is @Manual{, title = {mrmagpie: madrat based MAgPIE Input Data Library}, author = {Kristine Karstens and Jan Philipp Dietrich and David Chen and Michael Windisch and Marcos Alves and Felicitas Beier and Alexandre Köberle and Patrick {v. Jeetze} and Abhijeet Mishra and Florian Humpenoeder and Pascal Sauer}, - year = {2023}, - note = {R package version 1.39.5}, + year = {2024}, + note = {R package version 1.39.6}, doi = {10.5281/zenodo.4319612}, url = {https://github.com/pik-piam/mrmagpie}, }