From 76ebe11cbea77876b4c15b971f3331aedc9d8371 Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Thu, 19 Jun 2025 12:07:49 +0200 Subject: [PATCH] Add warning for 'prob_thresholds' default value in RPSS.R --- R/RPSS.R | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/R/RPSS.R b/R/RPSS.R index 5c7006c..62730d9 100644 --- a/R/RPSS.R +++ b/R/RPSS.R @@ -262,6 +262,22 @@ RPSS <- function(exp, obs, ref = NULL, time_dim = 'sdate', memb_dim = 'member', any(prob_thresholds <= 0) | any(prob_thresholds >= 1)) { stop("Parameter 'prob_thresholds' must be a numeric vector between 0 and 1.") } + if (missing(prob_thresholds)) { + if (is.null(cat_dim) && is.null(ref)) { + .warning("Parameter 'prob_thresholds' is not provided. Default value c(1/3, 2/3) is used.\n", + "Since the inputs are ensemble members (i.e., 'cat_dim' is NULL) and no reference ", + "forecast is provided, this default will be used both to compute category ", + "probabilities and the reference climatology.") + } else if (is.null(cat_dim) && !is.null(ref)) { + .warning("Parameter 'prob_thresholds' is not provided. Default value c(1/3, 2/3) is used.\n", + "Since the inputs are ensemble members (i.e., 'cat_dim' is NULL), this default will ", + "be used to compute category probabilities.") + } else { # if (!is.null(cat_dim) && is.null(ref)) + .warning("Parameter 'prob_thresholds' is not provided. Default value c(1/3, 2/3) is used.\n", + "Since no reference forecast is provided, this default will be used to compute ", + "the reference climatology.") + } + } } ## indices_for_clim if (is.null(indices_for_clim)) { -- GitLab