Corr() working without member dim and multiple datasets
Hi @aho,
As you may know, I want to change some functions from CSTools using s2dverification functions, to use s2dv, so, these functions would be able to work with any number of dimensions and in any order.
I have started with CST_MultiMetric because I want to add a new metric after transforming it to use s2dv.
Step by step: the function computes the mean in 'ftime' and 'member', easy step from MeanListDim to MeanDims:
mod <- 1 : (2 * 3 * 4 * 5 * 6 * 7)
dim(mod) <- c(dataset = 2, member = 3, sdate = 4, ftime = 5, lat = 6, lon = 7)
obs <- 1 : (1 * 1 * 4 * 5 * 6 * 7)
dim(obs) <- c(dataset = 1, member = 1, sdate = 4, ftime = 5, lat = 6, lon = 7)
AvgExp <- s2dverification::MeanListDim(exp$data, narm = T, c(2, 4))
AvgObs <- s2dverification::MeanListDim(obs$data, narm = T, c(2, 4))
AvgExp_new <- s2dv::MeanDims(exp$data, c('member', 'ftime'), na.rm = TRUE)
AvgObs_new <- s2dv::MeanDims(obs$data, c('member', 'ftime'), na.rm = TRUE)
Now, there is no 'member' dimension: dataset = 1, sdate = 4, lat = 6, lon = 7 This is not a problem for s2dverification function, while s2dv requires 'member' dim:
corr <- Corr(AvgExp, AvgObs, posloop = 1, poscor = 2)
corr_new <- Corr(AvgExp_new, AvgObs_new, time_dim = 'sdate') #fails
I have checked what happens if I don't compute the mean in 'member' dimension, so, AvgExp/Obs have dataset member sdate lat lon
dimensions. In this case, s2dv::Corr complains with the same error:
Parameter 'exp' and 'obs' must have same length of all dimension expect 'memb_dim'.
Since, I have 2 experimental datasets, how can I indicate 'posloop' to the new s2dv::Corr function?
I understand that, if there is no 'member' dim, there is no need to use s2dv::Corr, right? Maybe we can add a comment in details:
If you are not using several members from an ensemble of simulations, you can directly use... Well, this is not very important.
Thanks in advance,
Núria