From 50fda07a15fb04f2ec8ea93995047514841a10c8 Mon Sep 17 00:00:00 2001 From: aho Date: Fri, 2 Sep 2022 15:43:19 +0200 Subject: [PATCH 01/10] Update reference --- DESCRIPTION | 3 ++- README.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 454397ae..718eac4c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Title: Assessing Skill of Climate Forecasts on Seasonal-to-Decadal Timescales Version: 4.0.1 Authors@R: c( - person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8568-3071")), + person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = "aut", comment = c(ORCID = "0000-0001-8568-3071")), person("Louis-Philippe", "Caron", , "louis-philippe.caron@bsc.es", role = "aut", comment = c(ORCID = "0000-0001-5221-0147")), person("Carmen", "Alvarez-Castro", , "carmen.alvarez-castro@cmcc.it", role = "aut", comment = c(ORCID = "0000-0002-9958-010X")), person("Lauriane", "Batte", , "lauriane.batte@meteo.fr", role = "aut"), @@ -16,6 +16,7 @@ Authors@R: c( person("Bert", "van Schaeybroeck", , "bertvs@meteo.be", role = "aut"), person("Veronica", "Torralba", , "veronica.torralba@bsc.es", role = "aut"), person("Deborah", "Verfaillie", , "deborah.verfaillie@bsc.es", role = "aut"), + person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("cre", "ctb")), person("Filippo", "Cali Quaglia", , "filippo.caliquaglia@gmail.com", role = "ctb"), person("Maria M.", "Chaves-Montero", , "mariadm.chaves@cmcc.it", role = "ctb"), person("Chihchung", "Chou", , "chihchung.chou@bsc.es", role = "ctb"), diff --git a/README.md b/README.md index 40bc01ba..bc54095e 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ The Climate Services Tools, CSTools, is an easy-to-use R package designed and bu This package was developed in the context of the ERA4CS project MEDSCOPE and the H2020 S2S4E project. This GitLab project allows you to monitor its progress and to interact with other developers via the Issues section. -A scientific publication including use cases is under-review in the Geoscientific Model Development Journal and it can be cited as follows: +A scientific publication including use cases was published in the Geoscientific Model Development Journal, and it can be cited as follows: +> Pérez-Zanón, N., Caron, L.-P., Terzago, S., Van Schaeybroeck, B., Lledó, L., Manubens, N., Roulin, E., Alvarez-Castro, M. C., Batté, L., Bretonnière, P.-A., Corti, S., Delgado-Torres, C., Domínguez, M., Fabiano, F., Giuntoli, I., von Hardenberg, J., Sánchez-García, E., Torralba, V., and Verfaillie, D.: Climate Services Toolbox (CSTools) v4.0: from climate forecasts to climate forecast information, Geosci. Model Dev., 15, 6115–6142, https://doi.org/10.5194/gmd-15-6115-2022, 2022. -> Pérez-Zanón, N., Caron, L.-P., Terzago, S., Van Schaeybroeck, B., Lledó, L., Manubens, N., Roulin, E., Alvarez-Castro, M. C., Batté, L., Delgado-Torres, C., Domínguez, M., von Hardenberg, J., Sánchez-García, E., Torralba, V., and Verfaillie, D.: The CSTools (v4.0) Toolbox: from Climate Forecasts to Climate Forecast Information, Geosci. Model Dev. Discuss. [preprint], https://doi.org/10.5194/gmd-2021-368, in review, 2021. On-line resources ----------------- -- GitLab From 54b0638d3b823c6f995c556edd0b21bd42aa68e5 Mon Sep 17 00:00:00 2001 From: aho Date: Fri, 2 Sep 2022 16:32:16 +0200 Subject: [PATCH 02/10] Add new reference paper --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 718eac4c..2443ab82 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -43,6 +43,7 @@ Description: Exploits dynamical seasonal forecasts in order to provide multivariate verification, as well as basic and advanced tools to obtain tailored products. This package was developed in the context of the ERA4CS project MEDSCOPE and the H2020 S2S4E project. + Pérez-Zanón et al. (2022) Doblas-Reyes et al. (2005) . Mishra et al. (2018) . Sanchez-Garcia et al. (2019) . -- GitLab From 19d6ff9d55083f4a1ec0ae973e3d03bd15e0870a Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 11 Oct 2022 15:00:18 +0200 Subject: [PATCH 03/10] Use utils::getFromNamespace to get the non-exported functions --- R/as.s2dv_cube.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/as.s2dv_cube.R b/R/as.s2dv_cube.R index 5c656a51..840c8084 100644 --- a/R/as.s2dv_cube.R +++ b/R/as.s2dv_cube.R @@ -123,7 +123,7 @@ as.s2dv_cube <- function(object) { dat_attr_names <- names(attributes(object)$Variables$dat1) common_attr_names <- names(attributes(object)$Variables$common) # $lon - known_lon_names <- s2dv:::.KnownLonNames() + known_lon_names <- utils::getFromNamespace(".KnownLonNames", "s2dv")() if (!is.null(dat_attr_names[which(dat_attr_names %in% known_lon_names)]) & !identical(dat_attr_names[which(dat_attr_names %in% known_lon_names)], character(0))) { result$lon <- attributes(object)$Variables$dat1[[dat_attr_names[which(dat_attr_names %in% known_lon_names)]]] @@ -135,7 +135,7 @@ as.s2dv_cube <- function(object) { result$lon <- NULL } # $lat - known_lat_names <- s2dv:::.KnownLatNames() + known_lat_names <- utils::getFromNamespace(".KnownLatNames", "s2dv")() if (!is.null(dat_attr_names[which(dat_attr_names %in% known_lat_names)]) & !identical(dat_attr_names[which(dat_attr_names %in% known_lat_names)], character(0))) { result$lat <- attributes(object)$Variables$dat1[[dat_attr_names[which(dat_attr_names %in% known_lat_names)]]] -- GitLab From 298b774b1aaa4100dfea45323fdb4d286559e248 Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 25 Oct 2022 11:05:56 +0200 Subject: [PATCH 04/10] Update version number and NEWS --- DESCRIPTION | 5 +++-- NEWS.md | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 20b81bff..cb6330d9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: CSTools Title: Assessing Skill of Climate Forecasts on Seasonal-to-Decadal Timescales -Version: 4.0.1 +Version: 4.1.0 Authors@R: c( person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = "aut", comment = c(ORCID = "0000-0001-8568-3071")), person("Louis-Philippe", "Caron", , "louis-philippe.caron@bsc.es", role = "aut", comment = c(ORCID = "0000-0001-5221-0147")), @@ -16,7 +16,7 @@ Authors@R: c( person("Bert", "van Schaeybroeck", , "bertvs@meteo.be", role = "aut"), person("Veronica", "Torralba", , "veronica.torralba@bsc.es", role = "aut"), person("Deborah", "Verfaillie", , "deborah.verfaillie@bsc.es", role = "aut"), - person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("cre", "ctb")), + person("Eva", "Rifà", , "eva.rifarovira@bsc.es", role = c("ctb")), person("Filippo", "Cali Quaglia", , "filippo.caliquaglia@gmail.com", role = "ctb"), person("Maria M.", "Chaves-Montero", , "mariadm.chaves@cmcc.it", role = "ctb"), person("Chihchung", "Chou", , "chihchung.chou@bsc.es", role = "ctb"), @@ -34,6 +34,7 @@ Authors@R: c( person("Francesc", "Roura-Adserias", , "francesc.roura@bsc.es", role = "ctb"), person("Silvia", "Terzago", , "s.terzago@isac.cnr.it", role = "ctb"), person("Danila", "Volpi", , "d.volpi@isac.cnr.it", role = "ctb"), + person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("cre", "ctb")), person("Victoria", "Agudetse", , "victoria.agudetse@bsc.es", role = "ctb"), person("BSC-CNS", role = c("cph"))) Description: Exploits dynamical seasonal forecasts in order to provide diff --git a/NEWS.md b/NEWS.md index 887db24e..b1403786 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,18 @@ -### CSTools X.X.X -**Submission date to CRAN: DD-MM-YYYY** - -- Enhancements:ç +### CSTools 4.1.0 +**Submission date to CRAN: 25-10-2022** +- New features: + + Dependency on package 's2dverification' is changed to 's2dv' + CST_BiasCorrection new parameters 'memb_dim', 'sdate_dim', 'ncores' + + CST_Calibration is able to calibrate forecast with new parameter 'exp_cor' + + CST_QuantileMapping uses cross-validation and provides option to remove NAs; new parameters 'memb_dim', 'sdate_dim', 'window_dim' and 'na.rm'; 'sample_dim' and 'sample_length' are removed + + s2dv_cube() new parameter 'time_dim' + +- Fixes: + + as.s2dv_cube() detects latitude and longitude structure in startR_array object + + Data correction: 'lonlat_data' is renamed to 'lonlat_temp'; 'lonlat_prec' is corrected by one-day shift + + Typo and parameter correction in vignette 'MostLikelyTercile_vignette' + + Figure and result correction in vignette 'RainFARM_vignette' + + PlotMostLikelyQuantileMap() works with s2dv::PlotLayout ### CSTools 4.0.1 **Submission date to CRAN: 05-10-2021** -- GitLab From fdca61b85ffa92e1baea0813da91a3bf5bbf956f Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 25 Oct 2022 13:18:26 +0200 Subject: [PATCH 05/10] Ignore the files for paper --- .Rbuildignore | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 587c9dc9..15222c0c 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,5 +5,10 @@ ./.nc$ .*^(?!data)\.RData$ .*\.gitlab-ci.yml$ -#^tests$ -^inst/doc/$ +^tests$ +#^inst/doc$ +^inst/doc/UseCase2_PrecipitationDownscaling_RainFARM_RF100\.R$ +^inst/doc/UseCase1_WindEvent_March2018\.R$ +^inst/doc/UseCase2_PrecipitationDownscaling_RainFARM_RF4\.R$ +^inst/doc/UseCase3_data_preparation_SCHEME_model\.R$ +^inst/doc/launch_UseCase2_PrecipitationDownscaling_RF4\.sh$ -- GitLab From 7c8df2f5622357b41f0ac2ac51b662393773f4b5 Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 25 Oct 2022 13:47:52 +0200 Subject: [PATCH 06/10] donttest time-consuming examples --- R/CST_EnsClustering.R | 12 ++++++------ R/CST_QuantileMapping.R | 30 +++++++++++++++++------------- man/CST_EnsClustering.Rd | 12 ++++++------ man/CST_QuantileMapping.Rd | 14 ++++++++------ man/PlotCombinedMap.Rd | 6 +++++- man/QuantileMapping.Rd | 16 +++++++++------- 6 files changed, 51 insertions(+), 39 deletions(-) diff --git a/R/CST_EnsClustering.R b/R/CST_EnsClustering.R index 6d5b4425..6b1f335e 100644 --- a/R/CST_EnsClustering.R +++ b/R/CST_EnsClustering.R @@ -73,32 +73,32 @@ #' \code{$lon} (selected longitudes of output fields), #' \code{$lat} (selected longitudes of output fields). #' @examples +#'\donttest{ #' exp <- lonlat_temp$exp #' # Example 1: Cluster on all start dates, members and models #' res <- CST_EnsClustering(exp, numclus = 3, #' cluster_dim = c("member", "dataset", "sdate")) -#' iclus = res$cluster[2, 1, 3] +#' iclus <- res$cluster[2, 1, 3] #' #' #print(paste("Cluster of 2. member, 1. dataset, 3. sdate:", iclus)) #' #print(paste("Frequency (numerosity) of cluster (", iclus, ") :", res$freq[iclus])) -#'\donttest{ #' s2dv::PlotEquiMap(res$repr_field[iclus, , ], exp$lon, exp$lat, #' filled.continents = FALSE, #' toptitle = paste("Representative field of cluster", iclus)) -#'} +#' #' # Example 2: Cluster on members retaining 4 EOFs during #' # preliminary dimensional reduction -#' #' res <- CST_EnsClustering(exp, numclus = 3, numpcs = 4, cluster_dim = "member") +#' #' # Example 3: Cluster on members, retain 80% of variance during #' # preliminary dimensional reduction -#' #' res <- CST_EnsClustering(exp, numclus = 3, variance_explained = 80, #' cluster_dim = "member") -#' # Example 4: Compute percentile in time #' +#' # Example 4: Compute percentile in time #' res <- CST_EnsClustering(exp, numclus = 3, time_percentile = 90, #' time_moment = "perc", cluster_dim = "member") +#'} #' #'@export CST_EnsClustering <- function(exp, time_moment = "mean", numclus = NULL, diff --git a/R/CST_QuantileMapping.R b/R/CST_QuantileMapping.R index a4e4a9d6..edb2fb89 100644 --- a/R/CST_QuantileMapping.R +++ b/R/CST_QuantileMapping.R @@ -36,17 +36,18 @@ #'@examples #'# Use synthetic data #'exp <- NULL -#'exp$data <- 1 : c(1 * 10 * 20 * 60 * 6 * 7) -#'dim(exp$data) <- c(dataset = 1, member = 10, sdate = 20, ftime = 60 , -#' lat = 6, lon = 7) +#'exp$data <- 1 : c(1 * 3 * 5 * 4 * 3 * 2) +#'dim(exp$data) <- c(dataset = 1, member = 3, sdate = 5, ftime = 4, +#' lat = 3, lon = 2) #'class(exp) <- 's2dv_cube' -#'obs$data <- 101 : c(100 + 1 * 1 * 20 * 60 * 6 * 7) -#'dim(obs$data) <- c(dataset = 1, member = 1, sdate = 20, ftime = 60 , -#' lat = 6, lon = 7) +#'obs$data <- 101 : c(100 + 1 * 1 * 5 * 4 * 3 * 2) +#'dim(obs$data) <- c(dataset = 1, member = 1, sdate = 5, ftime = 4, +#' lat = 3, lon = 2) #'class(obs) <- 's2dv_cube' #'res <- CST_QuantileMapping(exp, obs) #' #'# Use data in package +#'\donttest{ #'exp <- lonlat_temp$exp #'exp$data <- exp$data[, , 1:4, , 1:2, 1:3] #'dim(exp$data) <- c(dataset = 1, member = 15, sdate = 4, ftime = 3, @@ -60,6 +61,7 @@ #'dim(exp_cor$data) <- c(dataset = 1, member = 1, sdate = 2, ftime = 3, #' lat = 2, lon = 3) #'res <- CST_QuantileMapping(exp, obs, exp_cor, window_dim = 'ftime') +#'} #' #'@import qmap #'@import multiApply @@ -141,15 +143,16 @@ CST_QuantileMapping <- function(exp, obs, exp_cor = NULL, sdate_dim = 'sdate', #'@seealso \code{\link[qmap]{fitQmap}} and \code{\link[qmap]{doQmap}} #'@examples #'# Use synthetic data -#'exp <- 1 : c(1 * 10 * 20 * 60 * 6 * 7) -#'dim(exp) <- c(dataset = 1, member = 10, sdate = 20, ftime = 60 , -#' lat = 6, lon = 7) -#'class(exp) <- 's2dv_cube' -#'obs <- 101 : c(100 + 1 * 1 * 20 * 60 * 6 * 7) -#'dim(obs) <- c(dataset = 1, member = 1, sdate = 20, ftime = 60 , -#' lat = 6, lon = 7) +#'exp <- 1 : c(1 * 3 * 5 * 4 * 3 * 2) +#'dim(exp) <- c(dataset = 1, member = 3, sdate = 5, ftime = 4, +#' lat = 3, lon = 2) +#'obs <- 101 : c(100 + 1 * 1 * 5 * 4 * 3 * 2) +#'dim(obs) <- c(dataset = 1, member = 1, sdate = 5, ftime = 4, +#' lat = 3, lon = 2) #'res <- QuantileMapping(exp, obs) +#' #'# Use data in package +#'\donttest{ #'exp <- lonlat_temp$exp$data[, , 1:4, , 1:2, 1:3] #'dim(exp) <- c(dataset = 1, member = 15, sdate = 4, ftime = 3, #' lat = 2, lon = 3) @@ -160,6 +163,7 @@ CST_QuantileMapping <- function(exp, obs, exp_cor = NULL, sdate_dim = 'sdate', #'dim(exp_cor) <- c(dataset = 1, member = 1, sdate = 2, ftime = 3, #' lat = 2, lon = 3) #'res <- QuantileMapping(exp, obs, exp_cor, window_dim = 'ftime') +#'} #' #'@import qmap #'@import multiApply diff --git a/man/CST_EnsClustering.Rd b/man/CST_EnsClustering.Rd index 7ff82080..83f5e7a1 100644 --- a/man/CST_EnsClustering.Rd +++ b/man/CST_EnsClustering.Rd @@ -99,32 +99,32 @@ the maximum distance between a member in a cluster and the cluster centroid deviation for each cluster (i.e. how much the cluster is compact). } \examples{ +\donttest{ exp <- lonlat_temp$exp # Example 1: Cluster on all start dates, members and models res <- CST_EnsClustering(exp, numclus = 3, cluster_dim = c("member", "dataset", "sdate")) -iclus = res$cluster[2, 1, 3] +iclus <- res$cluster[2, 1, 3] #print(paste("Cluster of 2. member, 1. dataset, 3. sdate:", iclus)) #print(paste("Frequency (numerosity) of cluster (", iclus, ") :", res$freq[iclus])) -\donttest{ s2dv::PlotEquiMap(res$repr_field[iclus, , ], exp$lon, exp$lat, filled.continents = FALSE, toptitle = paste("Representative field of cluster", iclus)) -} + # Example 2: Cluster on members retaining 4 EOFs during # preliminary dimensional reduction - res <- CST_EnsClustering(exp, numclus = 3, numpcs = 4, cluster_dim = "member") + # Example 3: Cluster on members, retain 80\% of variance during # preliminary dimensional reduction - res <- CST_EnsClustering(exp, numclus = 3, variance_explained = 80, cluster_dim = "member") -# Example 4: Compute percentile in time +# Example 4: Compute percentile in time res <- CST_EnsClustering(exp, numclus = 3, time_percentile = 90, time_moment = "perc", cluster_dim = "member") +} } \author{ diff --git a/man/CST_QuantileMapping.Rd b/man/CST_QuantileMapping.Rd index af4f68cc..71b32da9 100644 --- a/man/CST_QuantileMapping.Rd +++ b/man/CST_QuantileMapping.Rd @@ -63,17 +63,18 @@ applied to the experiment itself or to a provided forecast. \examples{ # Use synthetic data exp <- NULL -exp$data <- 1 : c(1 * 10 * 20 * 60 * 6 * 7) -dim(exp$data) <- c(dataset = 1, member = 10, sdate = 20, ftime = 60 , - lat = 6, lon = 7) +exp$data <- 1 : c(1 * 3 * 5 * 4 * 3 * 2) +dim(exp$data) <- c(dataset = 1, member = 3, sdate = 5, ftime = 4, + lat = 3, lon = 2) class(exp) <- 's2dv_cube' -obs$data <- 101 : c(100 + 1 * 1 * 20 * 60 * 6 * 7) -dim(obs$data) <- c(dataset = 1, member = 1, sdate = 20, ftime = 60 , - lat = 6, lon = 7) +obs$data <- 101 : c(100 + 1 * 1 * 5 * 4 * 3 * 2) +dim(obs$data) <- c(dataset = 1, member = 1, sdate = 5, ftime = 4, + lat = 3, lon = 2) class(obs) <- 's2dv_cube' res <- CST_QuantileMapping(exp, obs) # Use data in package +\donttest{ exp <- lonlat_temp$exp exp$data <- exp$data[, , 1:4, , 1:2, 1:3] dim(exp$data) <- c(dataset = 1, member = 15, sdate = 4, ftime = 3, @@ -87,6 +88,7 @@ exp_cor$data <- exp_cor$data[, 1, 5:6, , 1:2, 1:3] dim(exp_cor$data) <- c(dataset = 1, member = 1, sdate = 2, ftime = 3, lat = 2, lon = 3) res <- CST_QuantileMapping(exp, obs, exp_cor, window_dim = 'ftime') +} } \seealso{ diff --git a/man/PlotCombinedMap.Rd b/man/PlotCombinedMap.Rd index bbd2787a..cf08c8f6 100644 --- a/man/PlotCombinedMap.Rd +++ b/man/PlotCombinedMap.Rd @@ -21,7 +21,6 @@ PlotCombinedMap( legend_scale = 1, cex_bar_titles = 1.5, plot_margin = NULL, - bar_margin = rep(0, 4), fileout = NULL, width = 8, height = 5, @@ -67,6 +66,11 @@ layers via the parameter 'dot_symbol'.} \item{cex_bar_titles}{Scale factor for the sizes of the bar titles. Takes 1.5 by default.} +\item{plot_margin}{Numeric vector of length 4 for the margin sizes in the +following order: bottom, left, top, and right. If not specified, use the +default of par("mar"), c(5.1, 4.1, 4.1, 2.1). Used as 'margin_scale' in +s2dv::PlotEquiMap.} + \item{fileout}{File where to save the plot. If not specified (default) a graphics device will pop up. Extensions allowed: eps/ps, jpeg, png, pdf, bmp and tiff} \item{width}{File width, in the units specified in the parameter size_units (inches by default). Takes 8 by default.} diff --git a/man/QuantileMapping.Rd b/man/QuantileMapping.Rd index c2db3327..c251f33b 100644 --- a/man/QuantileMapping.Rd +++ b/man/QuantileMapping.Rd @@ -65,15 +65,16 @@ applied to the experiment itself or to a provided forecast. } \examples{ # Use synthetic data -exp <- 1 : c(1 * 10 * 20 * 60 * 6 * 7) -dim(exp) <- c(dataset = 1, member = 10, sdate = 20, ftime = 60 , - lat = 6, lon = 7) -class(exp) <- 's2dv_cube' -obs <- 101 : c(100 + 1 * 1 * 20 * 60 * 6 * 7) -dim(obs) <- c(dataset = 1, member = 1, sdate = 20, ftime = 60 , - lat = 6, lon = 7) +exp <- 1 : c(1 * 3 * 5 * 4 * 3 * 2) +dim(exp) <- c(dataset = 1, member = 3, sdate = 5, ftime = 4, + lat = 3, lon = 2) +obs <- 101 : c(100 + 1 * 1 * 5 * 4 * 3 * 2) +dim(obs) <- c(dataset = 1, member = 1, sdate = 5, ftime = 4, + lat = 3, lon = 2) res <- QuantileMapping(exp, obs) + # Use data in package +\donttest{ exp <- lonlat_temp$exp$data[, , 1:4, , 1:2, 1:3] dim(exp) <- c(dataset = 1, member = 15, sdate = 4, ftime = 3, lat = 2, lon = 3) @@ -84,6 +85,7 @@ exp_cor <- lonlat_temp$exp$data[, 1, 5:6, , 1:2, 1:3] dim(exp_cor) <- c(dataset = 1, member = 1, sdate = 2, ftime = 3, lat = 2, lon = 3) res <- QuantileMapping(exp, obs, exp_cor, window_dim = 'ftime') +} } \seealso{ -- GitLab From b895a9bf3856d602112560e57878ebb9fe07d9ac Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 25 Oct 2022 13:48:17 +0200 Subject: [PATCH 07/10] avoid partial matching or 'mar' in PlotEquiMap --- R/PlotCombinedMap.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/PlotCombinedMap.R b/R/PlotCombinedMap.R index 6379179b..b6a52cb3 100644 --- a/R/PlotCombinedMap.R +++ b/R/PlotCombinedMap.R @@ -23,6 +23,10 @@ #'@param bar_titles Optional vector of character strings providing the titles to be shown on top of each of the colour bars. #'@param legend_scale Scale factor for the size of the colour bar labels. Takes 1 by default. #'@param cex_bar_titles Scale factor for the sizes of the bar titles. Takes 1.5 by default. +#'@param plot_margin Numeric vector of length 4 for the margin sizes in the +#' following order: bottom, left, top, and right. If not specified, use the +#' default of par("mar"), c(5.1, 4.1, 4.1, 2.1). Used as 'margin_scale' in +#' s2dv::PlotEquiMap. #'@param fileout File where to save the plot. If not specified (default) a graphics device will pop up. Extensions allowed: eps/ps, jpeg, png, pdf, bmp and tiff #'@param width File width, in the units specified in the parameter size_units (inches by default). Takes 8 by default. #'@param height File height, in the units specified in the parameter size_units (inches by default). Takes 5 by default. @@ -81,7 +85,7 @@ PlotCombinedMap <- function(maps, lon, lat, dots = NULL, bar_titles = NULL, legend_scale = 1, cex_bar_titles = 1.5, - plot_margin = NULL, bar_margin = rep(0, 4), + plot_margin = NULL, fileout = NULL, width = 8, height = 5, size_units = 'in', res = 100, drawleg = T, ...) { @@ -340,7 +344,7 @@ PlotCombinedMap <- function(maps, lon, lat, PlotEquiMap(var = ml_map, lon = lon, lat = lat, brks = tbrks, cols = tcols, drawleg = FALSE, - filled.continents = FALSE, dots = dots, mar = plot_margin, ...) + filled.continents = FALSE, dots = dots, margin_scale = plot_margin, ...) #---------------------- # Add overplot on top -- GitLab From 928d3513262fecdbe4d8d659d170203070bd50c3 Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 25 Oct 2022 13:49:30 +0200 Subject: [PATCH 08/10] use inherits() instead of if(class( --- R/as.s2dv_cube.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/as.s2dv_cube.R b/R/as.s2dv_cube.R index 0463e591..5f31ad31 100644 --- a/R/as.s2dv_cube.R +++ b/R/as.s2dv_cube.R @@ -115,7 +115,7 @@ as.s2dv_cube <- function(object) { } } - } else if (class(object) == 'startR_array') { + } else if (inherits(object, 'startR_array')) { result <- list() result$data <- as.vector(object) dim(result$data) <- dim(object) -- GitLab From 4f53d81234d582303b2b078a8cf793dd5ce13cc3 Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 25 Oct 2022 14:11:18 +0200 Subject: [PATCH 09/10] Change maintainer --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cb6330d9..78774234 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ Authors@R: c( person("Bert", "van Schaeybroeck", , "bertvs@meteo.be", role = "aut"), person("Veronica", "Torralba", , "veronica.torralba@bsc.es", role = "aut"), person("Deborah", "Verfaillie", , "deborah.verfaillie@bsc.es", role = "aut"), - person("Eva", "Rifà", , "eva.rifarovira@bsc.es", role = c("ctb")), + person("Eva", "Rifà", , "eva.rifarovira@bsc.es", role = c("cre", "ctb")), person("Filippo", "Cali Quaglia", , "filippo.caliquaglia@gmail.com", role = "ctb"), person("Maria M.", "Chaves-Montero", , "mariadm.chaves@cmcc.it", role = "ctb"), person("Chihchung", "Chou", , "chihchung.chou@bsc.es", role = "ctb"), @@ -34,7 +34,7 @@ Authors@R: c( person("Francesc", "Roura-Adserias", , "francesc.roura@bsc.es", role = "ctb"), person("Silvia", "Terzago", , "s.terzago@isac.cnr.it", role = "ctb"), person("Danila", "Volpi", , "d.volpi@isac.cnr.it", role = "ctb"), - person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("cre", "ctb")), + person("An-Chi", "Ho", , "an.ho@bsc.es", role = "ctb"), person("Victoria", "Agudetse", , "victoria.agudetse@bsc.es", role = "ctb"), person("BSC-CNS", role = c("cph"))) Description: Exploits dynamical seasonal forecasts in order to provide -- GitLab From 8c04b89c078c5eb1130933e79bc3d3d64c79e94e Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Wed, 26 Oct 2022 09:34:59 +0200 Subject: [PATCH 10/10] Correct invalid URLs --- DESCRIPTION | 2 +- R/CST_MultiMetric.R | 4 ++-- man/CST_MultiMetric.Rd | 2 +- man/MultiMetric.Rd | 2 +- vignettes/MultiModelSkill_vignette.Rmd | 2 +- vignettes/WeatherRegimes_vignette.Rmd | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 78774234..2cb6f17e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -44,7 +44,7 @@ Description: Exploits dynamical seasonal forecasts in order to provide multivariate verification, as well as basic and advanced tools to obtain tailored products. This package was developed in the context of the ERA4CS project MEDSCOPE and the H2020 S2S4E project. - Pérez-Zanón et al. (2022) + Pérez-Zanón et al. (2022) . Doblas-Reyes et al. (2005) . Mishra et al. (2018) . Sanchez-Garcia et al. (2019) . diff --git a/R/CST_MultiMetric.R b/R/CST_MultiMetric.R index aa4ff344..93b7392d 100644 --- a/R/CST_MultiMetric.R +++ b/R/CST_MultiMetric.R @@ -15,7 +15,7 @@ #'@return an object of class \code{s2dv_cube} containing the statistics of the selected metric in the element \code{$data} which is a list of arrays: for the metric requested and others for statistics about its signeificance. The arrays have two dataset dimensions equal to the 'dataset' dimension in the \code{exp$data} and \code{obs$data} inputs. If \code{multimodel} is TRUE, the first position in the first 'nexp' dimension correspons to the Multi-Model Mean. #'@seealso \code{\link[s2dv]{Corr}}, \code{\link[s2dv]{RMS}}, \code{\link[s2dv]{RMSSS}} and \code{\link{CST_Load}} #'@references -#'Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/10.1007/s00382-018-4404-z} +#'Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/article/10.1007/s00382-018-4404-z} #' #'@importFrom s2dv MeanDims Reorder Corr RMS RMSSS InsertDim #'@import abind @@ -75,7 +75,7 @@ CST_MultiMetric <- function(exp, obs, metric = "correlation", multimodel = TRUE, #'@return a list of arrays containing the statistics of the selected metric in the element \code{$data} which is a list of arrays: for the metric requested and others for statistics about its signeificance. The arrays have two dataset dimensions equal to the 'dataset' dimension in the \code{exp$data} and \code{obs$data} inputs. If \code{multimodel} is TRUE, the greatest position in the first dimension correspons to the Multi-Model Mean. #'@seealso \code{\link[s2dv]{Corr}}, \code{\link[s2dv]{RMS}}, \code{\link[s2dv]{RMSSS}} and \code{\link{CST_Load}} #'@references -#'Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/10.1007/s00382-018-4404-z} +#'Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/article/10.1007/s00382-018-4404-z} #' #'@importFrom s2dv MeanDims Reorder Corr RMS RMSSS InsertDim #'@import abind diff --git a/man/CST_MultiMetric.Rd b/man/CST_MultiMetric.Rd index c748b4f0..5590ab89 100644 --- a/man/CST_MultiMetric.Rd +++ b/man/CST_MultiMetric.Rd @@ -60,7 +60,7 @@ a <- CST_MultiMetric(exp, obs, metric = 'rmsss') } } \references{ -Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/10.1007/s00382-018-4404-z} +Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/article/10.1007/s00382-018-4404-z} } \seealso{ \code{\link[s2dv]{Corr}}, \code{\link[s2dv]{RMS}}, \code{\link[s2dv]{RMSSS}} and \code{\link{CST_Load}} diff --git a/man/MultiMetric.Rd b/man/MultiMetric.Rd index 8a05677a..252f735c 100644 --- a/man/MultiMetric.Rd +++ b/man/MultiMetric.Rd @@ -39,7 +39,7 @@ This function calculates correlation (Anomaly Correlation Coefficient; ACC), roo res <- MultiMetric(lonlat_temp$exp$data, lonlat_temp$obs$data) } \references{ -Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/10.1007/s00382-018-4404-z} +Mishra, N., Prodhomme, C., & Guemas, V. (n.d.). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31.\url{https://link.springer.com/article/10.1007/s00382-018-4404-z} } \seealso{ \code{\link[s2dv]{Corr}}, \code{\link[s2dv]{RMS}}, \code{\link[s2dv]{RMSSS}} and \code{\link{CST_Load}} diff --git a/vignettes/MultiModelSkill_vignette.Rmd b/vignettes/MultiModelSkill_vignette.Rmd index 79d65856..fb66f94f 100644 --- a/vignettes/MultiModelSkill_vignette.Rmd +++ b/vignettes/MultiModelSkill_vignette.Rmd @@ -11,7 +11,7 @@ vignette: > Multi-model Skill Assessment ----------------------------------------- -**reference**: Mishra, N., Prodhomme, C., & Guemas, V. (2018). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31. +**reference**: Mishra, N., Prodhomme, C., & Guemas, V. (2018). Multi-Model Skill Assessment of Seasonal Temperature and Precipitation Forecasts over Europe, 29-31. The R package s2dv should be loaded by running: diff --git a/vignettes/WeatherRegimes_vignette.Rmd b/vignettes/WeatherRegimes_vignette.Rmd index e9bd8a79..47d095ce 100644 --- a/vignettes/WeatherRegimes_vignette.Rmd +++ b/vignettes/WeatherRegimes_vignette.Rmd @@ -75,7 +75,7 @@ The LOESS filter has been applied to the climatology to remove the short-term va ### 4- Weather regimes in observations -`CST_WeatherRegimes()` function is used to define the clusters based on the sea level pressure anomalies from ERA-Interim. This function is based on the [*kmeans function*] (http://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html) +`CST_WeatherRegimes()` function is used to define the clusters based on the sea level pressure anomalies from ERA-Interim. This function is based on the [*kmeans function*] (https://stat.ethz.ch/R-manual/R-devel/library/stats/html/kmeans.html) from the stats R package. In this example we have made different assumptions: four clusters (`ncenters=4`) will be produced and the Empirical orthogonal functions are not used to filter the data (`EOFS=FALSE`) just to take into account the extreme values. More details about the methodology can be found in Cortesi et al. 2018 (submitted). -- GitLab