diff --git a/DESCRIPTION b/DESCRIPTION index 0085fa4ff7fa1b79aa7e32ec2dccc172ef633dec..980023c21949a7a77b7a3880569eab95a97aafc2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -62,6 +62,7 @@ Depends: easyVerification Imports: s2dv, + startR, rainfarmr, multiApply (>= 2.1.1), ClimProjDiags, @@ -84,8 +85,7 @@ Suggests: testthat, knitr, markdown, - rmarkdown, - startR + rmarkdown VignetteBuilder: knitr License: GPL-3 Encoding: UTF-8 diff --git a/R/CST_Analogs.R b/R/CST_Analogs.R index 402ee316e3862831ade1fd89309e678d7f2df642..425210859659c31f3763d183486ed053d2895852 100644 --- a/R/CST_Analogs.R +++ b/R/CST_Analogs.R @@ -24,7 +24,7 @@ #'This function has not constrains of specific regions, variables to downscale, #'or data to be used (seasonal forecast data, climate projections data, #'reanalyses data). The regrid into a finner scale is done interpolating with -#'CST_Load. Then, this interpolation is corrected selecting the analogs in the +#'CST_Start. Then, this interpolation is corrected selecting the analogs in the #'large and local scale in based of the observations. The function is an #'adapted version of the method of Yiou et al 2013. For an advanced search of #'Analogs (multiple Analogs, different criterias, further information from the @@ -104,8 +104,7 @@ #' best analog, for instance for downscaling. #'@param ncores The number of cores to use in parallel computation #' -#'@seealso \code{\link{CST_Load}}, \code{\link[s2dv]{Load}} and -#'\code{\link[s2dv]{CDORemap}} +#'@seealso \code{\link{CST_Start}}, \code{\link[startR]{Start}} #' #'@return An 's2dv_cube' object containing an array with the dowscaled values of #'the best analogs in element 'data'. If 'AnalogsInfo' is TRUE, 'data' is a list @@ -147,16 +146,13 @@ CST_Analogs <- function(expL, obsL, expVar = NULL, obsVar = NULL, # Check 's2dv_cube' if (!inherits(expL, "s2dv_cube") || !inherits(obsL, "s2dv_cube")) { - stop("Parameter 'expL' and 'obsL' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'expL' and 'obsL' must be of the class 's2dv_cube'.") } if (!is.null(expVar) && !inherits(expVar, "s2dv_cube")) { - stop("Parameter 'expVar' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'expVar' must be of the class 's2dv_cube'.") } if (!is.null(obsVar) && !inherits(obsVar, "s2dv_cube")) { - stop("Parameter 'obsVar' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'obsVar' must be of the class 's2dv_cube'.") } # Check 'obsL' object structure @@ -293,7 +289,7 @@ CST_Analogs <- function(expL, obsL, expVar = NULL, obsVar = NULL, #'ones. This function has not constrains of specific regions, variables to #'downscale, or data to be used (seasonal forecast data, climate projections #'data, reanalyses data). The regrid into a finner scale is done interpolating -#'with CST_Load. Then, this interpolation is corrected selecting the analogs in +#'with CST_Start. Then, this interpolation is corrected selecting the analogs in #'the large and local scale in based of the observations. The function is an #'adapted version of the method of Yiou et al 2013. #' diff --git a/R/CST_Anomaly.R b/R/CST_Anomaly.R index 205c2c600975442cf6d419faef61ef364e1254e4..654bb0790a94f5a8571585c2b0e99e35e6d49497 100644 --- a/R/CST_Anomaly.R +++ b/R/CST_Anomaly.R @@ -57,7 +57,7 @@ #'anom <- CST_Anomaly(exp = exp, obs = obs, cross = FALSE, memb = TRUE) #' #'@seealso \code{\link[s2dv]{Ano_CrossValid}}, \code{\link[s2dv]{Clim}} and -#'\code{\link{CST_Load}} +#'\code{\link{CST_Start}} #' #'@import multiApply #'@importFrom s2dv InsertDim Clim Ano_CrossValid Reorder @@ -69,8 +69,7 @@ CST_Anomaly <- function(exp = NULL, obs = NULL, dim_anom = 'sdate', # Check 's2dv_cube' if (!inherits(exp, 's2dv_cube') & !is.null(exp) || !inherits(obs, 's2dv_cube') & !is.null(obs)) { - stop("Parameter 'exp' and 'obs' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'exp' and 'obs' must be of the class 's2dv_cube'.") } # exp and obs if (is.null(exp$data) & is.null(obs$data)) { diff --git a/R/CST_BiasCorrection.R b/R/CST_BiasCorrection.R index 772d23ef6e1e9f36fc5ca5d5eec616e4b8d6c6a6..06f2c519411c009664d44174fd455f9f662e2e1b 100644 --- a/R/CST_BiasCorrection.R +++ b/R/CST_BiasCorrection.R @@ -5,14 +5,14 @@ #'described in Torralba et al. (2017). The adjusted forecasts have an equivalent #'standard deviation and mean to that of the reference dataset. #' -#'@param exp An object of class \code{s2dv_cube} as returned by \code{CST_Load} +#'@param exp An object of class \code{s2dv_cube} as returned by \code{CST_Start} #' function, containing the seasonal forecast experiment data in the element #' named \code{$data} with at least time and member dimensions. -#'@param obs An object of class \code{s2dv_cube} as returned by \code{CST_Load} +#'@param obs An object of class \code{s2dv_cube} as returned by \code{CST_Start} #' function, containing the observed data in the element named \code{$data} #' with at least time dimension. #'@param exp_cor An object of class \code{s2dv_cube} as returned by -#' \code{CST_Load} function, containing the seasonal forecast experiment to be +#' \code{CST_Start} function, containing the seasonal forecast experiment to be #' corrected with at least time dimension. If it is NULL, the 'exp' forecast #' will be corrected. If there is only one corrected dataset, it should not #' have dataset dimension. If there is a corresponding corrected dataset for @@ -44,9 +44,9 @@ #' #'@examples #'mod1 <- 1 : (1 * 3 * 4 * 5 * 6 * 7) -#'dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, ftime = 5, lat = 6, lon = 7) +#'dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, time = 5, lat = 6, lon = 7) #'obs1 <- 1 : (1 * 1 * 4 * 5 * 6 * 7) -#'dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, ftime = 5, lat = 6, lon = 7) +#'dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, time = 5, lat = 6, lon = 7) #'lon <- seq(0, 30, 5) #'lat <- seq(0, 25, 5) #'coords <- list(lat = lat, lon = lon) @@ -134,9 +134,9 @@ CST_BiasCorrection <- function(exp, obs, exp_cor = NULL, na.rm = FALSE, #' #'@examples #'mod1 <- 1 : (1 * 3 * 4 * 5 * 6 * 7) -#'dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, ftime = 5, lat = 6, lon = 7) +#'dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, time = 5, lat = 6, lon = 7) #'obs1 <- 1 : (1 * 1 * 4 * 5 * 6 * 7) -#'dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, ftime = 5, lat = 6, lon = 7) +#'dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, time = 5, lat = 6, lon = 7) #'a <- BiasCorrection(exp = mod1, obs = obs1) #'@import multiApply #'@export diff --git a/R/CST_Calibration.R b/R/CST_Calibration.R index d4b9170bf8dd7f0f76f92f74a484b6b8e25ba937..3ba22917679947eb71b1b6c2211b9e60bda804be 100644 --- a/R/CST_Calibration.R +++ b/R/CST_Calibration.R @@ -18,16 +18,16 @@ #'(2014). It is equivalent to function \code{Calibration} but for objects #'of class \code{s2dv_cube}. #' -#'@param exp An object of class \code{s2dv_cube} as returned by \code{CST_Load} +#'@param exp An object of class \code{s2dv_cube} as returned by \code{CST_Start} #' function with at least 'sdate' and 'member' dimensions, containing the #' seasonal hindcast experiment data in the element named \code{data}. The #' hindcast is used to calibrate the forecast in case the forecast is provided; #' if not, the same hindcast will be calibrated instead. -#'@param obs An object of class \code{s2dv_cube} as returned by \code{CST_Load} +#'@param obs An object of class \code{s2dv_cube} as returned by \code{CST_Start} #' function with at least 'sdate' dimension, containing the observed data in #' the element named \code{$data}. #'@param exp_cor An optional object of class \code{s2dv_cube} as returned by -#' \code{CST_Load} function with at least 'sdate' and 'member' dimensions, +#' \code{CST_Start} function with at least 'sdate' and 'member' dimensions, #' containing the seasonal forecast experiment data in the element named #' \code{data}. If the forecast is provided, it will be calibrated using the #' hindcast and observations; if not, the hindcast will be calibrated instead. @@ -106,7 +106,7 @@ #'Quarterly Journal of the Royal Meteorological Society, 141(688), 807-818. #'\doi{10.1002/qj.2397} #' -#'@seealso \code{\link{CST_Load}} +#'@seealso \code{\link{CST_Start}} #' #'@examples #'# Example 1: @@ -287,7 +287,7 @@ CST_Calibration <- function(exp, obs, exp_cor = NULL, cal.method = "mse_min", #'Quarterly Journal of the Royal Meteorological Society, 141(688), 807-818. #'\doi{10.1002/qj.2397} #' -#'@seealso \code{\link{CST_Load}} +#'@seealso \code{\link{CST_Start}} #' #'@examples #'mod1 <- 1 : (1 * 3 * 4 * 5 * 6 * 7) diff --git a/R/CST_MergeDims.R b/R/CST_MergeDims.R index a1ecbd156b4b72f6d72efbc64c8fa4bd2e389f3c..4b66629ef724460287e01e26a22b098ae705ab05 100644 --- a/R/CST_MergeDims.R +++ b/R/CST_MergeDims.R @@ -33,8 +33,7 @@ CST_MergeDims <- function(data, merge_dims = c('ftime', 'monthly'), rename_dim = NULL, na.rm = FALSE) { # Check 's2dv_cube' if (!inherits(data, 's2dv_cube')) { - stop("Parameter 'data' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'data' must be of the class 's2dv_cube'.") } data$data <- MergeDims(data$data, merge_dims = merge_dims, rename_dim = rename_dim, na.rm = na.rm) diff --git a/R/CST_QuantileMapping.R b/R/CST_QuantileMapping.R index 92b7ac038161d037ab3b9409bf42c97dd3376aa1..cbb76c9937942d98254e625eb9c8637a26d34307 100644 --- a/R/CST_QuantileMapping.R +++ b/R/CST_QuantileMapping.R @@ -58,13 +58,11 @@ CST_QuantileMapping <- function(exp, obs, exp_cor = NULL, sdate_dim = 'sdate', ncores = NULL, ...) { # Check 's2dv_cube' if (!inherits(exp, 's2dv_cube') || !inherits(obs, 's2dv_cube')) { - stop("Parameter 'exp' and 'obs' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'exp' and 'obs' must be of the class 's2dv_cube'.") } if (!is.null(exp_cor)) { if (!inherits(exp_cor, 's2dv_cube')) { - stop("Parameter 'exp_cor' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'exp_cor' must be of the class 's2dv_cube'.") } } diff --git a/R/CST_SaveExp.R b/R/CST_SaveExp.R index 0f7ea2e0716cbf436ccc44c1966b85a87e24ff6a..7d5733f1f21fe3c756c85a918fd0f3790bfce7be 100644 --- a/R/CST_SaveExp.R +++ b/R/CST_SaveExp.R @@ -72,10 +72,10 @@ #' #'@examples #'\dontrun{ -#'data <- lonlat_temp$exp +#'data <- lonlat_temp_st$exp #'destination <- "./" #'CST_SaveExp(data = data, destination = destination, ftime_dim = 'ftime', -#' var_dim = NULL, ftime_dim = 'ftime', var_dim = NULL) +#' var_dim = 'var', dat_dim = 'dataset') #'} #' #'@import ncdf4 @@ -90,8 +90,7 @@ CST_SaveExp <- function(data, destination = "./", sdate_dim = 'sdate', single_file = FALSE, extra_string = NULL) { # Check 's2dv_cube' if (!inherits(data, 's2dv_cube')) { - stop("Parameter 'data' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'data' must be of the class 's2dv_cube'.") } # Check object structure if (!all(c('data', 'attrs') %in% names(data))) { @@ -254,19 +253,19 @@ CST_SaveExp <- function(data, destination = "./", sdate_dim = 'sdate', #' #'@examples #'\dontrun{ -#'data <- lonlat_temp$exp$data -#'lon <- lonlat_temp$exp$coords$lon -#'lat <- lonlat_temp$exp$coords$lat +#'data <- lonlat_temp_st$exp$data +#'lon <- lonlat_temp_st$exp$coords$lon +#'lat <- lonlat_temp_st$exp$coords$lat #'coords <- list(lon = lon, lat = lat) -#'Datasets <- lonlat_temp$exp$attrs$Datasets +#'Datasets <- lonlat_temp_st$exp$attrs$Datasets #'varname <- 'tas' -#'Dates <- lonlat_temp$exp$attrs$Dates +#'Dates <- lonlat_temp_st$exp$attrs$Dates #'destination = './' -#'metadata <- lonlat_temp$exp$attrs$Variable$metadata +#'metadata <- lonlat_temp_st$exp$attrs$Variable$metadata #'SaveExp(data = data, destination = destination, coords = coords, #' Datasets = Datasets, varname = varname, Dates = Dates, #' metadata = metadata, single_file = TRUE, ftime_dim = 'ftime', -#' var_dim = NULL) +#' var_dim = 'var', dat_dim = 'dataset') #'} #' #'@import ncdf4 diff --git a/R/CST_SplitDim.R b/R/CST_SplitDim.R index 25d610da8ffb14fae278e7bc2ba559c12464b299..71f51bab4bdc27e7567241e9758c6a0e08d07937 100644 --- a/R/CST_SplitDim.R +++ b/R/CST_SplitDim.R @@ -57,8 +57,7 @@ CST_SplitDim <- function(data, split_dim = 'time', indices = NULL, insert_ftime = NULL) { # Check 's2dv_cube' if (!inherits(data, 's2dv_cube')) { - stop("Parameter 'data' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'data' must be of the class 's2dv_cube'.") } if (!is.null(insert_ftime)) { if (!is.numeric(insert_ftime)) { diff --git a/R/CST_WeatherRegimes.R b/R/CST_WeatherRegimes.R index 56783aebb44f8aaac9b282c403b7a52441e1af12..355a1d8bcb67d81ed61220a0567bf817f913b094 100644 --- a/R/CST_WeatherRegimes.R +++ b/R/CST_WeatherRegimes.R @@ -72,8 +72,7 @@ CST_WeatherRegimes <- function(data, ncenters = NULL, ncores = NULL) { # Check 's2dv_cube' if (!inherits(data, 's2dv_cube')) { - stop("Parameter 'data' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.") + stop("Parameter 'data' must be of the class 's2dv_cube'.") } # Check 'exp' object structure if (!all(c('data', 'coords') %in% names(data))) { diff --git a/R/as.s2dv_cube.R b/R/as.s2dv_cube.R index 75d6a6da8fbed42cda36f42af09af68c1d1c69b1..f81766ecdf376b340094ab19ceeaa2fa54b2cb5c 100644 --- a/R/as.s2dv_cube.R +++ b/R/as.s2dv_cube.R @@ -51,7 +51,7 @@ #' } #'} #' -#'@seealso \code{\link{s2dv_cube}}, \code{\link[s2dv]{Load}}, +#'@seealso \code{\link{s2dv_cube}}, \code{\link{CST_Start}}, #'\code{\link[startR]{Start}} and \code{\link{CST_Load}} #'@examples #'\dontrun{ diff --git a/R/print.s2dv_cube.R b/R/print.s2dv_cube.R index 2ad4186de4aebbc2d71e25ce768bdb42c356ac17..3cb0744ab88aad4b3cd404e07edceff07f93748a 100644 --- a/R/print.s2dv_cube.R +++ b/R/print.s2dv_cube.R @@ -13,9 +13,11 @@ #'information about the 's2dv_cube', see \code{s2dv_cube()} and #'\code{as.s2dv_cube()} functions. #' -#'@param x An 's2dv_cube' object +#'@param x An 's2dv_cube' object. +#'@param ... Additional arguments of print function. +#' #'@export -print.s2dv_cube <- function(x) { +print.s2dv_cube <- function(x, ...) { if (is.atomic(x)) { cat(x, "\n") } else { diff --git a/R/s2dv_cube.R b/R/s2dv_cube.R index f4e5be6689bc9f86cc4b55d4e37cf08bbc8b127b..6bf86a8cf406d9d44fe16424902b7cd9bfd1be60 100644 --- a/R/s2dv_cube.R +++ b/R/s2dv_cube.R @@ -2,7 +2,7 @@ #' #'@description This function allows to create an 's2dv_cube' object by passing #'information through its parameters. This function will be needed if the data -#'hasn't been loaded using CST_Load or has been transformed with other methods. +#'hasn't been loaded using CST_Start or has been transformed with other methods. #'An 's2dv_cube' object has many different components including metadata. This #'function will allow to create 's2dv_cube' objects even if not all elements #'are defined and for each expected missed parameter a warning message will be @@ -11,7 +11,7 @@ #'@author Perez-Zanon Nuria, \email{nuria.perez@bsc.es} #' #'@param data A multidimensional array with named dimensions, typically with -#' dimensions: dataset, member, sdate, ftime, lat and lon. +#' dimensions: dataset, member, sdate, time, lat and lon. #'@param coords A list of named vectors with the coordinates corresponding to #' the dimensions of the data parameter. If any coordinate has dimensions, they #' will be set as NULL. If any coordinate is not provided, it is set as an @@ -65,7 +65,7 @@ #' } #'} #' -#'@seealso \code{\link[s2dv]{Load}} and \code{\link{CST_Load}} +#'@seealso \code{\link[s2dv]{Load}} and \code{\link{CST_Start}} #'@examples #'exp_original <- 1:100 #'dim(exp_original) <- c(lat = 2, time = 10, lon = 5) diff --git a/man/Analogs.Rd b/man/Analogs.Rd index f5a89ae6dd9c740104a0fa51fdbf0bb8a4e60638..5b58ee004a2ca4a10f79919db60dfae648ba10b8 100644 --- a/man/Analogs.Rd +++ b/man/Analogs.Rd @@ -143,7 +143,7 @@ the selection of the best analogs in a short number of posibilities, the best ones. This function has not constrains of specific regions, variables to downscale, or data to be used (seasonal forecast data, climate projections data, reanalyses data). The regrid into a finner scale is done interpolating -with CST_Load. Then, this interpolation is corrected selecting the analogs in +with CST_Start. Then, this interpolation is corrected selecting the analogs in the large and local scale in based of the observations. The function is an adapted version of the method of Yiou et al 2013. } diff --git a/man/BiasCorrection.Rd b/man/BiasCorrection.Rd index fa087478548e9b9f6bff5ba7394f8bd00b0ca472..e2b86f997d47552722d7a30dbd5865b6d2c81354 100644 --- a/man/BiasCorrection.Rd +++ b/man/BiasCorrection.Rd @@ -60,9 +60,9 @@ standard deviation and mean to that of the reference dataset. } \examples{ mod1 <- 1 : (1 * 3 * 4 * 5 * 6 * 7) -dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, ftime = 5, lat = 6, lon = 7) +dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, time = 5, lat = 6, lon = 7) obs1 <- 1 : (1 * 1 * 4 * 5 * 6 * 7) -dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, ftime = 5, lat = 6, lon = 7) +dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, time = 5, lat = 6, lon = 7) a <- BiasCorrection(exp = mod1, obs = obs1) } \references{ diff --git a/man/CST_Analogs.Rd b/man/CST_Analogs.Rd index aa1e4d01f6de78254d474de98ed916f4818d181a..d837d70fb614b4ac424901738b9ffc9de3da4a51 100644 --- a/man/CST_Analogs.Rd +++ b/man/CST_Analogs.Rd @@ -124,7 +124,7 @@ analogs. This function has not constrains of specific regions, variables to downscale, or data to be used (seasonal forecast data, climate projections data, reanalyses data). The regrid into a finner scale is done interpolating with -CST_Load. Then, this interpolation is corrected selecting the analogs in the +CST_Start. Then, this interpolation is corrected selecting the analogs in the large and local scale in based of the observations. The function is an adapted version of the method of Yiou et al 2013. For an advanced search of Analogs (multiple Analogs, different criterias, further information from the @@ -161,8 +161,7 @@ from surface pressure using analogues. Clim. Dyn., 41, 1419-1437. \email{pascal.yiou@lsce.ipsl.fr} } \seealso{ -\code{\link{CST_Load}}, \code{\link[s2dv]{Load}} and -\code{\link[s2dv]{CDORemap}} +\code{\link{CST_Start}}, \code{\link[startR]{Start}} } \author{ M. Carmen Alvarez-Castro, \email{carmen.alvarez-castro@cmcc.it} diff --git a/man/CST_Anomaly.Rd b/man/CST_Anomaly.Rd index 8c037bfb12cab876d40d14a6671e8da3d96c45a0..ada952eed088a2c256bf136b32030a0aeb2810fd 100644 --- a/man/CST_Anomaly.Rd +++ b/man/CST_Anomaly.Rd @@ -86,7 +86,7 @@ anom <- CST_Anomaly(exp = exp, obs = obs, cross = FALSE, memb = TRUE) } \seealso{ \code{\link[s2dv]{Ano_CrossValid}}, \code{\link[s2dv]{Clim}} and -\code{\link{CST_Load}} +\code{\link{CST_Start}} } \author{ Perez-Zanon Nuria, \email{nuria.perez@bsc.es} diff --git a/man/CST_BiasCorrection.Rd b/man/CST_BiasCorrection.Rd index 4de9257784afa9affd1f9ca9f45b5f2425fe421b..c438d0614df6ae7e0d5b67613937fac1cb6229fb 100644 --- a/man/CST_BiasCorrection.Rd +++ b/man/CST_BiasCorrection.Rd @@ -16,16 +16,16 @@ CST_BiasCorrection( ) } \arguments{ -\item{exp}{An object of class \code{s2dv_cube} as returned by \code{CST_Load} +\item{exp}{An object of class \code{s2dv_cube} as returned by \code{CST_Start} function, containing the seasonal forecast experiment data in the element named \code{$data} with at least time and member dimensions.} -\item{obs}{An object of class \code{s2dv_cube} as returned by \code{CST_Load} +\item{obs}{An object of class \code{s2dv_cube} as returned by \code{CST_Start} function, containing the observed data in the element named \code{$data} with at least time dimension.} \item{exp_cor}{An object of class \code{s2dv_cube} as returned by -\code{CST_Load} function, containing the seasonal forecast experiment to be +\code{CST_Start} function, containing the seasonal forecast experiment to be corrected with at least time dimension. If it is NULL, the 'exp' forecast will be corrected. If there is only one corrected dataset, it should not have dataset dimension. If there is a corresponding corrected dataset for @@ -63,9 +63,9 @@ standard deviation and mean to that of the reference dataset. } \examples{ mod1 <- 1 : (1 * 3 * 4 * 5 * 6 * 7) -dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, ftime = 5, lat = 6, lon = 7) +dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, time = 5, lat = 6, lon = 7) obs1 <- 1 : (1 * 1 * 4 * 5 * 6 * 7) -dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, ftime = 5, lat = 6, lon = 7) +dim(obs1) <- c(dataset = 1, member = 1, sdate = 4, time = 5, lat = 6, lon = 7) lon <- seq(0, 30, 5) lat <- seq(0, 25, 5) coords <- list(lat = lat, lon = lon) diff --git a/man/CST_Calibration.Rd b/man/CST_Calibration.Rd index c8d1320f8e674f6c5d89ef9353c7a487010e94d8..491b727195638d98ef7f7a891825696fbbaa5f9e 100644 --- a/man/CST_Calibration.Rd +++ b/man/CST_Calibration.Rd @@ -22,18 +22,18 @@ CST_Calibration( ) } \arguments{ -\item{exp}{An object of class \code{s2dv_cube} as returned by \code{CST_Load} +\item{exp}{An object of class \code{s2dv_cube} as returned by \code{CST_Start} function with at least 'sdate' and 'member' dimensions, containing the seasonal hindcast experiment data in the element named \code{data}. The hindcast is used to calibrate the forecast in case the forecast is provided; if not, the same hindcast will be calibrated instead.} -\item{obs}{An object of class \code{s2dv_cube} as returned by \code{CST_Load} +\item{obs}{An object of class \code{s2dv_cube} as returned by \code{CST_Start} function with at least 'sdate' dimension, containing the observed data in the element named \code{$data}.} \item{exp_cor}{An optional object of class \code{s2dv_cube} as returned by -\code{CST_Load} function with at least 'sdate' and 'member' dimensions, +\code{CST_Start} function with at least 'sdate' and 'member' dimensions, containing the seasonal forecast experiment data in the element named \code{data}. If the forecast is provided, it will be calibrated using the hindcast and observations; if not, the hindcast will be calibrated instead. @@ -181,7 +181,7 @@ Quarterly Journal of the Royal Meteorological Society, 141(688), 807-818. \doi{10.1002/qj.2397} } \seealso{ -\code{\link{CST_Load}} +\code{\link{CST_Start}} } \author{ VerĂ³nica Torralba, \email{veronica.torralba@bsc.es} diff --git a/man/CST_SaveExp.Rd b/man/CST_SaveExp.Rd index 5dd125adee5b416cae680a76dc9aaabb668c3eef..9352e03604b75409efd9764194e12d43a11e7169 100644 --- a/man/CST_SaveExp.Rd +++ b/man/CST_SaveExp.Rd @@ -98,10 +98,10 @@ has been created from \code{CST_Load()}, then it can be reloaded with } \examples{ \dontrun{ -data <- lonlat_temp$exp +data <- lonlat_temp_st$exp destination <- "./" CST_SaveExp(data = data, destination = destination, ftime_dim = 'ftime', - var_dim = NULL, ftime_dim = 'ftime', var_dim = NULL) + var_dim = 'var', dat_dim = 'dataset') } } diff --git a/man/Calibration.Rd b/man/Calibration.Rd index b907326aafb8c44a9e773096afb6c5434997d0d4..1c9bb1b55b2714f4a50ca9a303439d7c476e7f47 100644 --- a/man/Calibration.Rd +++ b/man/Calibration.Rd @@ -151,7 +151,7 @@ Quarterly Journal of the Royal Meteorological Society, 141(688), 807-818. \doi{10.1002/qj.2397} } \seealso{ -\code{\link{CST_Load}} +\code{\link{CST_Start}} } \author{ VerĂ³nica Torralba, \email{veronica.torralba@bsc.es} diff --git a/man/SaveExp.Rd b/man/SaveExp.Rd index d9bac6f0e4fb18854f1d96aa3998529ae3d09a74..c690d97edf7d4aab44d38b529cf0fcaf86aeb8db 100644 --- a/man/SaveExp.Rd +++ b/man/SaveExp.Rd @@ -117,19 +117,19 @@ from StartR package. If the original 's2dv_cube' object has been created from } \examples{ \dontrun{ -data <- lonlat_temp$exp$data -lon <- lonlat_temp$exp$coords$lon -lat <- lonlat_temp$exp$coords$lat +data <- lonlat_temp_st$exp$data +lon <- lonlat_temp_st$exp$coords$lon +lat <- lonlat_temp_st$exp$coords$lat coords <- list(lon = lon, lat = lat) -Datasets <- lonlat_temp$exp$attrs$Datasets +Datasets <- lonlat_temp_st$exp$attrs$Datasets varname <- 'tas' -Dates <- lonlat_temp$exp$attrs$Dates +Dates <- lonlat_temp_st$exp$attrs$Dates destination = './' -metadata <- lonlat_temp$exp$attrs$Variable$metadata +metadata <- lonlat_temp_st$exp$attrs$Variable$metadata SaveExp(data = data, destination = destination, coords = coords, Datasets = Datasets, varname = varname, Dates = Dates, metadata = metadata, single_file = TRUE, ftime_dim = 'ftime', - var_dim = NULL) + var_dim = 'var', dat_dim = 'dataset') } } diff --git a/man/as.s2dv_cube.Rd b/man/as.s2dv_cube.Rd index 30f9abd40e6f2d9bd26143a4cc9d12a588d48d11..9d7bbde4f70c8e5f3ed69b2c3eec89d31c0b78ac 100644 --- a/man/as.s2dv_cube.Rd +++ b/man/as.s2dv_cube.Rd @@ -85,7 +85,7 @@ data <- as.s2dv_cube(data) } } \seealso{ -\code{\link{s2dv_cube}}, \code{\link[s2dv]{Load}}, +\code{\link{s2dv_cube}}, \code{\link{CST_Start}}, \code{\link[startR]{Start}} and \code{\link{CST_Load}} } \author{ diff --git a/man/print.s2dv_cube.Rd b/man/print.s2dv_cube.Rd index 3baca72472091e96d1ed8bedb12d7fbd28ffde4c..415e3f07f6b428558238634d040d3891e8c4ca61 100644 --- a/man/print.s2dv_cube.Rd +++ b/man/print.s2dv_cube.Rd @@ -4,10 +4,12 @@ \alias{print.s2dv_cube} \title{Print method for s2dv_cube objects} \usage{ -\method{print}{s2dv_cube}(x) +\method{print}{s2dv_cube}(x, ...) } \arguments{ -\item{x}{An 's2dv_cube' object} +\item{x}{An 's2dv_cube' object.} + +\item{...}{Additional arguments of print function.} } \description{ This is an S3 method of the generic 'print' for the class 's2dv_cube'. When diff --git a/man/s2dv_cube.Rd b/man/s2dv_cube.Rd index e17a460781b027e02e4fcf5b401a8c0ebbd7ddd6..53ba4acb0f0ad300d23aaccf0af16269ab893bc2 100644 --- a/man/s2dv_cube.Rd +++ b/man/s2dv_cube.Rd @@ -18,7 +18,7 @@ s2dv_cube( } \arguments{ \item{data}{A multidimensional array with named dimensions, typically with -dimensions: dataset, member, sdate, ftime, lat and lon.} +dimensions: dataset, member, sdate, time, lat and lon.} \item{coords}{A list of named vectors with the coordinates corresponding to the dimensions of the data parameter. If any coordinate has dimensions, they @@ -84,7 +84,7 @@ elements in the structure:\cr \description{ This function allows to create an 's2dv_cube' object by passing information through its parameters. This function will be needed if the data -hasn't been loaded using CST_Load or has been transformed with other methods. +hasn't been loaded using CST_Start or has been transformed with other methods. An 's2dv_cube' object has many different components including metadata. This function will allow to create 's2dv_cube' objects even if not all elements are defined and for each expected missed parameter a warning message will be @@ -134,7 +134,7 @@ exp8 <- s2dv_cube(data = exp_original, coords = coords, class(exp8) } \seealso{ -\code{\link[s2dv]{Load}} and \code{\link{CST_Load}} +\code{\link[s2dv]{Load}} and \code{\link{CST_Start}} } \author{ Perez-Zanon Nuria, \email{nuria.perez@bsc.es} diff --git a/tests/testthat/test-CST_Anomaly.R b/tests/testthat/test-CST_Anomaly.R index 69b548cbf6fcb95a70394dc5e6075c54c97352e3..8c9b149fe857a50e30b1486afc710729f9e27a66 100644 --- a/tests/testthat/test-CST_Anomaly.R +++ b/tests/testthat/test-CST_Anomaly.R @@ -49,7 +49,7 @@ test_that("1. Input checks", { # s2dv_cube expect_error( CST_Anomaly(exp = 1, obs = 1), - "Parameter 'exp' and 'obs' must be of the class 's2dv_cube', as output by CSTools::CST_Load." + "Parameter 'exp' and 'obs' must be of the class 's2dv_cube'." ) # exp and obs expect_error( diff --git a/tests/testthat/test-CST_MergeDims.R b/tests/testthat/test-CST_MergeDims.R index 0717a3064d595dc117326ee80be445884095b3cf..f7eac6acf5369988d1bdff0f0a38921810b8f215 100644 --- a/tests/testthat/test-CST_MergeDims.R +++ b/tests/testthat/test-CST_MergeDims.R @@ -3,8 +3,7 @@ test_that("Sanity checks", { expect_error( CST_MergeDims(data = 1), - paste0("Parameter 'data' must be of the class 's2dv_cube', ", - "as output by CSTools::CST_Load.")) + paste0("Parameter 'data' must be of the class 's2dv_cube'.")) data <- list(data = 1:10) class(data) <- 's2dv_cube' expect_error(