diff --git a/.buildlibrary b/.buildlibrary index d4ec0fc..39f17af 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '42675732' +ValidationKey: '42723485' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index f6ea5d4..23545e6 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -23,14 +23,14 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: | - any::lucode2 - any::covr - any::madrat - any::magclass - any::citation - any::gms - any::goxygen - any::GDPuc + lucode2 + covr + madrat + magclass + citation + gms + goxygen + GDPuc # piam packages also available on CRAN (madrat, magclass, citation, # gms, goxygen, GDPuc) will usually have an outdated binary version # available; by using extra-packages we get the newest version diff --git a/CITATION.cff b/CITATION.cff index 37adbbd..b137c1c 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: 'magpie4: MAgPIE outputs R package for MAgPIE version 4.x' -version: 2.13.4 -date-released: '2024-10-02' +version: 2.13.5 +date-released: '2024-10-15' abstract: Common output routines for extracting results from the MAgPIE framework (versions 4.x). authors: diff --git a/DESCRIPTION b/DESCRIPTION index 1c3958b..4d499a3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: magpie4 Title: MAgPIE outputs R package for MAgPIE version 4.x -Version: 2.13.4 -Date: 2024-10-02 +Version: 2.13.5 +Date: 2024-10-15 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Florian", "Humpenoeder", , "humpenoeder@pik-potsdam.de", role = "aut"), diff --git a/R/reportLandUse.R b/R/reportLandUse.R index 7bcb1d2..6610f1f 100644 --- a/R/reportLandUse.R +++ b/R/reportLandUse.R @@ -38,7 +38,14 @@ reportLandUse <- function(gdx) { x <- mbind(x,setNames(dimSums(a[,,"primforest"],dim=3), paste0("Resources|Land Cover|Forest|Natural Forest|+|", reportingnames("primforest")," (million ha)"))) x <- mbind(x,setNames(dimSums(a[,,"secdforest"],dim=3), paste0("Resources|Land Cover|Forest|Natural Forest|+|", reportingnames("secdforest")," (million ha)"))) x <- mbind(x,setNames(dimSums(a[,,c("forestry_aff","forestry_ndc","forestry_plant")],dim=3), paste0("Resources|Land Cover|Forest|+|", reportingnames("forestry")," (million ha)"))) - x <- mbind(x,setNames(dimSums(a[,,"forestry_aff"],dim=3),"Resources|Land Cover|Forest|Managed Forest|+|Afforestation (million ha)")) + s32_aff_plantation <- readGDX(gdx,"s32_aff_plantation") + if(s32_aff_plantation == 0) { + x <- mbind(x,setNames(new.magpie(getRegions(a), getYears(a), NULL, fill = 0,sets = getSets(a)),"Resources|Land Cover|Forest|Managed Forest|+|Afforestation (million ha)")) + x <- mbind(x,setNames(dimSums(a[,,"forestry_aff"],dim=3),"Resources|Land Cover|Forest|Managed Forest|+|Reforestation (million ha)")) + } else if (s32_aff_plantation == 1) { + x <- mbind(x,setNames(dimSums(a[,,"forestry_aff"],dim=3),"Resources|Land Cover|Forest|Managed Forest|+|Afforestation (million ha)")) + x <- mbind(x,setNames(new.magpie(getRegions(a), getYears(a), NULL, fill = 0,sets = getSets(a)),"Resources|Land Cover|Forest|Managed Forest|+|Reforestation (million ha)")) + } x <- mbind(x,setNames(dimSums(a[,,"forestry_ndc"],dim=3),"Resources|Land Cover|Forest|Managed Forest|+|NPI/NDC (million ha)")) x <- mbind(x,setNames(dimSums(a[,,"forestry_plant"],dim=3),"Resources|Land Cover|Forest|Managed Forest|+|Plantations (million ha)")) x <- mbind(x,setNames(dimSums(a[,,c("crop_area","crop_fallow","crop_treecover","past")],dim=3),"Resources|Land Cover|Agricultural land (million ha)")) diff --git a/README.md b/README.md index 1219222..8021a74 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MAgPIE outputs R package for MAgPIE version 4.x -R package **magpie4**, version **2.13.4** +R package **magpie4**, version **2.13.5** [![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 , R package version 2.13.4, . +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 (2024). _magpie4: MAgPIE outputs R package for MAgPIE version 4.x_. doi:10.5281/zenodo.1158582 , R package version 2.13.5, . 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 = {2024}, - note = {R package version 2.13.4}, + note = {R package version 2.13.5}, url = {https://github.com/pik-piam/magpie4}, doi = {10.5281/zenodo.1158582}, }