scl: Calculate Correlation Length

View source: R/aacf.R

sclR Documentation

Calculate Correlation Length

Description

Calculates the smallest and largest distances to specified autocorrelation values (e.g., 0.2) of the areal autocorrelation function (AACF). All 180 degrees from the origin of the AACF image are considered for the calculation.

Usage

scl(x, threshold = c(0.2, 1/exp(1)), create_plot = FALSE)

Arguments

x

A raster or matrix.

threshold

A numeric vector containing values between 0 and 1. Indicates the autocorrelation values to which the rates of decline are measured.

create_plot

Logical. Defaults to FALSE. If TRUE, the AACF and lines showing the considered directions of autocorrelation from the origin will be plotted.

Value

A list containing the minimum and maximum distances from an autocorrelation value of 1 to the specified autocorrelation values < 1. Distances are in the units of the x, y coordinates of the raster image. If more than one threshold value is specified, the order of this list will be [minval(t1), minval(t2), maxval(t1), maxval(t2)].

Examples

# import raster image
data(normforest)
normforest <- terra::unwrap(normforest)

# calculate Scl20, the minimum distance to an autocorrelation value of 0.2 in the AACF
Scl20 <- scl(normforest)[1]

geodiv documentation built on Oct. 6, 2023, 1:07 a.m.