Hi @amanriqu
I have removed the cross-validation when computing anomalies. It seems that skill decrease. does it make sense?
Cross-validación: https://earth.bsc.es/gitlab/es/startR/-/blob/1c59b44a76868393e068e3496727b65602126864/inst/doc/figures/subseasonal_5.png
Without cross-validación: https://earth.bsc.es/gitlab/es/startR/-/blob/1c59b44a76868393e068e3496727b65602126864/inst/doc/figures/subseasonal_5_v2.png
Below you can find a test to check how I am calculating anomalies. I have also check the speed of two methods and chose the faster.
Let me know your opinion, please.
Cheers,
Núria
library(tictoc)
tic()
forecast <- array(1:24, c(sdate = 2, syear = 3, ensemble = 4))
reference <- array(101:106, c(sdate = 2, syear = 3))
reference <- s2dv::InsertDim(reference, pos = 3, len = 1, name = 'ensemble')
anomaly <- function(data) {
avg <- MeanDims(data, c('syear', 'ensemble'))
if (is.null(dim(avg))) {
dim(avg) <- c(sdate = length(avg))
}
data <- Apply(list(data, avg), 'sdate', function(x,y) x - y)[[1]]
return(data)
}
anomaly(reference)
anomaly(forecast)
toc()
tic()
hindcast <- array(1:24, c(sdate = 2, syear = 3, ensemble = 4))
reference <- array(101:106, c(sdate = 2, syear = 3))
reference <- s2dv::InsertDim(reference, pos = 3, len = 1, name = 'ensemble')
clim <- s2dv:::.Clim(hindcast, reference, time_dim = 'syear',
memb_dim = 'ensemble', memb = FALSE)
hindcast <- Ano(hindcast, clim$clim_exp)
reference <- Ano(reference, clim$clim_obs)
toc()