Learn R Programming

fastbioclim (version 0.3.0)

stats_terra: In-Memory Custom Variable Summarization

Description

Internal function to calculate custom summary statistics using `terra` functions. Designed for datasets that fit into RAM.

Usage

stats_terra(
  variable,
  stats = c("mean", "max", "min", "cv_cli", "max_period", "min_period"),
  period_length = 3,
  period_stats = "mean",
  circular = TRUE,
  inter_variable = NULL,
  inter_stats = c("max_inter", "min_inter"),
  max_unit = NULL,
  min_unit = NULL,
  max_period = NULL,
  min_period = NULL,
  max_interactive = NULL,
  min_interactive = NULL,
  prefix_variable = "var",
  suffix_inter_max = "inter_high",
  suffix_inter_min = "inter_low",
  gdal_opt = c("COMPRESS=DEFLATE", "PREDICTOR=3", "NUM_THREADS=ALL_CPUS"),
  overwrite = FALSE,
  output_dir = tempdir(),
  verbose = TRUE,
  ...
)

Value

A `terra::SpatRaster` object containing the calculated summary layers.

Arguments

variable

A SpatRaster for the primary variable.

stats

Character vector of stats to compute.

prefix_variable

Character, prefix for output layer names.

...

Other arguments including inter_variable, period_length, circular, static index SpatRasters, etc.

See Also

The user-facing wrapper function `derived_statistics()`.