Criterion for NAs
This is not urgent, but @nperez and I think it could be an useful development for the future.
Sometimes we want to exclude the NA values for skill metrics computation, and other times we want the functions to return NA if there are NAs in the data. One intermediate option is to compute the skill metrics if the fraction of available data (i.e. fraction of no-NA values) is above a threshold.
I developed a few lines for this some time ago. I'm pasting them here for the future:
# compute skill if there are less than 40% NAs in the data
f_NAs <- 0.4
good_values <- !is.na(exp) & !is.na(obs)
if (f_NAs <= sum(good_values)/length(obs)){
exp <- exp[good_values]
obs <- obs[good_values]
skill <- ...
} else {
skill <- NA
}
Best regards,
Carlos