diff --git a/NAMESPACE b/NAMESPACE index bd5d0f1649b1d8529ffb6d16118bc8c87ec186ab..a319f567d56eaff446cd2a706ab118a5bae1ae17 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,6 +21,7 @@ export(CST_RFWeights) export(CST_RainFARM) export(CST_SaveExp) export(CST_SplitDim) +export(Calibration) export(EnsClustering) export(MergeDims) export(MultiEOF) diff --git a/NEWS.md b/NEWS.md index 04f986fb49d99cddcb1a5d19837fbbf69f24b556..3a846b1f540b837dd1b03feac2f1eaea5ef13d7a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,8 @@ - Fixes + CST_Anomaly handles exp, obs or both - + PlotForecastPDF vignette displays figures correctly. + + PlotForecastPDF vignette displays figures correctly + + Calibration function is exposed to users ### CSTools 3.0.0 diff --git a/R/CST_Calibration.R b/R/CST_Calibration.R index a7f1924b208663909a774c94e0096f2e3d824428..ca29039764d5cbe108f1c340cf9188963972141e 100644 --- a/R/CST_Calibration.R +++ b/R/CST_Calibration.R @@ -34,12 +34,9 @@ #'str(a) #'@export -CST_Calibration <- function(exp, obs, - cal.method = "mse_min", - eval.method = "leave-one-out", - multi.model = F, - na.fill = T, - ncores = 1) { +CST_Calibration <- function(exp, obs, cal.method = "mse_min", + eval.method = "leave-one-out", multi.model = FALSE, + na.fill = TRUE, ncores = 1) { 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.") @@ -92,13 +89,16 @@ CST_Calibration <- function(exp, obs, #' #'@seealso \code{\link{CST_Load}} #' - -Calibration <- function(exp, obs, - cal.method = "mse_min", - eval.method = "leave-one-out", - multi.model = F, - na.fill = T, - ncores = 1) { +#'@examples +#'mod1 <- 1 : (1 * 3 * 4 * 5 * 6 * 7) +#'dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, ftime = 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) +#'a <- Calibration(exp = mod1, obs = obs1) +#'str(a) +#'@export +Calibration <- function(exp, obs, cal.method = "mse_min", eval.method = "leave-one-out", + multi.model = FALSE, na.fill = TRUE, ncores = 1) { dim.exp <- dim(exp) amt.dims.exp <- length(dim.exp) diff --git a/man/CST_Calibration.Rd b/man/CST_Calibration.Rd index 891e2e5fc10fb6751d4e0a6b08cd5b71232a0ed4..76812a438ce7f4cd0b42975e7feef911d6f9b48c 100644 --- a/man/CST_Calibration.Rd +++ b/man/CST_Calibration.Rd @@ -9,8 +9,8 @@ CST_Calibration( obs, cal.method = "mse_min", eval.method = "leave-one-out", - multi.model = F, - na.fill = T, + multi.model = FALSE, + na.fill = TRUE, ncores = 1 ) } diff --git a/man/Calibration.Rd b/man/Calibration.Rd index 9f884671ebb4bdf6b6412a5f56c2f7a28df3b603..64452279fce1be4719bcdfdaa18864398fd01ee2 100644 --- a/man/Calibration.Rd +++ b/man/Calibration.Rd @@ -9,8 +9,8 @@ Calibration( obs, cal.method = "mse_min", eval.method = "leave-one-out", - multi.model = F, - na.fill = T, + multi.model = FALSE, + na.fill = TRUE, ncores = 1 ) } @@ -37,6 +37,14 @@ Four types of member-by-member bias correction can be performed. The \code{bias} Both in-sample or our out-of-sample (leave-one-out cross validation) calibration are possible. } +\examples{ +mod1 <- 1 : (1 * 3 * 4 * 5 * 6 * 7) +dim(mod1) <- c(dataset = 1, member = 3, sdate = 4, ftime = 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) +a <- Calibration(exp = mod1, obs = obs1) +str(a) +} \references{ Doblas-Reyes F.J, Hagedorn R, Palmer T.N. The rationale behind the success of multi-model ensembles in seasonal forecasting-II calibration and combination. Tellus A. 2005;57:234-252. doi:10.1111/j.1600-0870.2005.00104.x