spatGrad: Local spatial climatic gradients

View source: R/spatGrad.R

spatGradR Documentation

Local spatial climatic gradients

Description

Function to calculate the magnitude and direction of the spatial gradient associated to a climatic variable after Burrows et al. (2011). This trend is to be used for the calculation of the gradient-based climate velocity using gVoCC.

Usage

spatGrad(r, th = -Inf, projected = FALSE)

Arguments

r

RasterStack with the annual climatic values for the period of interest. Alternatively, a raster with the annual climatic values averaged over the period of interest.

th

Integer indicating a lower thershold to truncate the spatial gradient with. Use -Inf (default) if no threshold required.

projected

Logical is the source raster in a projected coordinate system? If FALSE (default) a correction will be made to account for latitudinal distortion.

Value

A RasterStack with the magnitude of the spatial gradient (Grad in C per km for unprojected rasters and C per spatial unit for projected rasters), and the associated angle (Ang in degrees).

Author(s)

Jorge Garcia Molinos, David S. Schoeman, and Michael T. Burrows

References

Burrows et al. 2011. The pace of shifting climate in marine and terrestrial ecosystems. Science, 334, 652-655.

See Also

tempTrend, gVoCC

Examples


yrSST <- sumSeries(HSST, p = "1969-01/2009-12", yr0 = "1955-01-01", l = nlayers(HSST),
fun = function(x) colMeans(x, na.rm = TRUE), freqin = "months", freqout = "years")

# Spatial gradient (magnitude and angle) for the average mean annual SST.

sg <- spatGrad(yrSST, th = 0.0001, projected = FALSE)

plot(sg)


JorGarMol/VoCC documentation built on Feb. 1, 2025, 7:53 p.m.