csas: Estimate and print the spatial CSA plot

Description Usage Arguments Value References Examples

View source: R/csa.R

Description

The function csa computes (and by default plots) the aggregation curve of a given statistic in two dimensions, e.g., space.

Usage

1
2
3
4
5
6
7
8
9
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:

  • "var" for variance,

  • "sd" for standard deviation,

  • "skew" for skewness,

  • "kurt" for kurtosis,

  • "l2" for L-scale,

  • "t2" for coefficient of L-variation,

  • "t3" for L-skewness,

  • "t4" for L-kurtosis.

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:

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

gpm_sp_scale <- csas(gpm_events_brick, plot = FALSE)
gpm_sp_scale[, variable := factor(variable, labels = event_dates)]
csa.multiplot(gpm_sp_scale, smooth = TRUE, log_x = FALSE, log_y = FALSE)

imarkonis/csa documentation built on May 18, 2020, 10:49 a.m.