diff --git a/.Rbuildignore b/.Rbuildignore index 4212858235c6fea27a834c5e1a0012856a4ec6c9..6008b579d5dd55cd0c61aa4e05404c8437d91f3f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,7 +10,7 @@ README\.md$ vignettes .gitlab-ci.yml # unit tests should be ignored when building the package for CRAN -#^tests$ +^tests$ # CDO is not in windbuilder, so we can test the unit tests by winbuilder # but test-CDORemap.R and test-Load.R needs to be hidden #tests/testthat/test-CDORemap.R diff --git a/DESCRIPTION b/DESCRIPTION index 3a79ba60fd249bcc9da43aa9aa078b9b3997566e..eee31d4a3926e55b73eb1110361e05df1979535c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: s2dv Title: A Set of Common Tools for Seasonal to Decadal Verification -Version: 1.3.0 +Version: 1.4.0 Authors@R: c( person("BSC-CNS", role = c("aut", "cph")), person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("aut", "cre")), @@ -44,7 +44,7 @@ Imports: easyVerification Suggests: testthat -License: Apache License 2.0 +License: GPL-3 URL: https://earth.bsc.es/gitlab/es/s2dv/ BugReports: https://earth.bsc.es/gitlab/es/s2dv/-/issues LazyData: true diff --git a/NEWS.md b/NEWS.md index c7daf9370c409791fe9679082ba30ce06f8cf347..4711c9c8d448156dca707c32b29e8fa94871b4b8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,26 @@ +# s2dv 1.4.0 (Release date: 2023-03-21) +**Bugfixes** +- AbsBiasSS() significance test bugfix +- RPSS() significance test bugfix +- Trend() output "p.val" bugfix when NAs exist +- RMS() bugfix when dat_dim is NULL and conf is FALSE +- NAO() parameter "ftime_avg" sanity check improvement +- CDORemap() recognizes the CDO version with non-numeric values +- CDORemap() reorders the unlimited dimension to the last position in order to save as netCDF correctly + +**Development** +- Make the argument default values consistent between functions +- Season() sanity check improvement +- RMSSS() new parameters: "ref", "memb_dim", "sig_method". RandomWalkTest() is one option for significance test. +- Corr() new output "sign" and change parameter "conf.lev" to "alpha" +- CRPSS() uses cross-validation when `ref` is NULL +- RPS() and RPSS(): New parameter "cross.val" to choose to use cross-validation or not +- New function: ROCSS() +- RandomWalkTest(): New parameters "alpha" and "test.type"; Test method options: 'two.sided.approx','two.sided','greater','less'; change from positively oriented to negatively oriented +- Reorder(): Reorder attribute "dimensions" along with the data reordering. The attribute exists in Load() objects. +- ProjectField() efficiency improvement +- NAO(): parameter "ftime_avg" can be NULL so no average is calculated + # s2dv 1.3.0 (Release date: 2022-10-17) - New functions: Bias, AbsBiasSS, CRPS, CRPSS - split RPSS parameter 'weights' into 'weights_exp' and 'weights_ref' diff --git a/R/Corr.R b/R/Corr.R index c95b103492a9ea67f302c83a9bbe9e8e0bdc61fc..3430647ad579137b0fef76f48c33c5f03a1c000a 100644 --- a/R/Corr.R +++ b/R/Corr.R @@ -46,7 +46,8 @@ #' significance of the test Ho: Corr = 0 based on 'alpha'. The default value is #' FALSE. #'@param alpha A numeric indicating the significance level for the statistical -#' significance test. The default value is 0.05. +#' significance test. The default value is 0.05. +#'@param conf.lev Deprecated. Use alpha now instead. alpha = 1 - conf.lev. #'@param ncores An integer indicating the number of cores to use for parallel #' computation. The default value is NULL. #' @@ -107,7 +108,7 @@ Corr <- function(exp, obs, time_dim = 'sdate', dat_dim = 'dataset', comp_dim = NULL, limits = NULL, method = 'pearson', memb_dim = NULL, memb = TRUE, pval = TRUE, conf = TRUE, sign = FALSE, - alpha = 0.05, ncores = NULL) { + alpha = 0.05, conf.lev = NULL, ncores = NULL) { # Check inputs ## exp and obs (1) @@ -195,6 +196,12 @@ Corr <- function(exp, obs, time_dim = 'sdate', dat_dim = 'dataset', if (!is.logical(sign) | length(sign) > 1) { stop("Parameter 'sign' must be one logical value.") } + ## conf.lev + ##NOTE: remove the parameter and the warning after v1.4.0 + if (!missing("conf.lev")) { + .warning(paste0("Argument 'conf.lev' is deprecated. Please use 'alpha' instead. ", + "'alpha' = ", 1 - conf.lev, " is used."), tag = '! Deprecation: ') + } ## alpha if (!is.numeric(alpha) | alpha < 0 | alpha > 1 | length(alpha) > 1) { stop("Parameter 'alpha' must be a numeric number between 0 and 1.") diff --git a/R/DiffCorr.R b/R/DiffCorr.R index 1e07458989db3f40db83aa954abfc8b2b8929738..93078248dcf442e6d5500977f875ca1b57db8886 100644 --- a/R/DiffCorr.R +++ b/R/DiffCorr.R @@ -155,8 +155,6 @@ DiffCorr <- function(exp, obs, ref, N.eff = NA, time_dim = 'sdate', if (!test.type %in% c('two-sided', 'one-sided')) { stop("Parameter 'test.type' must be 'two-sided' or 'one-sided'.") } - #NOTE: warning can be removed in the next release - .warning("The default significance test has changed after s2dv_1.2.0. The default method is 'two-sided'.") ## ncores if (!is.null(ncores)) { diff --git a/man/Corr.Rd b/man/Corr.Rd index 10bdf71981c103c140beffac76c8708849c49537..bbb1e34d9edfbc82790b675e94c52c4a763d9a46 100644 --- a/man/Corr.Rd +++ b/man/Corr.Rd @@ -18,6 +18,7 @@ Corr( conf = TRUE, sign = FALSE, alpha = 0.05, + conf.lev = NULL, ncores = NULL ) } @@ -66,6 +67,8 @@ FALSE.} \item{alpha}{A numeric indicating the significance level for the statistical significance test. The default value is 0.05.} +\item{conf.lev}{Deprecated. Use alpha now instead. alpha = 1 - conf.lev.} + \item{ncores}{An integer indicating the number of cores to use for parallel computation. The default value is NULL.} }