README.md 7.06 KB
Newer Older
Nicolau Manubens's avatar
Nicolau Manubens committed
s2dverification
===============

s2dverification (seasonal to decadal verification) is an R framework
that aids in the analysis of forecasts from the data retrieval stage,
through computation of statistics and skill scores against observations,
to visualisation of data and results. While some of its components are
only targeted to verification of seasonal to decadal climate forecasts,
it provides with tools that can be useful for verification of forecasts
in any field.

Find out more in the overview below, on the wiki page at
<https://earth.bsc.es/gitlab/es/s2dverification/wikis/home> or on the
CRAN website at
<https://cran.r-project.org/web/packages/s2dverification/index.html>.
You can also sign up to the s2dverification mailing list by sending a
message with the subject 'subscribe' to <s2dverification-request@bsc.es>
if you want to keep abreast of internal discussons or latest development
releases.

Installation
------------

s2dverification has a system dependency, the CDO libraries, for
interpolation of grid data and retrieval of metadata. Make sure you have
these libraries installed in the system or download and install from
<https://code.zmaw.de/projects/cdo>.
Nicolau Manubens's avatar
Nicolau Manubens committed
You can then install the released version of s2dverification from CRAN:
Nicolau Manubens's avatar
Nicolau Manubens committed

    install.packages("s2dverification")

Or the development version from the GitLab repository:

Nicolau Manubens's avatar
Nicolau Manubens committed
    # install.packages("devtools")
    devtools::install_git("https://earth.bsc.es/gitlab/es/s2dverification.git")

Overview
--------
Nicolau Manubens's avatar
Nicolau Manubens committed
The following diagram depicts the modules of s2dverification and how
they interact:
Nicolau Manubens's avatar
Nicolau Manubens committed

![s2dverification module diagram](vignettes/s2dv_modules.png)

Nicolau Manubens's avatar
Nicolau Manubens committed
The [Data
retrieval](https://earth.bsc.es/gitlab/es/s2dverification/wikis/data_retrieval.md)
module allows you to gather and homogenize NetCDF data files stored in a
local or remote file system. A previous step is required, however, to
set up some configuration parameters so that the module can locate the
source files and recognize their format.
Nicolau Manubens's avatar
Nicolau Manubens committed
Once the data has been loaded into an R object, [Basic
statistics](https://earth.bsc.es/gitlab/es/s2dverification/wikis/basic_statistics.md)
can be computed, such as climatologies, trends, bias correction,
smoothing, ...
Nicolau Manubens's avatar
Nicolau Manubens committed
Either after computing basic statistics or directly from the original
data, the functions in the
[Verification](https://earth.bsc.es/gitlab/es/s2dverification/wikis/verification.md)
module allow you to compute deterministic and probabilistic scores and
skill scores, such as root mean square error, time or spatial
correlation or brier score.
Nicolau Manubens's avatar
Nicolau Manubens committed
[Visualisation](https://earth.bsc.es/gitlab/es/s2dverification/wikis/visualisation.md)
functions are also provided to plot the results obtained from any of the
modules above.
Nicolau Manubens's avatar
Nicolau Manubens committed
Next you can see an example of usage of s2dverification spanning its
four modules.
Nicolau Manubens's avatar
Nicolau Manubens committed

### Data retrieval
Nicolau Manubens's avatar
Nicolau Manubens committed
    library(s2dverification, lib.loc = '~/s2dverification/s2dverification.Rcheck')
Nicolau Manubens's avatar
Nicolau Manubens committed

    expA <- list(name = 'experimentA',
                 path = file.path('/path/to/experiments/$EXP_NAME$/monthly_mean', 
                                  '$VAR_NAME$/$VAR_NAME$_$START_DATE$.nc'))
    expB <- list(name = 'experimentB',
                 path = file.path('/path/to/experiments/$EXP_NAME$/monthly_mean',
                                  '$VAR_NAME$/$VAR_NAME$_$START_DATE$.nc'))
    obsX <- list(name = 'observationX',
                 path = file.path('/path/to/observations/$OBS_NAME$/monthly_mean',
                                  '$VAR_NAME$/$VAR_NAME$_$YEAR$$MONTH$.nc'))
    data <- Load('tas', list(expA, expB), list(obsX),
                 sdates = c('19851101', '19911101', '19971101'),
                 lonmin = 100, lonmax = 250, latmin = -10, latmax = 60,
                 leadtimemin = 2, leadtimemax = 7,
                 output = 'lonlat', grid = 't106grid', 
                 method = 'distance-weighted')

    ## * The load call you issued is:
Nicolau Manubens's avatar
Nicolau Manubens committed
    ## *   Load(var = "tas", exp = list(list(name = "experimentA", ...),
    ## *        list(name = "experimentB", ...)), obs = list(list(name =
    ## *        "observationX", ...)), sdates = c("19851101", "19911101",
    ## *        "19971101"), grid = "t106grid", output = "lonlat",
    ## *        storefreq = "monthly", ...)
Nicolau Manubens's avatar
Nicolau Manubens committed
    ## * See the full call in '$load_parameters' after Load() finishes.
Nicolau Manubens's avatar
Nicolau Manubens committed
    ## * Fetching first experimental files to work out experimental array size...
Nicolau Manubens's avatar
Nicolau Manubens committed
    ## * Exploring dimensions... /path/to/experiments/experimentA/monthly_mean/tas/tas_19851101.nc 
    ## * Success. Detected dimensions of experimental data: 2, 3, 11, 6, 63, 134
Nicolau Manubens's avatar
Nicolau Manubens committed
    ## * Fetching first observational files to work out observational array size...
Nicolau Manubens's avatar
Nicolau Manubens committed
    ## * Exploring dimensions... /path/to/observations/observationX/monthly_mean/tas/tas_198512.nc 
    ## * Success. Detected dimensions of observational data: 1, 3, 1, 6, 63, 134
    ## * Will now proceed to read and process 24 data files:
    ## *   /path/to/experiments/experimentA/monthly_mean/tas/tas_19851101.nc
    ## *   /path/to/experiments/experimentA/monthly_mean/tas/tas_19911101.nc
    ## *   /path/to/experiments/experimentA/monthly_mean/tas/tas_19971101.nc
    ## *   /path/to/experiments/experimentB/monthly_mean/tas/tas_19851101.nc
    ## *   /path/to/experiments/experimentB/monthly_mean/tas/tas_19911101.nc
    ## *   /path/to/experiments/experimentB/monthly_mean/tas/tas_19971101.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_198512.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_198601.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_198602.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_198603.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_198604.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_198605.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199112.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199201.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199202.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199203.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199204.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199205.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199712.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199801.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199802.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199803.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199804.nc
    ## *   /path/to/observations/observationX/monthly_mean/tas/tas_199805.nc
    ## * Total size of requested data:  27959904 bytes.
    ## *   - Experimental data:  ( 2 x 11 x 3 x 6 x 63 x 134 ) x 8 bytes = 26744256 bytes.
    ## *   - Observational data: ( 1 x 1 x 3 x 6 x 63 x 134 ) x 8 bytes = 1215648 bytes.
    ## * If size of requested data is close to or above the free shared RAM memory, R will crash.
    ## * Loading... This may take several minutes...
Nicolau Manubens's avatar
Nicolau Manubens committed
    ## * Progress: 0% + 33.33% + 33.33% + 33.33%
Nicolau Manubens's avatar
Nicolau Manubens committed

### Basic statistics

### Verification

### Visualisation