From f57fd02b68e50225dfd7824971eebf2fd6eda3d6 Mon Sep 17 00:00:00 2001 From: aho Date: Wed, 2 Nov 2022 17:25:13 +0100 Subject: [PATCH 1/3] Version bump to 0.2.0 --- .Rbuildignore | 2 +- DESCRIPTION | 9 +++++---- NEWS.md | 8 ++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 NEWS.md diff --git a/.Rbuildignore b/.Rbuildignore index 0c51051..dde50c4 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,5 +5,5 @@ ./.nc$ .*\.gitlab-ci.yml$ # Ignore tests when submitting to CRAN -#^tests$ +^tests$ diff --git a/DESCRIPTION b/DESCRIPTION index bd980e3..a75e2d8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,13 +1,14 @@ Package: ClimProjDiags Title: Set of Tools to Compute Various Climate Indices -Version: 0.1.3 +Version: 0.2.0 Authors@R: c( person("BSC-CNS", role = c("aut", "cph")), - person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8568-3071")), - person("An-Chi", "Ho", , "an.ho@bsc.es", role = "ctb"), + person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut"), comment = c(ORCID = "0000-0001-8568-3071")), + person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("cre", "ctb")), person("Nicolau", "Manubens", , "nicolau.manubens@bsc.es", role = "ctb"), person("Alasdair", "Hunter", , "alasdair.hunter@bsc.es", role = "aut"), - person("Louis-Philippe", "Caron", , "louis-philippe.caron@bsc.es", role = "ctb")) + person("Louis-Philippe", "Caron", , "louis-philippe.caron@bsc.es", role = "ctb"), + person("Eva", "RifĂ ", , "eva.rifarovira@bsc.es", role = "ctb")) Description: Set of tools to compute metrics and indices for climate analysis. The package provides functions to compute extreme indices, evaluate the agreement between models and combine theses models into an ensemble. Multi-model diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..461ff84 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,8 @@ +# 0.2.0 (Release date: 2022-11-04) +- New functions: ShiftLon, WeightedCells +- Bugfix of Subset() when only one dimension left after subsetting and when +parameter "indices" is not a list. +- Bugfix of WeightedMean() at the grid points that are across positive and +negative longitudes. + + -- GitLab From dd3754afdb7c9ca5e0bff64258b44dadccfd4608 Mon Sep 17 00:00:00 2001 From: aho Date: Thu, 3 Nov 2022 14:55:23 +0100 Subject: [PATCH 2/3] Sanity check for along = integer(0) --- R/Subset.R | 3 ++- tests/testthat/test-Subset.R | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/R/Subset.R b/R/Subset.R index c077c2a..6c23215 100644 --- a/R/Subset.R +++ b/R/Subset.R @@ -62,7 +62,8 @@ Subset <- function(x, along, indices, drop = FALSE) { } # Check along - if (any(sapply(along, function(x) !is.numeric(x) && !is.character(x)))) { + if (any(sapply(along, function(x) !is.numeric(x) && !is.character(x))) | + length(along) == 0) { stop("All provided dimension indices in 'along' must be integers or character strings.") } if (any(sapply(along, is.character))) { diff --git a/tests/testthat/test-Subset.R b/tests/testthat/test-Subset.R index 42f609a..e769453 100644 --- a/tests/testthat/test-Subset.R +++ b/tests/testthat/test-Subset.R @@ -28,6 +28,10 @@ Subset(x = dat1, along = T), "All provided dimension indices in 'along' must be integers or character strings." ) expect_error( +Subset(x = dat1, along = integer(0)), +"All provided dimension indices in 'along' must be integers or character strings." +) +expect_error( Subset(x = dat1, along = c('dat', 'dat')), "The parameter 'along' must not contain repeated dimension names." ) -- GitLab From 671f975afd377959fd8fdf2a7e26ab58eddfd732 Mon Sep 17 00:00:00 2001 From: aho Date: Mon, 7 Nov 2022 12:50:23 +0100 Subject: [PATCH 3/3] Move Suggests above --- DESCRIPTION | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a75e2d8..26f5f0e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,14 +24,14 @@ Imports: plyr, climdex.pcic, stats -License: Apache License 2.0 -URL: https://earth.bsc.es/gitlab/es/ClimProjDiags -BugReports: https://earth.bsc.es/gitlab/es/ClimProjDiags/-/issues -Encoding: UTF-8 -RoxygenNote: 7.2.0 Suggests: knitr, testthat, markdown, rmarkdown +License: Apache License 2.0 +URL: https://earth.bsc.es/gitlab/es/ClimProjDiags +BugReports: https://earth.bsc.es/gitlab/es/ClimProjDiags/-/issues +Encoding: UTF-8 +RoxygenNote: 7.2.0 VignetteBuilder: knitr -- GitLab