csas {csa} | R Documentation |
Estimate and print the spatial CSA plot
Description
The function csa
computes (and by default plots) the aggregation curve of a given statistic in two dimensions, e.g., space.
Usage
csas(
x,
stat = "var",
std = TRUE,
plot = TRUE,
threshold = 30,
chk = FALSE,
...
)
Arguments
x |
A raster or brick object. |
stat |
The statistic which will be estimated across the cross-scale continuum. Suitable options are:
|
std |
logical. If TRUE (the default) the CSA plot is standardized to unit, i.e., zero mean and unit variance in the original time scale. |
plot |
logical. If TRUE (the default) the CSA plot is printed |
threshold |
numeric. Sample size of the time series at the last aggregated scale. |
chk |
logical. If TRUE the number of cores is limited to 2. |
... |
log_x and log_y (default TRUE) for setting the axes of the CSA plot to logarithmic scale. The argument wn (default FALSE) is used to plot a line presenting the standardized variance of the white noise process. Therefore, it should be used only with stat = "var" and std = T. |
Value
If plot = TRUE
, the csa
returns a list containing:
values
: Matrix of the timeseries values for the selectedstat
at eachscale
.plot
: Plot ofscale
versusstat
as a ggplot object.
If plot = FALSE
, then it returns only the matrix of the timeseries values for the selected stat
at each scale
.
References
Markonis et al., A cross-scale analysis framework for model/data comparison and integration, Geoscientific Model Development, Submitted.
Examples
## Not run:
data(gpm_events)
event_dates <- format(gpm_events[, unique(time)], "%d-%m-%Y")
gpm_events_brick <- dt.to.brick(gpm_events, var_name = "prcp")
plot(gpm_events_brick, col = rev(colorspace::sequential_hcl(40)),
main = event_dates)
csas(gpm_events_brick, chk = TRUE)
gpm_sp_scale <- csas(gpm_events_brick, plot = FALSE, chk = TRUE)
gpm_sp_scale[, variable := factor(variable, labels = event_dates)]
csa.multiplot(gpm_sp_scale, smooth = TRUE, log_x = FALSE, log_y = FALSE)
## End(Not run)