CST_QuantileMapping {CSTools} | R Documentation |

This function is a wrapper from fitQmap and doQmap from package 'qmap'to be applied in CSTools objects of class 's2dv_cube'. The quantile mapping adjustment between an experiment, tipically a hindcast, and observations is applied to the experiment itself or to a provided forecast.

CST_QuantileMapping( exp, obs, exp_cor = NULL, sample_dims = c("sdate", "ftime", "member"), sample_length = NULL, method = "QUANT", ncores = NULL, ... )

`exp` |
an object of class |

`obs` |
an object of class |

`exp_cor` |
an object of class |

`sample_dims` |
a character vector indicating the dimensions that can be used as sample for the same distribution |

`sample_length` |
a numeric value indicating the length of the timeseries window to be used as sample for the sample distribution and correction. By default, NULL, the total length of the timeseries will be used. |

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

`ncores` |
an integer indicating the number of parallel processes to spawn for the use for parallel computation in multiple cores. |

`...` |
additional arguments passed to the method specified by |

The different methods are:

'PTF' fits a parametric transformations to the quantile-quantile relation of observed and modelled values. See

`?qmap::fitQmapPTF`

.'DIST' fits a theoretical distribution to observed and to modelled time series. See

`?qmap::fitQmapDIST`

.'RQUANT' estimates the values of the quantile-quantile relation of observed and modelled time series for regularly spaced quantiles using local linear least square regression. See

`?qmap::fitQmapRQUANT`

.'QUANT' estimates values of the empirical cumulative distribution function of observed and modelled time series for regularly spaced quantiles. See

`?qmap::fitQmapQUANT`

.'SSPLIN' fits a smoothing spline to the quantile-quantile plot of observed and modelled time series. See

`?qmap::fitQmapSSPLIN`

.

All methods accepts some common arguments:

wet.day logical indicating whether to perform wet day correction or not.(Not available in 'DIS' method)

qstep NULL or a numeric value between 0 and 1.

When providing a forecast to be corrected through the pararmeter `exp_cor`

, some inputs might need to be modified. The quantile correction is compute by comparing objects passed through 'exp' and 'obs' parameters, this correction will be later applied to the forecast provided in 'exp_cor'. Imaging the case of 'exp' and 'obs' having several start dates, stored using a dimension e.g. 'sdate', 'sample_dims' include this dimension 'sdate' and 'exp_cor' has forecasts for several sdates but different from the ones in 'exp'. In this case, the correction computed with 'exp' and 'obs' would be applied for each 'sdate' of 'exp_cor' separately. This example corresponds to a case of split a dataset in training set and validation set.

an oject of class `s2dv_cube`

containing the experimental data after applyingthe quantile mapping correction.
) <- c(dataset = 1, member = 10, sdate = 20, ftime = 60 ,

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

`qmap::fitQmap`

and `qmap::doQmap`

library(qmap) exp <- 1 : (1 * 5 * 10 * 6 * 2 * 3) dim(exp) <- c(dataset = 1, member = 10, sdate = 5, ftime = 6 , lat = 2, lon = 3) exp <- list(data = exp) class(exp) <- 's2dv_cube' obs <- 101 : (100 + 1 * 1 * 5 * 6 * 2 * 3) dim(obs) <- c(dataset = 1, member = 1, sdate = 5, ftime = 6 , lat = 2, lon = 3) obs <- list(data = obs) class(obs) <- 's2dv_cube' res <- CST_QuantileMapping(exp, obs, method = 'RQUANT') exp <- lonlat_data$exp obs <- lonlat_data$obs res <- CST_QuantileMapping(exp, obs) exp_cor <- exp exp_cor$data <- exp_cor$data[,,1,,,] dim(exp_cor$data) <- c(dataset = 1, member = 15, sdate = 1, ftime = 3, lat = 22, lon = 53) res <- CST_QuantileMapping(exp, obs, exp_cor, sample_dims = c('sdate', 'ftime', 'member')) res <- CST_QuantileMapping(exp, obs, exp_cor, sample_dims = c('ftime', 'member')) data(obsprecip) data(modprecip) exp <- modprecip$MOSS[1:10000] dim(exp) <- c(time = length(exp)) exp <- list(data = exp) class(exp) <- 's2dv_cube' obs <- obsprecip$MOSS[1:10000] dim(obs) <- c(time = length(obs)) obs <- list(data = obs) class(obs) <- 's2dv_cube' res <- CST_QuantileMapping(exp = exp, obs = obs, sample_dims = 'time', method = 'DIST') # Example using different lenght of members and sdates: exp <- lonlat_data$exp exp$data <- exp$data[,,1:4,,,] dim(exp$data) <- c(dataset = 1, member = 15, sdate = 4, ftime = 3, lat = 22, lon = 53) obs <- lonlat_data$obs obs$data <- obs$data[,,1:4, ,,] dim(obs$data) <- c(dataset = 1, member = 1, sdate = 4, ftime = 3, lat = 22, lon = 53) exp_cor <- lonlat_data$exp exp_cor$data <- exp_cor$data[,1:5,5:6,,,] dim(exp_cor$data) <- c(dataset = 1, member = 5, sdate = 2, ftime = 3, lat = 22, lon = 53) res <- CST_QuantileMapping(exp, obs, exp_cor, sample_dims = c('sdate', 'ftime', 'member')) exp_cor <- lonlat_data$exp exp_cor$data <- exp_cor$data[,,5:6,,,] dim(exp_cor$data) <- c(dataset = 1, member = 15, sdate = 2, ftime = 3, lat = 22, lon = 53) res <- CST_QuantileMapping(exp, obs, exp_cor, sample_dims = c('sdate', 'ftime', 'member'))

[Package *CSTools* version 4.0.1 Index]