From b3e713b1efeb77a0c9f02c06194c8de9f4bda0b6 Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Thu, 1 Aug 2024 15:31:36 +0200 Subject: [PATCH] export suppressSpecificWarnings, build --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- NAMESPACE | 1 + R/suppressSpecificWarnings.R | 1 + README.md | 6 +++--- man/convergence.Rd | 19 ++++++++++--------- man/matchDim.Rd | 27 ++++++++++++++++----------- 8 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 69369e04..76d438ab 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '122820020' +ValidationKey: '123025056' 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 1615188d..47b8dbc7 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: 'magclass: Data Class and Tools for Handling Spatial-Temporal Data' -version: 6.17.0 -date-released: '2024-07-02' +version: 6.17.1 +date-released: '2024-08-01' abstract: Data class for increased interoperability working with spatial-temporal data together with corresponding functions and methods (conversions, basic calculations and basic data manipulation). The class distinguishes between spatial, temporal diff --git a/DESCRIPTION b/DESCRIPTION index cf8a4eaa..a445beed 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: magclass Title: Data Class and Tools for Handling Spatial-Temporal Data -Version: 6.17.0 -Date: 2024-07-02 +Version: 6.17.1 +Date: 2024-08-01 Authors@R: c( person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", comment = c(affiliation = "Potsdam Institute for Climate Impact Research", ORCID = "0000-0002-4309-6431"), role = c("aut", "cre")), diff --git a/NAMESPACE b/NAMESPACE index 8afae8a4..dcbff6a7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -77,6 +77,7 @@ export(setComment) export(setItems) export(setYears) export(spatRasterToDataset) +export(suppressSpecificWarnings) export(time_interpolate) export(unitsplit) export(unwrap) diff --git a/R/suppressSpecificWarnings.R b/R/suppressSpecificWarnings.R index 8c9f79e1..76b41e7e 100644 --- a/R/suppressSpecificWarnings.R +++ b/R/suppressSpecificWarnings.R @@ -11,6 +11,7 @@ #' #' @author Pascal Sauer #' @seealso \code{\link{suppressWarnings}} +#' @export suppressSpecificWarnings <- function(expr, regularExpr, fixed = FALSE) { withCallingHandlers(expr, warning = function(m) { if (grepl(regularExpr, m[["message"]], fixed = fixed)) { diff --git a/README.md b/README.md index bc7230f4..3f9372ba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Data Class and Tools for Handling Spatial-Temporal Data -R package **magclass**, version **6.17.0** +R package **magclass**, version **6.17.1** [![CRAN status](https://www.r-pkg.org/badges/version/magclass)](https://cran.r-project.org/package=magclass) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158580.svg)](https://doi.org/10.5281/zenodo.1158580) [![R build status](https://github.com/pik-piam/magclass/workflows/check/badge.svg)](https://github.com/pik-piam/magclass/actions) [![codecov](https://codecov.io/gh/pik-piam/magclass/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/magclass) [![r-universe](https://pik-piam.r-universe.dev/badges/magclass)](https://pik-piam.r-universe.dev/builds) @@ -56,7 +56,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 6.17.0, . +Dietrich J, Bodirsky B, Bonsch M, Humpenoeder F, Bi S, Karstens K, Leip D, Sauer P (2024). _magclass: Data Class and Tools for Handling Spatial-Temporal Data_. doi:10.5281/zenodo.1158580 , R package version 6.17.1, . A BibTeX entry for LaTeX users is @@ -65,7 +65,7 @@ A BibTeX entry for LaTeX users is title = {magclass: Data Class and Tools for Handling Spatial-Temporal Data}, author = {Jan Philipp Dietrich and Benjamin Leon Bodirsky and Markus Bonsch and Florian Humpenoeder and Stephen Bi and Kristine Karstens and Debbora Leip and Pascal Sauer}, year = {2024}, - note = {R package version 6.17.0}, + note = {R package version 6.17.1}, url = {https://github.com/pik-piam/magclass}, doi = {10.5281/zenodo.1158580}, } diff --git a/man/convergence.Rd b/man/convergence.Rd index f9f5e82e..273157e8 100644 --- a/man/convergence.Rd +++ b/man/convergence.Rd @@ -30,15 +30,16 @@ end_year.} directions, "up" is only a convergence if originaim} -\item{type}{"smooth", "s", "linear" or "decay". Describes the type of -convergence: linear means a linear conversion , s is an s-curve which starts -from origin in start_year and reaches aim precisely in end_year. After 50 -percent of the convergence time, it reaches about the middle of the two -values. Its based on the function min(1, pos^4/(0.07+pos^4)*1.07) smooth is -a conversion based on the function x^3/(0.1+x^3). In the latter case only -90\% of convergence will be reached in the end year, because full -convergence is reached in infinity. decay is a conversion based on the -function x/(1.5 + x)*2.5.} +\item{type}{"smooth", "s", "linear" or "decay". Describes the function used +for convergence (x starts at 0 and ends at 1): +"linear" means linear interpolation. +"s" is an s-curve which starts from origin in start_year and reaches aim +precisely in end_year. After 50\% of the convergence time, it reaches about +the middle of the two values. It's using the function x^4/(0.07+x^4)*1.07). +"smooth" is a conversion based on the function x^3/(0.1+x^3). With "smooth" +only 90\% of convergence will be reached in the end year, full +convergence is approached as x approaches infinity. +"decay" is a conversion based on the function x / (par + x) * (par + 1).} \item{par}{parameter value for convergence function; currently only used for type="decay"} diff --git a/man/matchDim.Rd b/man/matchDim.Rd index dd0f77e0..eaa9e2d0 100644 --- a/man/matchDim.Rd +++ b/man/matchDim.Rd @@ -2,25 +2,30 @@ % Please edit documentation in R/matchDim.R \name{matchDim} \alias{matchDim} -\title{match object dimensions of a magclass object to the dimensions of a reference object} +\title{Match dimensions of a magpie object to those of a reference object} \usage{ -matchDim(x, ref, dim = NULL, fill = NA) +matchDim(x, ref, dim = 1:3, fill = NA) } \arguments{ -\item{x}{a magclass object to be modified} +\item{x}{A \code{magpie} object to be modified.} -\item{ref}{a magclass object used as a reference for the modification} +\item{ref}{A \code{magpie} object used as a reference for the modification. +Returns \code{x} if \code{ref} is \code{NULL}.} -\item{dim}{subset of dimensions for which the matching should be done. -Can be either a number between 1 and 3 or a vector of these. -Set to NULL (default) for matching all dimensions.} +\item{dim}{Subset of dimensions for which the matching should be done. Can +be either a number between 1 and 3 or a vector of these. Defaults to all +dimensions (i.e. \code{1:3}).} -\item{fill}{value to be set in new dimensions} +\item{fill}{Value to be set in new dimensions.} +} +\value{ +The modified \code{magpie} object. } \description{ -A helper that restricts and expands a magclass object x to the size of a magclass object ref. -Dimension names not present in x are added and set to the value provided by 'fill'. -Dimension names not present in ref are cropped. +A helper that restricts and expands a magpie object \code{x} to the size of a +magpie object \code{ref}. Dimension names not present in \code{x} are added and set to +the value provided by \code{fill}. Dimension names not present in \code{ref} are +cropped. } \author{ Falk Benke