diff --git a/R/Analogs.R b/R/Analogs.R index 062425faddf7bb068e1c7058db0ddae32dd79b14..73b76ae56cd114536a07ec410e172b09e33b3067 100644 --- a/R/Analogs.R +++ b/R/Analogs.R @@ -545,6 +545,10 @@ Analogs <- function(exp, obs, exp_lats = NULL, exp_lons = NULL, obs_lats, obs_lo if (all(is.na(test))) { res <- array(NA, space_dims_hres) + res_ind <- array(NA, k) + names(dim(res_ind)) <- c("index") + res_metric <- array(NA, k) + names(dim(res_metric)) <- c("metric") } else { if (metric == "dist") { dist_all <- sqrt(rowSums((sweep(tr_wo_na, 2, te_wo_na[1,]))^2)) # euc dist @@ -587,8 +591,8 @@ Analogs <- function(exp, obs, exp_lats = NULL, exp_lons = NULL, obs_lats, obs_lo res <- apply(res, c(1,2), fun_analog) } } - return(list(res, res_ind, res_metric)) } + return(list(res, res_ind, res_metric)) } # Add the dimension window to an array that contains, at least, the start date and time