diff --git a/.Rbuildignore b/.Rbuildignore index e8159e28cec9403ffb26c7a4fab74f9f828e7545..ba637f5203b039844510c72b6723061599defdd5 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 6dae74dc29205f9729ff88cf68b6711af046cccb..d85555958676c8a89b5215256862c87e1fdc5cb0 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 7aefb00df24f2835db4f97d44a0507a4ece09bb3..fa2bb871d026192b20e4a2731df33061c5d83b59 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ -### CSIndicators 0.0.2 -**Submission date to CRAN: XX-YY-2021** +# 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. +- Revise examples using s2dv::InsertDim in MergeRefToExp(). -- New features: -- Fixes: - + Vignettes figures +# 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 diff --git a/R/AbsToProbs.R b/R/AbsToProbs.R index a11506e80ae7fc31d7bd37b200a978b0d396d28b..708fabdafbec4e9cbf094fb53c586741a48b52f6 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 ae08c0d41fcdfa983bf68944433c1a067a783f1b..f202dca791a07a96d523e8b5680f80159138b00e 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 c64672debe443ffe5ad97618b5f3940c727a2af9..0b3fde5a909e212859875e07a70fb79a424410bf 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/README.md b/README.md index 24069b7e15d5054aec2c00afd480b542ae782a27..2ed5fde1768871aefe4fef51b24a849563cafadc 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 diff --git a/man/CST_AbsToProbs.Rd b/man/CST_AbsToProbs.Rd index fe58b51622db027bf4f69accf18031fe0aaec640..57426efb6f4e7e88f6c3618c5e89a3db31f0e8fd 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 4fb563a99ea575c02ca0373ea8201883c2957768..9c0a521ae8bda6a57e102060bb91804bdaf496e6 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 d1bf476b063191e0957c876486aed1f4fdbab559..abc79b69cd51f8cce811885b0f17c134ce681187 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 c589b9b7072633783ba05e66986ca4f2fb4e1beb..99033211af06dc55c429d728d69c2fbee910c756 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))