From 09734f94211fc6e44d86ff39eaca8d2a510489af Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 11 Feb 2025 20:52:32 +0100 Subject: [PATCH] bugfix net forest area change --- .buildlibrary | 2 +- CITATION.cff | 2 +- DESCRIPTION | 2 +- R/NetForestChange.R | 8 ++++---- README.md | 6 +++--- man/NetForestChange.Rd | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 64217834..1ff25427 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '435029430' +ValidationKey: '435049560' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index 9d4e6257..32be967e 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: 2.16.11 +version: 2.16.12 date-released: '2025-02-11' abstract: Common output routines for extracting results from the MAgPIE framework (versions 4.x). diff --git a/DESCRIPTION b/DESCRIPTION index af906506..b5a6da78 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: magpie4 Title: MAgPIE outputs R package for MAgPIE version 4.x -Version: 2.16.11 +Version: 2.16.12 Date: 2025-02-11 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), diff --git a/R/NetForestChange.R b/R/NetForestChange.R index 67033ed0..2be00b54 100644 --- a/R/NetForestChange.R +++ b/R/NetForestChange.R @@ -6,7 +6,7 @@ #' @param gdx GDX file #' @param file a file name the output should be written to using write.magpie #' @param level Level of regional aggregation; "reg" (regional), "glo" (global), "regglo" (regional and global) or any other aggregation level defined in superAggregate -#' @param lowpass number of lowpass filter iterations (default = 3) +#' @param lowpass number of lowpass filter iterations (default = 1) #' @return Net Forest Change as MAgPIE object (Mha per year) #' @author Florian Humpenoeder #' @importFrom magclass new.magpie getCells lowpass setNames getNames getYears setYears @@ -15,7 +15,7 @@ #' x <- NetForestChange(gdx) #' } #' -NetForestChange <- function(gdx, file = NULL, level = "cell", lowpass = 3) { +NetForestChange <- function(gdx, file = NULL, level = "cell", lowpass = 1) { # get year diff im_years <- collapseNames(m_yeardiff(gdx)) # get forest area @@ -32,8 +32,8 @@ NetForestChange <- function(gdx, file = NULL, level = "cell", lowpass = 3) { # years years <- getYears(a, as.integer = T) - yr_hist <- years[years > 1995 & years <= 2020] - yr_fut <- years[years >= 2020] + yr_hist <- years[years > 1995 & years <= 2025] + yr_fut <- years[years >= 2025] # apply lowpass filter (not applied on 1st time step, applied seperatly on historic and future period) if (!is.null(lowpass)) a <- mbind(a[, 1995, ], lowpass(a[, yr_hist, ], i = lowpass), lowpass(a[, yr_fut, ], i = lowpass)[, -1, ]) diff --git a/README.md b/README.md index f522bbfb..04ddd1df 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.16.11** +R package **magpie4**, version **2.16.12** [![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 , Version: 2.16.11, . +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, Bonsch M, Vartika S (2025). "magpie4: MAgPIE outputs R package for MAgPIE version 4.x." doi:10.5281/zenodo.1158582 , Version: 2.16.12, . A BibTeX entry for LaTeX users is @@ -51,6 +51,6 @@ A BibTeX entry for LaTeX users is date = {2025-02-11}, year = {2025}, url = {https://github.com/pik-piam/magpie4}, - note = {Version: 2.16.11}, + note = {Version: 2.16.12}, } ``` diff --git a/man/NetForestChange.Rd b/man/NetForestChange.Rd index 968c8679..e5d8ce29 100644 --- a/man/NetForestChange.Rd +++ b/man/NetForestChange.Rd @@ -4,7 +4,7 @@ \alias{NetForestChange} \title{NetForestChange} \usage{ -NetForestChange(gdx, file = NULL, level = "cell", lowpass = 3) +NetForestChange(gdx, file = NULL, level = "cell", lowpass = 1) } \arguments{ \item{gdx}{GDX file} @@ -13,7 +13,7 @@ NetForestChange(gdx, file = NULL, level = "cell", lowpass = 3) \item{level}{Level of regional aggregation; "reg" (regional), "glo" (global), "regglo" (regional and global) or any other aggregation level defined in superAggregate} -\item{lowpass}{number of lowpass filter iterations (default = 3)} +\item{lowpass}{number of lowpass filter iterations (default = 1)} } \value{ Net Forest Change as MAgPIE object (Mha per year)