diff --git a/R/NAO.R b/R/NAO.R index 5586985e20add9ee9e1026d477001293b4af68d9..75731055c83d9330ca1b5b67056d3a1025856690 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.") }