CST_QuantileMapping: Quantile Mapping for seasonal or decadal forecast data

View source: R/CST_QuantileMapping.R

CST_QuantileMappingR Documentation

Quantile Mapping for seasonal or decadal forecast data

Description

This function is a wrapper of fitQmap and doQmap from package 'qmap' to be applied on the object of class 's2dv_cube'. The quantile mapping adjustment between an experiment, typically a hindcast, and observation is applied to the experiment itself or to a provided forecast.

Usage

CST_QuantileMapping(
  exp,
  obs,
  exp_cor = NULL,
  sdate_dim = "sdate",
  memb_dim = "member",
  window_dim = NULL,
  method = "QUANT",
  na.rm = FALSE,
  eval.method = "leave-k-out",
  k = 1,
  ncores = NULL,
  ...
)

Arguments

exp

An object of class s2dv_cube.

obs

An object of class s2dv_cube.

exp_cor

A multidimensional array with named dimensions in which the quantile mapping correction should be applied. If it is not specified, the correction is applied to object 'exp' using leave-one-out cross-validation. This is useful to correct a forecast when the hindcast is provided in parameter 'exp'.

sdate_dim

A character string indicating the dimension name in which cross-validation would be applied when exp_cor is not provided. 'sdate' by default.

memb_dim

A character string indicating the dimension name where ensemble members are stored in the experimental arrays. It can be NULL if there is no ensemble member dimension. It is set as 'member' by default.

window_dim

A character string indicating the dimension name in which extra samples are stored. This dimension is joined to the 'member' dimension. This is useful to correct daily data, for which robust statistics can be obtained by creating a window of dates around the target date.

method

A character string indicating the method to be used:'PTF', 'DIST', 'RQUANT', 'QUANT', 'SSPLIN'. By default, the empirical quantile mapping 'QUANT' is used.

na.rm

A logical value indicating if missing values should be removed (FALSE by default).

eval.method

A character string indicating the evaluation method for cross-validaton. the default method is 'leave-k-out', other available methods are 'retrospective', 'in-sample', 'hindcast-vs-forecast'.

k

Positive integer. Default = 1. In method leave-k-out, k is expected to be odd integer, indicating the number of points to leave out. In method retrospective, k can be any positive integer greater than 1, indicating when to start.

ncores

An integer indicating the number of cores for parallel computation using multiApply function. The default value is NULL (1).

...

Additional parameters to be used by the method choosen. See qmap package for details.

Value

An object of class s2dv_cube containing the experimental data after applying the quantile mapping correction.

Author(s)

Nuria Perez-Zanon, nuria.perez@bsc.es

See Also

fitQmap and doQmap

Examples

# Use synthetic data
exp <- NULL
exp$data <- 1 : c(1 * 3 * 5 * 4 * 3 * 2)
dim(exp$data) <- c(dataset = 1, member = 3, sdate = 5, ftime = 4,
                  lat = 3, lon = 2)
class(exp) <- 's2dv_cube'
obs <- NULL
obs$data <- 101 : c(100 + 1 * 1 * 5 * 4 * 3 * 2)
dim(obs$data) <- c(dataset = 1, member = 1, sdate = 5, ftime = 4,
                  lat = 3, lon = 2)
class(obs) <- 's2dv_cube'
res <- CST_QuantileMapping(exp, obs)


CSTools documentation built on Nov. 14, 2025, 5:07 p.m.