diff --git a/R/RPSS.R b/R/RPSS.R index 76c0dba37b5267017829a1ab9a8aa8bd80897758..5c7006c31ff155049d9c09ae09dfb123546acf7d 100644 --- a/R/RPSS.R +++ b/R/RPSS.R @@ -50,7 +50,12 @@ #' The default value is NULL. #'@param prob_thresholds A numeric vector of the relative thresholds (from 0 to #' 1) between the categories. The default value is c(1/3, 2/3), which -#' corresponds to tercile equiprobable categories. +#' corresponds to tercile equiprobable categories. When the inputs are +#' ensemble members ('cat_dim' is NULL), these thresholds are used to compute +#' category probabilities. If 'ref' is NULL, the thresholds are also used to +#' compute the reference forecast ('clim_probs'), even when 'exp' and 'obs' are +#' already given as probabilities. If 'ref' is provided and the inputs are +#' probabilities, 'prob_thresholds' is ignored. #'@param indices_for_clim A vector of the indices to be taken along 'time_dim' #' for computing the thresholds between the probabilistic categories. If NULL, #' the whole period is used. The default value is NULL. @@ -252,9 +257,11 @@ RPSS <- function(exp, obs, ref = NULL, time_dim = 'sdate', memb_dim = 'member', } } ## prob_thresholds - if (!is.numeric(prob_thresholds) | !is.vector(prob_thresholds) | - any(prob_thresholds <= 0) | any(prob_thresholds >= 1)) { - stop("Parameter 'prob_thresholds' must be a numeric vector between 0 and 1.") + if (is.null(cat_dim) || (!is.null(cat_dim) && is.null(ref))) { + if (!is.numeric(prob_thresholds) | !is.vector(prob_thresholds) | + any(prob_thresholds <= 0) | any(prob_thresholds >= 1)) { + stop("Parameter 'prob_thresholds' must be a numeric vector between 0 and 1.") + } } ## indices_for_clim if (is.null(indices_for_clim)) {