From 0758c034c7f657d97c2a6976553fbf99512f2313 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Thu, 20 Oct 2022 14:33:34 +0200 Subject: [PATCH 1/4] Updated NEWS, README documentation, DESCRIPTION added authors and .Rbuildignore --- .Rbuildignore | 2 +- DESCRIPTION | 19 ++++++++++++++++--- NEWS.md | 10 ++++------ README.md | 19 ++++++++++++++----- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index e8159e2..ba637f5 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,7 +5,7 @@ ./.nc$ .*^(?!data)\.RData$ .*\.gitlab-ci.yml$ -#^tests$ +^tests$ ./.nfs* ^cran-comments\.md$ ./vignettes/*.md diff --git a/DESCRIPTION b/DESCRIPTION index 6dae74d..d855559 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,15 +1,28 @@ Package: CSIndicators Title: Climate Services' Indicators Based on Sub-Seasonal to Decadal Predictions -Version: 0.0.1 +Version: 0.0.2 Authors@R: c( - person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8568-3071")), + person("Eva", "Rifà", , "eva.rifarovira@bsc.es", role = c("cre")), + person("Nuria", "Perez-Zanon", , "nuria.perez@bsc.es", role = c("aut"), comment = c(ORCID = "0000-0001-8568-3071")), person("Chou", "Chihchung", ,"chihchung.chou@bsc.es", role = "aut"), person("Llorenç", "Lledó", , "llorenc.lledo@bsc.es", role = "aut"), person("González-Reviriego", "Nube", , "nube.gonzalez@bsc.es", role = "ctb"), person("Marcos", "Raül", , "raul.marcos@bsc.es", role = "ctb"), person("Palma", "Lluis", , "lluis.palma@bsc.es", role = "ctb"), + person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("ctb")), person("BSC-CNS", role = "cph")) -Description: Set of generalised tools for the flexible computation of climate related indicators defined by the user. Each method represents a specific mathematical approach which is combined with the possibility to select an arbitrary time period to define the indicator. This enables a wide range of possibilities to tailor the most suitable indicator for each particular climate service application (agriculture, food security, energy, water management…). This package is intended for sub-seasonal, seasonal and decadal climate predictions, but its methods are also applicable to other time-scales, provided the dimensional structure of the input is maintained. Additionally, the outputs of the functions in this package are compatible with 'CSTools'. This package was developed in the context of H2020 MED-GOLD (776467) and S2S4E (776787) projects. Lledó et al. (2019) . +Description: Set of generalised tools for the flexible computation of climate + related indicators defined by the user. Each method represents a specific + mathematical approach which is combined with the possibility to select an + arbitrary time period to define the indicator. This enables a wide range of + possibilities to tailor the most suitable indicator for each particular climate + service application (agriculture, food security, energy, water management…). + This package is intended for sub-seasonal, seasonal and decadal climate + predictions, but its methods are also applicable to other time-scales, + provided the dimensional structure of the input is maintained. Additionally, + the outputs of the functions in this package are compatible with 'CSTools'. + This package was developed in the context of H2020 MED-GOLD (776467) and + S2S4E (776787) projects. Lledó et al. (2019) . Depends: R (>= 3.6.0) Imports: diff --git a/NEWS.md b/NEWS.md index 7aefb00..b9b4521 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,4 @@ -### CSIndicators 0.0.2 -**Submission date to CRAN: XX-YY-2021** - -- New features: -- Fixes: - + Vignettes figures +### CSIndicators 0.0.2 (Release date: 2022-06-20) +- Correct figures of EnergyIndicators vignette. +- Sanity check correction in functions CST_PeriodAccumulation(), CST_AbsToProbs(), CST_AccumulationExceedingThreshold(), CST_MergeRefToExp(), CST_PeriodMean(), CST_QThreshold(), CST_SelectPeriodOnData(), CST_Threshold(), TotalSpellTimeExceedingThreshold(), CST_TotalTimeExceedingThreshold(), CST_WindCapacityFactor() and CST_WindPowerDensity(). +- Revise examples using s2dv::InsertDim in MergeRefToExp(). diff --git a/README.md b/README.md index 24069b7..2ed5fde 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,19 @@ CSIndicators ------ +=============== #### Sectoral Indicators for Climate Services Based on Sub-Seasonal to Decadal Climate Predictions ## Description - -Set of generalised tools for the flexible computation of climate related indicators defined by the user. Each method represents a specific mathematical approach which is combined with the possibility to select an arbitrary time period to define the indicator. This enables a wide range of possibilities to tailor the most suitable indicator for each particular climate service application (agriculture, food security, energy, water management…). This package is intended for sub-seasonal, seasonal and decadal climate predictions, but its methods are also applicable to other time-scales, provided the dimensional structure of the input is maintained. Additionally, the outputs of the functions in this package are compatible with CSTools. +Set of generalised tools for the flexible computation of climate related +indicators defined by the user. Each method represents a specific mathematical +approach which is combined with the possibility to select an arbitrary time +period to define the indicator. This enables a wide range of possibilities to +tailor the most suitable indicator for each particular climate service +application (agriculture, food security, energy, water management…). This package +is intended for sub-seasonal, seasonal and decadal climate predictions, but its +methods are also applicable to other time-scales, provided the dimensional +structure of the input is maintained. Additionally, the outputs of the functions +in this package are compatible with CSTools. ## Functions and documentation @@ -36,16 +44,17 @@ Functions documentation can be found [here](https://CRAN.R-project.org/package=C |SelectPeriodOnData |CST_SelectPeriodOnData| |SelectPeriodOnDates| | +Find the current status of each function in this link: https://docs.google.com/spreadsheets/d/1arqgw-etNPs-XRyMTJ4ekF5YjQxAZBzssxxr2GMXp3c/edit#gid=0. *Note: the CST version uses 's2dv_cube' objects as inputs and outputs while the former version uses multidimensional arrays with named dimensions as inputs and outputs* -*Note: All functions computing indicators allows to subset a time period if required, although this temporal subsetting can also be done with funcitons `SelectPeriodOnData` in a separated step.* +*Note: All functions computing indicators allows to subset a time period if required, although this temporal subsetting can also be done with functions `SelectPeriodOnData` in a separated step.* ### How to contribute 1. Open an issue to ask for help or describe a function to be integrated -2. Agree with maintainers (@ngonzal2, @rmarcos and @nperez) on the requirements +2. Agree with maintainers (@ngonzal2, @rmarcos, @nperez and @erifarov) on the requirements 3. Create a new branch from master with a meaningful name 4. Once the development is finished, open a merge request to merge the branch on master -- GitLab From 327dc10662a9faf1c448e61000d6485195c8db48 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Fri, 21 Oct 2022 11:40:07 +0200 Subject: [PATCH 2/4] Add old release to NEWS --- NEWS.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index b9b4521..fa2bb87 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,7 @@ -### CSIndicators 0.0.2 (Release date: 2022-06-20) +# CSIndicators 0.0.2 (Release date: 2022-10-21) - Correct figures of EnergyIndicators vignette. -- Sanity check correction in functions CST_PeriodAccumulation(), CST_AbsToProbs(), CST_AccumulationExceedingThreshold(), CST_MergeRefToExp(), CST_PeriodMean(), CST_QThreshold(), CST_SelectPeriodOnData(), CST_Threshold(), TotalSpellTimeExceedingThreshold(), CST_TotalTimeExceedingThreshold(), CST_WindCapacityFactor() and CST_WindPowerDensity(). +- Sanity check correction in functions CST_PeriodAccumulation, CST_AbsToProbs, CST_AccumulationExceedingThreshold, CST_MergeRefToExp, CST_PeriodMean, CST_QThreshold, CST_SelectPeriodOnData, CST_Threshold, TotalSpellTimeExceedingThreshold, CST_TotalTimeExceedingThreshold, CST_WindCapacityFactor and CST_WindPowerDensity. - Revise examples using s2dv::InsertDim in MergeRefToExp(). + +# CSIndicators 0.0.1 (Release date: 2021-05-07) +- This package is intended for sub-seasonal, seasonal and decadal climate predictions, but its methods are also applicable to other time-scales. Additionally, the outputs of the functions in this package are compatible with 'CSTools'. This package was developed in the context of H2020 MED-GOLD (776467) and S2S4E (776787) projects. Lledó et al. (2019) . \ No newline at end of file -- GitLab From 435ce7129996ef0e03d1796b5c07c5afa63e8e0c Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Fri, 21 Oct 2022 14:45:29 +0200 Subject: [PATCH 3/4] change if (class == 'Dates') to inherits --- R/MergeRefToExp.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/MergeRefToExp.R b/R/MergeRefToExp.R index 068acfe..311053d 100644 --- a/R/MergeRefToExp.R +++ b/R/MergeRefToExp.R @@ -111,7 +111,7 @@ CST_MergeRefToExp <- function(data1, data2, start1, end1, start2, end2, # TO DO CONCATENATE DATES res <- Apply(list(dates1, dates2), target_dims = time_dim, c, output_dims = time_dim, ncores = ncores)$output1 - if (class(data1$Dates[[1]]) == 'Date') { + if (inherits(data1$Dates[[1]], 'Date')) { data1$Dates <- as.Date(res, origin = '1970-01-01') } else { data1$Dates <- as.POSIXct(res*3600*24, origin = '1970-01-01', tz = 'UTC') -- GitLab From 4be99a01c72cf49ba2fbdfec1a3257a61c8d58e8 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Fri, 21 Oct 2022 17:41:41 +0200 Subject: [PATCH 4/4] Correct line breaks in examples --- R/AbsToProbs.R | 3 ++- R/AccumulationExceedingThreshold.R | 3 ++- R/PeriodAccumulation.R | 6 ++++-- man/CST_AbsToProbs.Rd | 3 ++- man/CST_AccumulationExceedingThreshold.Rd | 3 ++- man/CST_PeriodAccumulation.Rd | 3 ++- man/PeriodAccumulation.Rd | 3 ++- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/R/AbsToProbs.R b/R/AbsToProbs.R index a11506e..708fabd 100644 --- a/R/AbsToProbs.R +++ b/R/AbsToProbs.R @@ -32,7 +32,8 @@ #' #'@examples #'exp <- NULL -#'exp$data <- array(rnorm(216), dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +#'exp$data <- array(rnorm(216), dim = c(dataset = 1, member = 2, sdate = 3, +#' ftime = 9, lat = 2, lon = 2)) #'class(exp) <- 's2dv_cube' #'exp_probs <- CST_AbsToProbs(exp) #'exp$data <- array(rnorm(5 * 3 * 214 * 2), diff --git a/R/AccumulationExceedingThreshold.R b/R/AccumulationExceedingThreshold.R index ae08c0d..f202dca 100644 --- a/R/AccumulationExceedingThreshold.R +++ b/R/AccumulationExceedingThreshold.R @@ -42,7 +42,8 @@ #' #'@examples #'exp <- NULL -#'exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +#'exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, +#' ftime = 9, lat = 2, lon = 2)) #'class(exp) <- 's2dv_cube' #'DOT <- CST_AccumulationExceedingThreshold(exp, threshold = 280) #' diff --git a/R/PeriodAccumulation.R b/R/PeriodAccumulation.R index c64672d..0b3fde5 100644 --- a/R/PeriodAccumulation.R +++ b/R/PeriodAccumulation.R @@ -35,7 +35,8 @@ #' #'@examples #'exp <- NULL -#'exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +#'exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, +#' ftime = 9, lat = 2, lon = 2)) #'class(exp) <- 's2dv_cube' #'TP <- CST_PeriodAccumulation(exp) #'exp$data <- array(rnorm(5 * 3 * 214 * 2), @@ -125,7 +126,8 @@ CST_PeriodAccumulation <- function(data, start = NULL, end = NULL, #'indicator in the element \code{data}. #' #'@examples -#'exp <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +#'exp <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, +#' ftime = 9, lat = 2, lon = 2)) #'TP <- PeriodAccumulation(exp, time_dim = 'ftime') #'data <- array(rnorm(5 * 3 * 214 * 2), #' c(memb = 5, sdate = 3, time = 214, lon = 2)) diff --git a/man/CST_AbsToProbs.Rd b/man/CST_AbsToProbs.Rd index fe58b51..57426ef 100644 --- a/man/CST_AbsToProbs.Rd +++ b/man/CST_AbsToProbs.Rd @@ -55,7 +55,8 @@ Distribution Function excluding the corresponding initialization. } \examples{ exp <- NULL -exp$data <- array(rnorm(216), dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +exp$data <- array(rnorm(216), dim = c(dataset = 1, member = 2, sdate = 3, + ftime = 9, lat = 2, lon = 2)) class(exp) <- 's2dv_cube' exp_probs <- CST_AbsToProbs(exp) exp$data <- array(rnorm(5 * 3 * 214 * 2), diff --git a/man/CST_AccumulationExceedingThreshold.Rd b/man/CST_AccumulationExceedingThreshold.Rd index 4fb563a..9c0a521 100644 --- a/man/CST_AccumulationExceedingThreshold.Rd +++ b/man/CST_AccumulationExceedingThreshold.Rd @@ -69,7 +69,8 @@ function: } \examples{ exp <- NULL -exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, + ftime = 9, lat = 2, lon = 2)) class(exp) <- 's2dv_cube' DOT <- CST_AccumulationExceedingThreshold(exp, threshold = 280) diff --git a/man/CST_PeriodAccumulation.Rd b/man/CST_PeriodAccumulation.Rd index d1bf476..abc79b6 100644 --- a/man/CST_PeriodAccumulation.Rd +++ b/man/CST_PeriodAccumulation.Rd @@ -56,7 +56,8 @@ by using this function: } \examples{ exp <- NULL -exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +exp$data <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, + ftime = 9, lat = 2, lon = 2)) class(exp) <- 's2dv_cube' TP <- CST_PeriodAccumulation(exp) exp$data <- array(rnorm(5 * 3 * 214 * 2), diff --git a/man/PeriodAccumulation.Rd b/man/PeriodAccumulation.Rd index c589b9b..9903321 100644 --- a/man/PeriodAccumulation.Rd +++ b/man/PeriodAccumulation.Rd @@ -59,7 +59,8 @@ by using this function: } } \examples{ -exp <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) +exp <- array(rnorm(216)*200, dim = c(dataset = 1, member = 2, sdate = 3, + ftime = 9, lat = 2, lon = 2)) TP <- PeriodAccumulation(exp, time_dim = 'ftime') data <- array(rnorm(5 * 3 * 214 * 2), c(memb = 5, sdate = 3, time = 214, lon = 2)) -- GitLab