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 region of interest of the Earth surface.

`Load()` automatically fetches the starting dates of the requested 
experimental datasets and the date-corresponding observational data, 
homogenizes it and loads it into an R object. If done manually, this task can 
be time-consuming and become a hurdle in the verification process.

The homogenization consists of 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 thresholds.
  - Computing latitude-weighted area averages.

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

There are some guidelines that the files of the datasets must follow so that 
`Load()` is able to recognize, fetch and process them:
>  - Data files must be in NetCDF 3/4 local or remote files or indexed in NCML 
>catalogs provided by THREDDS servers.
>  - The only supported source (and target) grids are regular and gaussian grids 
>(those definable with the CDO grid names that follow the patterns 'r<NX>x<NY>' 
>or 't<RES>grid').
>  - The variable of interest must be defined over the dimensions 
>(time[, members]) if is a global means time-series or (time[, members], 
>latitudes, longitudes) if is a 2-dimensional field. These dimensions 
>can be named at will and can be in any order. The less time-consuming orders 
>to load are, however, (time[, members]) or (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 total_number_of_members - 1, with as many 
>preceding 0s as needed to reach the needed number of digits to represent 
>total_number_of_members - 1.  
>\*\*\*: year in the format YYYY and month in the format MM.  


