Data retrieval
==============
One of the strong points of s2dverification is its data retrieval module.  
`Load()` is the interface function to this module. Through it you can request 
global mean or 2-dimensional variables from as many experimental and 
observational multi-member datasets as needed, at the selected starting dates 
and leadtimes, over any Earth surface region of interest.

`Load()` automatically fetches the experimental and date-corresponding 
observational data, homogenizes and loads it into an R object, a potentially
time-consuming task that can turn into a first hurdle in the verification 
process if done manually.

The homogenization step carries out the following steps:
  - Regridding data. `Load()` relies on CDO tools for this task (see 
[Installation](https://earth.bsc.es/gitlab/es/s2dverification/blob/master/README.md)).
  - Applying masks to disable certain grid cells.
  - Disabling values beyond certain limits.
  - Computing latitude-weighted area averages.

The 1st, 2nd and 4th steps only apply if loading 2-dimensional variables.

Aside from the CDO dependency, there are some guidelines that must be 
accomplished for `Load()` to recognize the data files:
  - Data must be in NetCDF 3/4 local or remote files or indexed in NCML 
catalogs on THREDDS servers.
  - The only supported source (and target) grids are regular and gaussian grids 
(those definable with the CDO grid names following the patterns 'r<NX>x<NY>' 
or 't<RES>grid').
  - The variable of interest must be defined over the dimensions (time) or 
(time, members) if is a global means time-series, or (time, latitudes, 
longitudes) or (time, members, latitudes, longitudes) if is 2-dimensional 
data. These dimensions can be named at will and can be in any order. The less 
time-consuming order to load is, however, (time, members, latitudes, 
longitudes).
  - If the data is 2-dimensional, a variable with the grid latitudes and a 
variable with the grid longitudes must be defined, with the same name as their
corresponding dimension.
  - The files of an experimental dataset must be distributed in either of the 
following two ways:
    - File per starting date: each file must contain the starting date 
somewhere in its path.
    - File per starting date per member: each file must contain the the 
starting date\* and the member number\** somewhere in its path.
  - The files of an observational dataset must be distributed in either of the
following three ways:
    - File per month: each file must contain the year and month\*** somewhere 
in its path.
    - File per month per member: each file must contain the member 
number\** and the year and month\*** somewhere in its path.
    - Single file: the time axis must be properly defined to work with
`cdo showmon` and `cdo showyear`.

\*: starting dates in the format YYYYMMDD.  
\**: member number, from 0 to NMemb - 1, with as many preceding 0s as needed 
to reach the needed number of digits to represent NMemb - 1.  
\***: year in the format YYYY and month in the format MM.  


