diff --git a/R/SelectPeriodOnData.R b/R/SelectPeriodOnData.R index 529f7875746a521e8aee7763ca8f22584d34a63b..f9dda6be82aa15db7cd0861d7bd15a12cf2c2d9e 100644 --- a/R/SelectPeriodOnData.R +++ b/R/SelectPeriodOnData.R @@ -116,7 +116,7 @@ SelectPeriodOnData <- function(data, dates, start, end, dim(result) <- length(result) names(dim(result)) <- names(dim(x)) return(result) - }, ncores = ncores)$output1 + }, output_dims = time_dim, ncores = ncores)$output1 } else { res <- Apply(list(data, res), target_dims = time_dim, fun = function(x, y) { diff --git a/R/TotalSpellTimeExceedingThreshold.R b/R/TotalSpellTimeExceedingThreshold.R index 45c3203efe4e0fb4f617bcc2f8091fe07c0e3d4b..5997a96bc48f7c1f4a73c22e1ed07a2a14dc2c45 100644 --- a/R/TotalSpellTimeExceedingThreshold.R +++ b/R/TotalSpellTimeExceedingThreshold.R @@ -95,6 +95,7 @@ CST_TotalSpellTimeExceedingThreshold <- function(data, threshold, spell, op = '> #' #'@return A multidimensional array with named dimensions. #' +#'@details This function considers NA values as the end of the spell. For a different behaviour consider to modify the 'data' input by substituting NA values by values exceeding the threshold. #'@import multiApply #'@examples #'data <- array(rnorm(120), c(member = 1, sdate = 2, time = 20, lat = 4)) @@ -149,11 +150,13 @@ TotalSpellTimeExceedingThreshold <- function(data, threshold, spell, op = '>', d ncores = ncores)$output1 } else if (time_dim %in% names(dim(threshold))) { total <- Apply(list(data, threshold), target_dims = list(time_dim, time_dim), - fun = .totalspellthres, spell = spell, op = op)$output1 + fun = .totalspellthres, spell = spell, op = op, + ncores = ncores)$output1 } else { total <- Apply(list(data, threshold), target_dims = list(time_dim, NULL), - fun = .totalspellthres, spell = spell, op = op)$output1 + fun = .totalspellthres, spell = spell, op = op, + ncores = ncores)$output1 } return(total) } diff --git a/man/TotalSpellTimeExceedingThreshold.Rd b/man/TotalSpellTimeExceedingThreshold.Rd index 39ba110b75f14b8cc3d4465049e8e9e2787b1830..79f3e5d4f16497e59f34deec6d023ad6b99fcb74 100644 --- a/man/TotalSpellTimeExceedingThreshold.Rd +++ b/man/TotalSpellTimeExceedingThreshold.Rd @@ -45,6 +45,9 @@ This function allows to compute indicators widely used in Climate Services, such \code{WSDI}{Warm Spell Duration Index that count the total number of days with at least 6 consecutive days when the daily temperature maximum exceeds its 90th percentile.}} This function requires the data and the threshold to be in the same units. The 90th percentile can be translate into absolute values given a reference dataset using function \code{Threshold} or the data can be transform into probabilites by using function \code{AbsToProbs}. See section @examples. } +\details{ +This function considers NA values as the end of the spell. For a different behaviour consider to modify the 'data' input by substituting NA values by values exceeding the threshold. +} \examples{ data <- array(rnorm(120), c(member = 1, sdate = 2, time = 20, lat = 4)) threshold <- array(rnorm(4), c(lat = 4))