% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/CST_RFSlope.R
\name{CST_RFSlope}
\alias{CST_RFSlope}
\title{RainFARM spectral slopes from a CSTools object}
\usage{
CST_RFSlope(data, kmin = 1, time_dim = NULL, ncores = NULL)
}
\arguments{
\item{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 \code{$data} with at least two spatial dimensions named "lon" 
and "lat" and one or more dimensions over which to average these slopes, 
which can be specified by parameter \code{time_dim}.}

\item{kmin}{First wavenumber for spectral slope (default \code{kmin=1}).}

\item{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.}

\item{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 \code{exp} element of the 
 input object, minus the dimensions specified by \code{lon_dim}, 
 \code{lat_dim} and \code{time_dim}.
}
\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.
}
\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)
}
\author{
Jost von Hardenberg - ISAC-CNR, \email{j.vonhardenberg@isac.cnr.it}
}
