persistence: Persistence climatology (Temporal autocorrelation at given...

View source: R/persistence.R

persistenceR Documentation

Persistence climatology (Temporal autocorrelation at given time lag)

Description

Computes the persistence climatology (i.e., the temporal autocorrelation at a given time lag)

Usage

persistence(
  grid,
  lag = 1,
  ci = NULL,
  parallel = FALSE,
  max.ncores = 16,
  ncores = NULL
)

Arguments

grid

Input grid (most likely annually aggregated)

lag

Time lag at which to calculate persistence. Default is 1.

ci

Coverage probability for confidence interval (in the range (0-1)). Default to NULL, and ignored.

parallel

Logical. Should parallel execution be used?

max.ncores

Integer. Upper bound for user-defined number of cores.

ncores

Integer number of cores used in parallel computation. Self-selected number of cores is used when ncpus = NULL (the default), or when maxcores exceeds the default ncores value.

Details

The function is a wrapper of acf to compute the autocorrelation function. Significance at the given confidence interval is calculated as in plot.acf

In case of any missing values within the series, NA will be returned.

If ci is specified (e.g. ci=0.95), two global attributes are appended:

  • "signif:ci", indicating the confidence interval chosen

  • "is.signif", which is a logical matrix of dimension lat x lon indicating which points exhibit a significant persistence

Value

A climatology grid (i.e., "time" dimension size = 1).

Parallel Processing

Parallel processing is enabled using the parallel package. Parallelization is undertaken by a FORK-type parallel socket cluster formed by ncores. If ncores is not specified (default), ncores will be one less than the autodetected number of cores. The maximum number of cores used for parallel processing can be set with the max.ncores argument, although this will be reset to the auto-detected number of cores minus 1 if this number is exceeded. Note that not all code, but just some critical loops within the function are parallelized.

In practice, parallelization does not always result in smaller execution times, due to the parallel overhead. However, parallel computing may potentially provide a significant speedup for the particular case of large multimember datasets or large grids.

Parallel computing is currently not available for Windows machines.

Author(s)

J Bedia

See Also

spatialPlot, for conveniently plotting persistence climatology maps.


SantanderMetGroup/transformeR documentation built on Oct. 28, 2023, 5:26 a.m.