CST_RFSlope {CSTools} | R Documentation |
RainFARM spectral slopes from a CSTools object
Description
This function computes spatial spectral slopes from a CSTools object to be used for RainFARM stochastic precipitation downscaling method and accepts a CSTools object (of the class 's2dv_cube') as input.
Usage
CST_RFSlope(data, kmin = 1, time_dim = NULL, ncores = NULL)
Arguments
data |
An object of the class 's2dv_cube', containing the spatial
precipitation fields to downscale. The data object is expected to have an
element named |
kmin |
First wavenumber for spectral slope (default |
time_dim |
String or character array with name(s) of dimension(s) (e.g. "ftime", "sdate", "member" ...) over which to compute spectral slopes. If a character array of dimension names is provided, the spectral slopes will be computed as an average over all elements belonging to those dimensions. If omitted one of c("ftime", "sdate", "time") is searched and the first one with more than one element is chosen. |
ncores |
Is an integer that indicates the number of cores for parallel computations using multiApply function. The default value is one. |
Value
CST_RFSlope() returns spectral slopes using the RainFARM convention
(the logarithmic slope of k*|A(k)|^2 where A(k) are the spectral amplitudes).
The returned array has the same dimensions as the exp
element of the
input object, minus the dimensions specified by lon_dim
,
lat_dim
and time_dim
.
Author(s)
Jost von Hardenberg - ISAC-CNR, j.vonhardenberg@isac.cnr.it
Examples
exp <- 1 : (2 * 3 * 4 * 8 * 8)
dim(exp) <- c(dataset = 1, member = 2, sdate = 3, ftime = 4, lat = 8, lon = 8)
lon <- seq(10, 13.5, 0.5)
lat <- seq(40, 43.5, 0.5)
coords <- list(lon = lon, lat = lat)
data <- list(data = exp, coords = coords)
class(data) <- 's2dv_cube'
slopes <- CST_RFSlope(data)