CRPSS failing to deal with Nans
Hi @cdelgado ,
The s2dv::CRPSS function works with subseasonal data but there are many missing years in the subseasonal hindcast (NCEP-CFSv2), which give nan and is translated into an all-Nan array as the output of CRPSS.
First we added a line from the RPS function to select only those rows when both the obs and the hcst have values (complete pairs)
exp_mean <- rowMeans(exp_data)
obs_mean <- rowMeans(obs_data)
good_values <- !is.na(exp_mean) & !is.na(obs_mean)
if (isTRUE(na.rm)) {
f_NAs <- 0
} else if (isFALSE(na.rm)) {
f_NAs <- 1
} else {
f_NAs <- na.rm
}
if (f_NAs <= sum(good_values) / length(obs_mean)) {
exp_data <- exp_data[good_values, , drop = F]
obs_data <- obs_data[good_values, , drop = F]
But there seems to be more issues with the structure of the function (some commands that should be outside the function are inside). Could you please have a look at it? I can test any changes. Many thanks!!
Cheers,
Paloma