Ano_CrossValid() and Clim(): Can the requirement for equal dimensions in exp and obs be removed?
Hi @aho,
Summary
Currently, Ano_CrossValid() and Clim() contain checks requiring exp
and obs
to meet the following requirement:
Parameter 'exp' and 'obs' must have the same dimensions except 'dat_dim'.
This is a problem for the use case where the anomalies have to be computed on exp and obs data in their respective original grids, which may have different lon and lat dimensions, for example when downscaling will be performed afterwards.
I have briefly reviewed the functions and it seems like the climatologies and anomalies for the experiment and the observations are computed separately and do not depend on each other, and for this reason, the requirement for exp and obs to have the same dimensions may be unnecessary. @eduzenli and @jramon will be reviewing the different anomaly computation methods individually to fully confirm this, or see if there is any specific method that requires the dimensions to be common, and will leave a comment with their conclusions.
On a similar note, we are wondering about the requirement to pass both exp and obs to the function. Although I understand that this may be because the focus of the package is verification, so usually both datasets will be present.
Example
library(s2dv)
# Mock data
exp <- rnorm(300)
dim(exp) <- c(dataset = 1, sdate = 3, ftime = 1, latitude = 10, longitude = 10, member = 1)
obs <- rnorm(7500)
dim(obs) <- c(dataset = 1, sdate = 3, ftime = 1, latitude = 50, longitude = 50, member = 1)
# Try to compute climatology
clim <- Clim(exp, obs)
## Error in Clim(exp, obs) :
## Parameter 'exp' and 'obs' must have the same dimensions except 'dat_dim'.
# Try to compute anomalies in cross-validation
ano <- Ano_CrossValid(exp, obs)
## Error in Ano_CrossValid(exp, obs) :
## Parameter 'exp' and 'obs' must have the same length of all dimensions except 'dat_dim'.
Module and Package Version
R version: R/4.1.2 s2dv version: 1.4.1
Please @eduzenli and @jramon, feel free to make corrections or add anything I may have forgotten.
Thanks,
Victòria