Expert review of Corr() function
Dear @jacosta,
I hope you are doing well.
As you may know from issue #16 (closed), we are planning a release of s2dv, so, it is an opportunity to correct Corr()
function in case it was necessary.
We noticed that the version of Corr() in s2dverification cannot work with dimension 'member':
The input should be an array with dimensions c(no. of datasets, no. of start dates, no. of forecast times, no. of lons, no. of lats.)
So, the user should compute the ensemble mean first, and then use Corr.
In s2dv, the names of the parameters have changed:
- s2dverification 'poscor' is s2dv 'time_dim': since usually, the correlation is computed in time series
- s2dverification 'posloop' is s2dv 'memb_dim' in the current version. However, this is wrong if 'member' dimension is not allowed, therefore, in the next release, this pareameter will be renamed to 'data_dim' since 'dataset' dimension is the one that could have different length between exp and obs.
We would like to confirm if these names are reasonable for you.
On the other hand, I personally wonder if this function should be able to handle individual members. Would it make any sense to get the correlation for each member of the ensemble?
To facilitate you the review of the function, I provide you some lines for running the functions, but please, don't hesitate to create your own tests.
Please, if you think you cannot do this review in the short-term, please, let us know.
Thanks in advance,
Núria
exp <- CSTools::lonlat_data$exp$data
obs <- CSTools::lonlat_data$obs$data
exp <- abind::abind(exp, exp, along = 1)
names(dim(exp)) <- names(dim(obs))
exp <- s2dv::MeanDims(exp, 'member')
dim(obs) <- dim(obs)[-2]
s2dv_cor <- s2dv::Corr(exp, obs, memb_dim = 'dataset')
cor <- s2dverification::Corr(exp, obs, posloop = 1)
all(s2dv_cor$corr[,1,,,] == cor[,,2,,,])