From ea5deede742034c66a39c476a8f7351ca1371c67 Mon Sep 17 00:00:00 2001 From: vagudets Date: Mon, 11 Mar 2024 09:30:59 +0100 Subject: [PATCH] Modify NAO dimension check --- R/NAO.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/NAO.R b/R/NAO.R index 5586985..7573105 100644 --- a/R/NAO.R +++ b/R/NAO.R @@ -171,12 +171,12 @@ NAO <- function(exp = NULL, obs = NULL, lat, lon, time_dim = 'sdate', if (!is.character(ftime_dim) | length(ftime_dim) > 1) { stop("Parameter 'ftime_dim' must be a character string.") } - if (!is.null(exp)) { + if (!is.null(exp) && !is.null(ftime_avg)) { if (!ftime_dim %in% names(dim(exp))) { stop("Parameter 'ftime_dim' is not found in 'exp' or 'obs' dimension.") } } - if (!is.null(obs)) { + if (!is.null(obs) && !is.null(ftime_avg)) { if (!ftime_dim %in% names(dim(obs))) { stop("Parameter 'ftime_dim' is not found in 'exp' or 'obs' dimension.") } -- GitLab