Newer
Older
# Usecase scripts
In this document, you can link to the example scripts for various demands. For the beginners, it is highly recommended to read the [practical guide](inst/doc/practical_guide.md) carefully first. You can find basic scripts and the configuration for different machines there.
1. [Interpolation in Start()](inst/doc/usecase/ex1_1_tranform.R)
Do the interpolation within Start(), and compare with Load() result. When the Start() parameter `transform_extra_cells = 2`, the two results will be the same.
2. [Load experimental and observational data with same dimension structure](inst/doc/usecase/ex1_2_exp_obs_attr.R)
This script tells you how to load experimental and observational data in a
consistent way, facilating the following comparison. In this case, experimental
data is one file per year, each file contains 12 months (time = 12). However,
observational data is one file per month, each file contains only one time step.
You can learn how to select all the required year and month for observation, and
tweak the dimension to make it consistent with experiment.
The highlight paramters used in this usecase are: **'*_across'**,
**'merge_across_dims'**, and **'split_multiselected_dims'**.
3. [Use experimental data attribute to load in oberservational data](inst/doc/usecase/ex1_3_attr_loadin.R)
Load the experimental data first (with `retrieve = FALSE`), then retreive its dates and time attributes to use in the observational data load-in. It also shows how to use parameters `xxx_tolerance`, `xxx_across`, `merge_across_dims`, `split_multiselected_dims`.
4. [Checking impact of start date order in the number of members](inst/doc/usecase/ex1_4_variable_nmember.R)
Mixing start dates of different months can lead to load different number of members, check the code provided and the [FAQ 10](/inst/doc/faq.md).
5. [Use reorder functions to get desired lat/lon region](inst/doc/usecase/ex1_5_latlon_reorder.R)
This script shows you how to use reorder function (`Sort()`, `CircularSort()`) to
get the desired longitude and latitude region. See [FAQ How-to-#11] (/inst/doc/faq.md#11-read-latitude-and-longitude-with-the-usage-of-parameter-xxx_reorder)
6. [Loading gridpoint data](inst/doc/usecase/ex1_6_gridpoint_data.R)
**Start** can be used to load single point data by providing a vector of longitudes and latitudes. This use case also ilustrates how to reformat it to get a 'gridpoint' dimension.
7. [Loading tas and tos from Decadal EC-Earth Simulations](inst/doc/usecase/ex1_7_tasandtos.R)
Some climate indices needs to be computed loading 'tas' (air temperature at 2m) over land and 'tos' (ocean surface temperature) over sea. Using **startR**, you can load these data in a unique **Start** call or with multiple separately for each variable.
2. **Execute computation (use `Compute()`)**
1. [Function working on time dimension](inst/doc/usecase/ex2_1_timedim.R)
2. [Function using attributes of the data](inst/doc/usecase/ex2_2_attr.R)
Using attributes is only available in startR_v0.1.3 or above.
3. [Use function CDORemap for interpolation](inst/doc/usecase/ex2_3_cdo.R)
Using parameter `CDO_module` is only available in startR_v0.1.3 or above. Interpolate data by using `s2dverification::CDORemap` in the workflow.
4. [Use two functions in workflow](inst/doc/usecase/ex2_4_two_func.R)
6. [Use external parameters in atomic function](inst/doc/usecase/ex2_6_ext_param_func.R)
7. [Calculate the ensemble-adjusted Continuous Ranked Probability Score (CRPS)](inst/doc/usecase/ex2_7_seasonal_forecast_crps.R)
Use `SpecsVerification::EnsCrps` to calculate the ensemble-adjusted Continuous Ranked Probability Score (CRPS) for ECWMF experimental data, and do ensemble mean. Use `s2dverification::PlotEquiMap` to plot the CRPS map.
8. [Use CSTools Calibration function](inst/doc/usecase/ex2_8_calibration.R)
Use `CSTools:::.cal`, the interior function of `CSTools::CST_Calibration`, to do the bias adjustment for ECMWF experimental monthly mean data.