Learn R Programming

s2dv (version 0.0.1)

Clim: Compute Bias Corrected Climatologies

Description

This function computes per-pair climatologies for the experimental and observational data using one of the following methods:

  1. per-pair method (Garcia-Serrano and Doblas-Reyes, CD, 2012)

  2. Kharin method (Karin et al, GRL, 2012)

  3. Fuckar method (Fuckar et al, GRL, 2014)

Per-pair climatology means that only the startdates covered by the whole experiments/observational dataset will be used. In other words, the startdates which are not all available along 'dat_dim' dimension of both the 'exp' and 'obs' are excluded when computing the climatologies.

Usage

Clim(exp, obs, time_dim = "sdate", dat_dim = c("dataset", "member"),
  method = "clim", ftime_dim = "ftime", memb_dim = "member",
  memb = TRUE, na.rm = TRUE, ncores = NULL)

Arguments

exp

A named numeric array of experimental data, with at least two dimensions 'time_dim' and 'dat_dim'.

obs

A named numeric array of observational data, same dimensions as parameter 'exp' except along 'dat_dim'.

time_dim

A character string indicating the name of dimension along which the climatologies are computed. The default value is 'sdate'.

dat_dim

A character vector indicating the name of the dataset and member dimensions. If data at one startdate (i.e., 'time_dim') are not complete along 'dat_dim', this startdate along 'dat_dim' will be discarded. The default value is "c('dataset', 'member')".

method

A character string indicating the method to be used. The options include 'clim', 'kharin', and 'NDV'. The default value is 'clim'.

ftime_dim

A character string indicating the name of forecast time dimension. Only used when method = 'NDV'. The default value is 'ftime'.

memb_dim

A character string indicating the name of the member dimension. Only used when parameter 'memb' is FALSE. It must be one element in 'dat_dim'. The default value is 'member'.

memb

A logical value indicating whether to remain 'memb_dim' dimension (TRUE) or do ensemble mean over 'memb_dim' (FALSE). The default value is TRUE.

na.rm

A logical value indicating whether to remove NA values along 'time_dim' when calculating climatology (TRUE) or return NA if there is NA along 'time_dim' (FALSE). The default value is TRUE.

ncores

An integer indicating the number of cores to use for parallel computation. The default value is NULL.

Value

A list of 2:

$clim_exp

A numeric array with the same dimensions as parameter 'exp' but dimension 'time_dim' is moved to the first position. If parameter 'method' is 'clim', dimension 'time_dim' is removed. If parameter 'memb' is FALSE, dimension 'memb_dim' is also removed.

$clim_obs

A numeric array with the same dimensions as parameter 'exp' except dimension 'time_dim' is removed. If parameter 'memb' is FALSE, dimension 'memb_dim' is also removed.

Examples

Run this code
# NOT RUN {
# Load sample data as in Load() example:
example(Load)
clim <- Clim(sampleData$mod, sampleData$obs)
clim2 <- Clim(sampleData$mod, sampleData$obs, method = 'kharin', memb = FALSE)
# }

Run the code above in your browser using DataLab