diff --git a/.buildlibrary b/.buildlibrary index d4b7270..6faa203 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '2344204432' +ValidationKey: '2344224096' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 4f48cea..3268489 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,7 +2,7 @@ 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: 1.192.13 +version: 1.192.14 date-released: '2023-11-03' abstract: Common output routines for extracting results from the MAgPIE framework (versions 4.x). diff --git a/DESCRIPTION b/DESCRIPTION index f9e215e..5262ac1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: magpie4 Title: MAgPIE outputs R package for MAgPIE version 4.x -Version: 1.192.13 +Version: 1.192.14 Date: 2023-11-03 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), diff --git a/R/getDirectory.R b/R/getDirectory.R index 27d4d47..2763995 100644 --- a/R/getDirectory.R +++ b/R/getDirectory.R @@ -10,4 +10,4 @@ getDirectory <- function(dir,spamfiledirectory) { if(dir==".") dir <- spamfiledirectory } return(dir) -} \ No newline at end of file +} diff --git a/R/getReport.R b/R/getReport.R index c9b8f5e..620b56d 100644 --- a/R/getReport.R +++ b/R/getReport.R @@ -166,6 +166,7 @@ getReport <- function(gdx, file = NULL, scenario = NULL, filter = c(1, 2, 7), "reportLaborProductivity(gdx)", "reportLocalDemandShares(gdx, type = 'prod')", "reportLocalDemandShares(gdx, type = 'dem')", + "reportLocalDemandShares(gdx, type = 'potential')", "reportCostsWholesale(gdx)", gdx = gdx ) diff --git a/R/localDemandShares.R b/R/localDemandShares.R index 5a0af0c..d3060b2 100644 --- a/R/localDemandShares.R +++ b/R/localDemandShares.R @@ -168,6 +168,12 @@ localDemandShares <- function(gdx, type = "prod", level = "reg", product_aggr = pr <- mbind(pr, prli) pr <- mbind(pr, prpast) + + # get actual amount consumed + localFoodConsumed <- readGDX(gdx, "ov72_dem_for_local", + select = list(type = "level"), react = "silent") + if (is.null(localFoodConsumed)) { return (NULL)} + localFoodConsumed <- localFoodConsumed[, , getItems(pr, dim = 3)] shr <- dimSums(localFoodConsumed, diff --git a/README.md b/README.md index a81888f..bfa0ded 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MAgPIE outputs R package for MAgPIE version 4.x -R package **magpie4**, version **1.192.13** +R package **magpie4**, version **1.192.14** [![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 . +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 (2023). _magpie4: MAgPIE outputs R package for MAgPIE version 4.x_. doi: 10.5281/zenodo.1158582 (URL: https://doi.org/10.5281/zenodo.1158582), R package version 1.192.14, . 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 = {2023}, - note = {R package version 1.192.13}, + note = {R package version 1.192.14}, doi = {10.5281/zenodo.1158582}, url = {https://github.com/pik-piam/magpie4}, }