From cc720159eacfa2169657fc1c5f24684dacf55588 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Fri, 21 Oct 2022 17:14:13 +0200 Subject: [PATCH] Change data from CSTools in examples and use random. --- R/AbsToProbs.R | 6 ++++-- R/AccumulationExceedingThreshold.R | 5 +++-- R/MergeRefToExp.R | 16 +++++++++------- R/PeriodAccumulation.R | 6 ++++-- R/PeriodMean.R | 11 ++++++++--- R/QThreshold.R | 6 ++++-- R/SelectPeriodOnData.R | 5 +++-- R/Threshold.R | 6 +++--- R/TotalSpellTimeExceedingThreshold.R | 13 ++++++++++--- R/TotalTimeExceedingThreshold.R | 15 ++++++++++++--- man/AbsToProbs.Rd | 2 +- man/CST_AbsToProbs.Rd | 4 +++- man/CST_AccumulationExceedingThreshold.Rd | 5 +++-- man/CST_MergeRefToExp.Rd | 14 ++++++++------ man/CST_PeriodAccumulation.Rd | 4 +++- man/CST_PeriodMean.Rd | 9 +++++++-- man/CST_QThreshold.Rd | 6 ++++-- man/CST_SelectPeriodOnData.Rd | 5 +++-- man/CST_Threshold.Rd | 6 +++--- man/CST_TotalSpellTimeExceedingThreshold.Rd | 13 ++++++++++--- man/CST_TotalTimeExceedingThreshold.Rd | 12 ++++++++++-- man/PeriodAccumulation.Rd | 2 +- man/PeriodMean.Rd | 2 +- man/TotalTimeExceedingThreshold.Rd | 3 ++- 24 files changed, 119 insertions(+), 57 deletions(-) diff --git a/R/AbsToProbs.R b/R/AbsToProbs.R index 89c72c9..a11506e 100644 --- a/R/AbsToProbs.R +++ b/R/AbsToProbs.R @@ -31,7 +31,9 @@ #'@return An 's2dv_cube' object containing the probabilites in the element \code{data}. #' #'@examples -#'exp <- CSTools::lonlat_prec +#'exp <- NULL +#'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), #' c(member = 5, sdate = 3, ftime = 214, lon = 2)) @@ -115,7 +117,7 @@ CST_AbsToProbs <- function(data, start = NULL, end = NULL, #'probabilites in the element \code{data}. #' #'@examples -#'exp <- CSTools::lonlat_prec$data +#'exp <- array(rnorm(216), dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) #'exp_probs <- AbsToProbs(exp) #'data <- array(rnorm(5 * 2 * 61 * 1), #' c(member = 5, sdate = 2, ftime = 61, lon = 1)) diff --git a/R/AccumulationExceedingThreshold.R b/R/AccumulationExceedingThreshold.R index cceb07b..ae08c0d 100644 --- a/R/AccumulationExceedingThreshold.R +++ b/R/AccumulationExceedingThreshold.R @@ -41,8 +41,9 @@ #'@return A 's2dv_cube' object containing the indicator in the element \code{data}. #' #'@examples -#'exp <- CSTools::lonlat_data$exp -#'exp$data <- CSTools::lonlat_data$exp$data[1, 5, 3, 3, 1, 1] +#'exp <- NULL +#'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) #' #'@import multiApply diff --git a/R/MergeRefToExp.R b/R/MergeRefToExp.R index 068acfe..216dc8e 100644 --- a/R/MergeRefToExp.R +++ b/R/MergeRefToExp.R @@ -44,15 +44,17 @@ #' seq(as.Date("01-07-1994", "%d-%m-%Y", tz = 'UTC'), #' as.Date("01-12-1994","%d-%m-%Y", tz = 'UTC'), "day")) #'dim(data_dates) <- c(ftime = 154, sdate = 2) +#'data <- NULL +#'data$data <- array(1:(2*154*2), c(ftime = 154, sdate = 2, member= 2)) +#'data$Dates$start <- data_dates +#'class(data) <- 's2dv_cube' #'ref_dates <- seq(as.Date("01-01-1993", "%d-%m-%Y", tz = 'UTC'), #' as.Date("01-12-1994","%d-%m-%Y", tz = 'UTC'), "day") #'dim(ref_dates) <- c(ftime = 350, sdate = 2) -#'ref <- array(1001:1700, c(ftime = 350, sdate = 2)) -#'data <- array(1:(2*154*2), c(ftime = 154, sdate = 2, member= 2)) -#'ref <- CSTools::s2dv_cube(data = ref, Dates = list(start = ref_dates, -#' end = ref_dates)) -#'data <- CSTools::s2dv_cube(data = data, Dates = list(start = data_dates, -#' end = data_dates)) +#'ref <- NULL +#'ref$data <- array(1001:1700, c(ftime = 350, sdate = 2)) +#'ref$Dates$start <- ref_dates +#'class(ref) <- 's2dv_cube' #'new_data <- CST_MergeRefToExp(data1 = ref, data2 = data, #' start1 = list(21, 6), end1 = list(30, 6), #' start2 = list(1, 7), end2 = list(21, 9)) @@ -111,7 +113,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') diff --git a/R/PeriodAccumulation.R b/R/PeriodAccumulation.R index ab093be..c64672d 100644 --- a/R/PeriodAccumulation.R +++ b/R/PeriodAccumulation.R @@ -34,7 +34,9 @@ #'\code{data}. #' #'@examples -#'exp <- CSTools::lonlat_prec +#'exp <- NULL +#'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), #' c(memb = 5, sdate = 3, ftime = 214, lon = 2)) @@ -123,7 +125,7 @@ CST_PeriodAccumulation <- function(data, start = NULL, end = NULL, #'indicator in the element \code{data}. #' #'@examples -#'exp <- CSTools::lonlat_prec$data +#'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/R/PeriodMean.R b/R/PeriodMean.R index 55f28cd..97f99c3 100644 --- a/R/PeriodMean.R +++ b/R/PeriodMean.R @@ -34,8 +34,13 @@ #' \code{data}. #' #'@examples -#'exp <- CSTools::lonlat_data$exp -#'exp$data <- CSTools::lonlat_data$exp$data[1, , 3, , 1, 1] +#'exp <- NULL +#'exp$data <- array(rnorm(45), dim = c(member = 7, ftime = 8)) +#'class(exp) <- 's2dv_cube' +#'exp$Dates$start <- c(seq(as.Date("01-07-1993", "%d-%m-%Y", tz = 'UTC'), +#' as.Date("01-08-1993","%d-%m-%Y", tz = 'UTC'), "day"), +#' seq(as.Date("01-07-1994", "%d-%m-%Y", tz = 'UTC'), +#' as.Date("01-08-1994","%d-%m-%Y", tz = 'UTC'), "day")) #'SA <- CST_PeriodMean(exp) #' #'@import multiApply @@ -111,7 +116,7 @@ CST_PeriodMean <- function(data, start = NULL, end = NULL, #'indicator in the element \code{data}. #' #'@examples -#'exp <- CSTools::lonlat_prec$data +#'exp <- array(rnorm(56), dim = c(member = 7, ftime = 8)) #'SA <- PeriodMean(exp, time_dim = 'ftime') #' #'@import multiApply diff --git a/R/QThreshold.R b/R/QThreshold.R index 4663411..8eb950a 100644 --- a/R/QThreshold.R +++ b/R/QThreshold.R @@ -53,7 +53,9 @@ #' #'@examples #'threshold <- 26 -#'exp <- CSTools::lonlat_prec +#'exp <- NULL +#'exp$data <- array(abs(rnorm(112)*26), dim = c(member = 7, sdate = 8, ftime = 2)) +#'class(exp) <- 's2dv_cube' #'exp_probs <- CST_QThreshold(exp, threshold) #'exp$data <- array(rnorm(5 * 3 * 214 * 2), #' c(member = 5, sdate = 3, ftime = 214, lon = 2)) @@ -63,7 +65,7 @@ #' as.Date("30-11-2001", format = "%d-%m-%Y"), by = 'day'), #' seq(as.Date("01-05-2002", format = "%d-%m-%Y"), #' as.Date("30-11-2002", format = "%d-%m-%Y"), by = 'day')) -#'exp_probs <- CST_QThreshold(exp, threshold, start = list(21, 4), end = list(21, 6)) +#'exp_probs <- CST_QThreshold(exp, threshold) #' #'@import multiApply #'@importFrom ClimProjDiags Subset diff --git a/R/SelectPeriodOnData.R b/R/SelectPeriodOnData.R index 49575a2..3c162dd 100644 --- a/R/SelectPeriodOnData.R +++ b/R/SelectPeriodOnData.R @@ -21,15 +21,16 @@ #'\code{data$data} during the period requested from \code{start} to \code{end}. #' #'@examples -#'exp <- CSTools::lonlat_prec +#'exp <- NULL #'exp$data <- array(rnorm(5 * 3 * 214 * 2), #' c(memb = 5, sdate = 3, ftime = 214, lon = 2)) -#'exp$Dates[[1]] <- c(seq(as.Date("01-05-2000", format = "%d-%m-%Y"), +#'exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "%d-%m-%Y"), #' as.Date("30-11-2000", format = "%d-%m-%Y"), by = 'day'), #' seq(as.Date("01-05-2001", format = "%d-%m-%Y"), #' as.Date("30-11-2001", format = "%d-%m-%Y"), by = 'day'), #' seq(as.Date("01-05-2002", format = "%d-%m-%Y"), #' as.Date("30-11-2002", format = "%d-%m-%Y"), by = 'day')) +#'class(exp) <- 's2dv_cube' #'Period <- CST_SelectPeriodOnData(exp, start = list(21, 6), end = list(21, 9)) #' #'@import multiApply diff --git a/R/Threshold.R b/R/Threshold.R index 18b8dea..0117952 100644 --- a/R/Threshold.R +++ b/R/Threshold.R @@ -38,16 +38,16 @@ #' #'@examples #'threshold <- 0.9 -#'exp <- CSTools::lonlat_prec -#'exp_probs <- CST_Threshold(exp, threshold) +#'exp <- NULL #'exp$data <- array(rnorm(5 * 3 * 214 * 2), #' c(member = 5, sdate = 3, ftime = 214, lon = 2)) -#'exp$Dates[[1]] <- c(seq(as.Date("01-05-2000", format = "%d-%m-%Y"), +#'exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "%d-%m-%Y"), #' as.Date("30-11-2000", format = "%d-%m-%Y"), by = 'day'), #' seq(as.Date("01-05-2001", format = "%d-%m-%Y"), #' as.Date("30-11-2001", format = "%d-%m-%Y"), by = 'day'), #' seq(as.Date("01-05-2002", format = "%d-%m-%Y"), #' as.Date("30-11-2002", format = "%d-%m-%Y"), by = 'day')) +#'class(exp) <- 's2dv_cube' #'exp_probs <- CST_Threshold(exp, threshold, start = list(21, 4), end = list(21, 6)) #' #'@import multiApply diff --git a/R/TotalSpellTimeExceedingThreshold.R b/R/TotalSpellTimeExceedingThreshold.R index 7039f28..ac2261a 100644 --- a/R/TotalSpellTimeExceedingThreshold.R +++ b/R/TotalSpellTimeExceedingThreshold.R @@ -45,9 +45,16 @@ #'\code{data}. #' #'@examples -#'exp <- CSTools::lonlat_data$exp -#'exp$data <- array(rnorm(5 * 3 * 20 * 2, mean = 25, sd = 3), -#' c(member = 5, sdate = 3, ftime = 20, lon = 2)) +#'exp <- NULL +#'exp$data <- array(rnorm(5 * 3 * 214 * 2)*23, +#' c(member = 5, sdate = 3, ftime = 214, lon = 2)) +#'exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "%d-%m-%Y"), +#' as.Date("30-11-2000", format = "%d-%m-%Y"), by = 'day'), +#' seq(as.Date("01-05-2001", format = "%d-%m-%Y"), +#' as.Date("30-11-2001", format = "%d-%m-%Y"), by = 'day'), +#' seq(as.Date("01-05-2002", format = "%d-%m-%Y"), +#' as.Date("30-11-2002", format = "%d-%m-%Y"), by = 'day')) +#'class(exp) <- 's2dv_cube' #'TTSET <- CST_TotalSpellTimeExceedingThreshold(exp, threshold = 23, spell = 3) #' #'@import multiApply diff --git a/R/TotalTimeExceedingThreshold.R b/R/TotalTimeExceedingThreshold.R index 6e6e72d..ec25244 100644 --- a/R/TotalTimeExceedingThreshold.R +++ b/R/TotalTimeExceedingThreshold.R @@ -50,8 +50,16 @@ #'\code{data}. #' #'@examples -#'exp <- CSTools::lonlat_data$exp -#'exp$data <- CSTools::lonlat_data$exp$data[1, 1, 3, 3, 1, 1] +#'exp <- NULL +#'exp$data <- array(abs(rnorm(5 * 3 * 214 * 2)*280), +#' c(member = 5, sdate = 3, ftime = 214, lon = 2)) +#'exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "%d-%m-%Y"), +#' as.Date("30-11-2000", format = "%d-%m-%Y"), by = 'day'), +#' seq(as.Date("01-05-2001", format = "%d-%m-%Y"), +#' as.Date("30-11-2001", format = "%d-%m-%Y"), by = 'day'), +#' seq(as.Date("01-05-2002", format = "%d-%m-%Y"), +#' as.Date("30-11-2002", format = "%d-%m-%Y"), by = 'day')) +#'class(exp) <- 's2dv_cube' #'DOT <- CST_TotalTimeExceedingThreshold(exp, threshold = 280) #' #'@import multiApply @@ -147,7 +155,8 @@ CST_TotalTimeExceedingThreshold <- function(data, threshold, op = '>', #'indicator in the element \code{data}. #' #'@examples -#'exp <- CSTools::lonlat_data$exp$data[1, 5, 3, 3, 1, 1] +#'exp <- array(abs(rnorm(5 * 3 * 214 * 2)*280), +#' c(member = 5, sdate = 3, ftime = 214, lon = 2)) #'DOT <- TotalTimeExceedingThreshold(exp, threshold = 300, time_dim = 'ftime') #' #'@import multiApply diff --git a/man/AbsToProbs.Rd b/man/AbsToProbs.Rd index 89b1f83..9b79296 100644 --- a/man/AbsToProbs.Rd +++ b/man/AbsToProbs.Rd @@ -59,7 +59,7 @@ probabilities of each value in the ensemble. If multiple initializations Distribution Function excluding the corresponding initialization. } \examples{ -exp <- CSTools::lonlat_prec$data +exp <- array(rnorm(216), dim = c(dataset = 1, member = 2, sdate = 3, ftime = 9, lat = 2, lon = 2)) exp_probs <- AbsToProbs(exp) data <- array(rnorm(5 * 2 * 61 * 1), c(member = 5, sdate = 2, ftime = 61, lon = 1)) diff --git a/man/CST_AbsToProbs.Rd b/man/CST_AbsToProbs.Rd index dcdcef9..fe58b51 100644 --- a/man/CST_AbsToProbs.Rd +++ b/man/CST_AbsToProbs.Rd @@ -54,7 +54,9 @@ probabilities of each value in the ensemble. If multiple initializations Distribution Function excluding the corresponding initialization. } \examples{ -exp <- CSTools::lonlat_prec +exp <- NULL +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), c(member = 5, sdate = 3, ftime = 214, lon = 2)) diff --git a/man/CST_AccumulationExceedingThreshold.Rd b/man/CST_AccumulationExceedingThreshold.Rd index 0754c24..4fb563a 100644 --- a/man/CST_AccumulationExceedingThreshold.Rd +++ b/man/CST_AccumulationExceedingThreshold.Rd @@ -68,8 +68,9 @@ function: } } \examples{ -exp <- CSTools::lonlat_data$exp -exp$data <- CSTools::lonlat_data$exp$data[1, 5, 3, 3, 1, 1] +exp <- NULL +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_MergeRefToExp.Rd b/man/CST_MergeRefToExp.Rd index 102b062..a5b9cc7 100644 --- a/man/CST_MergeRefToExp.Rd +++ b/man/CST_MergeRefToExp.Rd @@ -72,15 +72,17 @@ data_dates <- c(seq(as.Date("01-07-1993", "\%d-\%m-\%Y", tz = 'UTC'), seq(as.Date("01-07-1994", "\%d-\%m-\%Y", tz = 'UTC'), as.Date("01-12-1994","\%d-\%m-\%Y", tz = 'UTC'), "day")) dim(data_dates) <- c(ftime = 154, sdate = 2) +data <- NULL +data$data <- array(1:(2*154*2), c(ftime = 154, sdate = 2, member= 2)) +data$Dates$start <- data_dates +class(data) <- 's2dv_cube' ref_dates <- seq(as.Date("01-01-1993", "\%d-\%m-\%Y", tz = 'UTC'), as.Date("01-12-1994","\%d-\%m-\%Y", tz = 'UTC'), "day") dim(ref_dates) <- c(ftime = 350, sdate = 2) -ref <- array(1001:1700, c(ftime = 350, sdate = 2)) -data <- array(1:(2*154*2), c(ftime = 154, sdate = 2, member= 2)) -ref <- CSTools::s2dv_cube(data = ref, Dates = list(start = ref_dates, - end = ref_dates)) -data <- CSTools::s2dv_cube(data = data, Dates = list(start = data_dates, - end = data_dates)) +ref <- NULL +ref$data <- array(1001:1700, c(ftime = 350, sdate = 2)) +ref$Dates$start <- ref_dates +class(ref) <- 's2dv_cube' new_data <- CST_MergeRefToExp(data1 = ref, data2 = data, start1 = list(21, 6), end1 = list(30, 6), start2 = list(1, 7), end2 = list(21, 9)) diff --git a/man/CST_PeriodAccumulation.Rd b/man/CST_PeriodAccumulation.Rd index afd6080..d1bf476 100644 --- a/man/CST_PeriodAccumulation.Rd +++ b/man/CST_PeriodAccumulation.Rd @@ -55,7 +55,9 @@ by using this function: } } \examples{ -exp <- CSTools::lonlat_prec +exp <- NULL +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), c(memb = 5, sdate = 3, ftime = 214, lon = 2)) diff --git a/man/CST_PeriodMean.Rd b/man/CST_PeriodMean.Rd index c4e3dae..b9ae538 100644 --- a/man/CST_PeriodMean.Rd +++ b/man/CST_PeriodMean.Rd @@ -55,8 +55,13 @@ this function: } } \examples{ -exp <- CSTools::lonlat_data$exp -exp$data <- CSTools::lonlat_data$exp$data[1, , 3, , 1, 1] +exp <- NULL +exp$data <- array(rnorm(45), dim = c(member = 7, ftime = 8)) +class(exp) <- 's2dv_cube' +exp$Dates$start <- c(seq(as.Date("01-07-1993", "\%d-\%m-\%Y", tz = 'UTC'), + as.Date("01-08-1993","\%d-\%m-\%Y", tz = 'UTC'), "day"), + seq(as.Date("01-07-1994", "\%d-\%m-\%Y", tz = 'UTC'), + as.Date("01-08-1994","\%d-\%m-\%Y", tz = 'UTC'), "day")) SA <- CST_PeriodMean(exp) } diff --git a/man/CST_QThreshold.Rd b/man/CST_QThreshold.Rd index a01c5d2..0edbcba 100644 --- a/man/CST_QThreshold.Rd +++ b/man/CST_QThreshold.Rd @@ -79,7 +79,9 @@ and memb_dim parameters: } \examples{ threshold <- 26 -exp <- CSTools::lonlat_prec +exp <- NULL +exp$data <- array(abs(rnorm(112)*26), dim = c(member = 7, sdate = 8, ftime = 2)) +class(exp) <- 's2dv_cube' exp_probs <- CST_QThreshold(exp, threshold) exp$data <- array(rnorm(5 * 3 * 214 * 2), c(member = 5, sdate = 3, ftime = 214, lon = 2)) @@ -89,6 +91,6 @@ exp$Dates[[1]] <- c(seq(as.Date("01-05-2000", format = "\%d-\%m-\%Y"), as.Date("30-11-2001", format = "\%d-\%m-\%Y"), by = 'day'), seq(as.Date("01-05-2002", format = "\%d-\%m-\%Y"), as.Date("30-11-2002", format = "\%d-\%m-\%Y"), by = 'day')) -exp_probs <- CST_QThreshold(exp, threshold, start = list(21, 4), end = list(21, 6)) +exp_probs <- CST_QThreshold(exp, threshold) } diff --git a/man/CST_SelectPeriodOnData.Rd b/man/CST_SelectPeriodOnData.Rd index 210fcaa..6e04162 100644 --- a/man/CST_SelectPeriodOnData.Rd +++ b/man/CST_SelectPeriodOnData.Rd @@ -34,15 +34,16 @@ A 's2dv_cube' object containing the subset of the object Auxiliary function to subset data for a specific period. } \examples{ -exp <- CSTools::lonlat_prec +exp <- NULL exp$data <- array(rnorm(5 * 3 * 214 * 2), c(memb = 5, sdate = 3, ftime = 214, lon = 2)) -exp$Dates[[1]] <- c(seq(as.Date("01-05-2000", format = "\%d-\%m-\%Y"), +exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "\%d-\%m-\%Y"), as.Date("30-11-2000", format = "\%d-\%m-\%Y"), by = 'day'), seq(as.Date("01-05-2001", format = "\%d-\%m-\%Y"), as.Date("30-11-2001", format = "\%d-\%m-\%Y"), by = 'day'), seq(as.Date("01-05-2002", format = "\%d-\%m-\%Y"), as.Date("30-11-2002", format = "\%d-\%m-\%Y"), by = 'day')) +class(exp) <- 's2dv_cube' Period <- CST_SelectPeriodOnData(exp, start = list(21, 6), end = list(21, 9)) } diff --git a/man/CST_Threshold.Rd b/man/CST_Threshold.Rd index 906d1b1..5d260e9 100644 --- a/man/CST_Threshold.Rd +++ b/man/CST_Threshold.Rd @@ -65,16 +65,16 @@ given a dataset. } \examples{ threshold <- 0.9 -exp <- CSTools::lonlat_prec -exp_probs <- CST_Threshold(exp, threshold) +exp <- NULL exp$data <- array(rnorm(5 * 3 * 214 * 2), c(member = 5, sdate = 3, ftime = 214, lon = 2)) -exp$Dates[[1]] <- c(seq(as.Date("01-05-2000", format = "\%d-\%m-\%Y"), +exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "\%d-\%m-\%Y"), as.Date("30-11-2000", format = "\%d-\%m-\%Y"), by = 'day'), seq(as.Date("01-05-2001", format = "\%d-\%m-\%Y"), as.Date("30-11-2001", format = "\%d-\%m-\%Y"), by = 'day'), seq(as.Date("01-05-2002", format = "\%d-\%m-\%Y"), as.Date("30-11-2002", format = "\%d-\%m-\%Y"), by = 'day')) +class(exp) <- 's2dv_cube' exp_probs <- CST_Threshold(exp, threshold, start = list(21, 4), end = list(21, 6)) } diff --git a/man/CST_TotalSpellTimeExceedingThreshold.Rd b/man/CST_TotalSpellTimeExceedingThreshold.Rd index d19415e..847fed2 100644 --- a/man/CST_TotalSpellTimeExceedingThreshold.Rd +++ b/man/CST_TotalSpellTimeExceedingThreshold.Rd @@ -69,9 +69,16 @@ using function \code{Threshold} or the data can be transform into probabilites by using function \code{AbsToProbs}. See section @examples. } \examples{ -exp <- CSTools::lonlat_data$exp -exp$data <- array(rnorm(5 * 3 * 20 * 2, mean = 25, sd = 3), - c(member = 5, sdate = 3, ftime = 20, lon = 2)) +exp <- NULL +exp$data <- array(rnorm(5 * 3 * 214 * 2)*23, + c(member = 5, sdate = 3, ftime = 214, lon = 2)) +exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "\%d-\%m-\%Y"), + as.Date("30-11-2000", format = "\%d-\%m-\%Y"), by = 'day'), + seq(as.Date("01-05-2001", format = "\%d-\%m-\%Y"), + as.Date("30-11-2001", format = "\%d-\%m-\%Y"), by = 'day'), + seq(as.Date("01-05-2002", format = "\%d-\%m-\%Y"), + as.Date("30-11-2002", format = "\%d-\%m-\%Y"), by = 'day')) +class(exp) <- 's2dv_cube' TTSET <- CST_TotalSpellTimeExceedingThreshold(exp, threshold = 23, spell = 3) } diff --git a/man/CST_TotalTimeExceedingThreshold.Rd b/man/CST_TotalTimeExceedingThreshold.Rd index 980d77b..bbd05e0 100644 --- a/man/CST_TotalTimeExceedingThreshold.Rd +++ b/man/CST_TotalTimeExceedingThreshold.Rd @@ -75,8 +75,16 @@ indices for heat stress can be obtained by using this function: } } \examples{ -exp <- CSTools::lonlat_data$exp -exp$data <- CSTools::lonlat_data$exp$data[1, 1, 3, 3, 1, 1] +exp <- NULL +exp$data <- array(abs(rnorm(5 * 3 * 214 * 2)*280), + c(member = 5, sdate = 3, ftime = 214, lon = 2)) +exp$Dates$start <- c(seq(as.Date("01-05-2000", format = "\%d-\%m-\%Y"), + as.Date("30-11-2000", format = "\%d-\%m-\%Y"), by = 'day'), + seq(as.Date("01-05-2001", format = "\%d-\%m-\%Y"), + as.Date("30-11-2001", format = "\%d-\%m-\%Y"), by = 'day'), + seq(as.Date("01-05-2002", format = "\%d-\%m-\%Y"), + as.Date("30-11-2002", format = "\%d-\%m-\%Y"), by = 'day')) +class(exp) <- 's2dv_cube' DOT <- CST_TotalTimeExceedingThreshold(exp, threshold = 280) } diff --git a/man/PeriodAccumulation.Rd b/man/PeriodAccumulation.Rd index f6e6d3b..c589b9b 100644 --- a/man/PeriodAccumulation.Rd +++ b/man/PeriodAccumulation.Rd @@ -59,7 +59,7 @@ by using this function: } } \examples{ -exp <- CSTools::lonlat_prec$data +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/PeriodMean.Rd b/man/PeriodMean.Rd index 803a3f2..fffb332 100644 --- a/man/PeriodMean.Rd +++ b/man/PeriodMean.Rd @@ -59,7 +59,7 @@ this function: } } \examples{ -exp <- CSTools::lonlat_prec$data +exp <- array(rnorm(56), dim = c(member = 7, ftime = 8)) SA <- PeriodMean(exp, time_dim = 'ftime') } diff --git a/man/TotalTimeExceedingThreshold.Rd b/man/TotalTimeExceedingThreshold.Rd index 524f938..f874b50 100644 --- a/man/TotalTimeExceedingThreshold.Rd +++ b/man/TotalTimeExceedingThreshold.Rd @@ -78,7 +78,8 @@ be obtained by using this function: } } \examples{ -exp <- CSTools::lonlat_data$exp$data[1, 5, 3, 3, 1, 1] +exp <- array(abs(rnorm(5 * 3 * 214 * 2)*280), + c(member = 5, sdate = 3, ftime = 214, lon = 2)) DOT <- TotalTimeExceedingThreshold(exp, threshold = 300, time_dim = 'ftime') } -- GitLab