resTime: Climatic residence time of a polygon

View source: R/resTime.R

resTimeR Documentation

Climatic residence time of a polygon

Description

Function to calculate VoCC-based residence time of isotherms within a polygon after Loaire et al. (2009)

Usage

resTime(pg, vel, areapg = NA)

Arguments

pg

SpatialPolygon or a SpatialPolygonsDataFrame containing the polygons for which the residence time is to be calculated. The polygons must be on the same coordinate system as vel.

vel

raster with climate velocity (km/year) for the period of interest.

areapg

vector with the area (in km2) of the polygons. Use NA (default) to calculate internally if field not avilable.

Value

a data.frame containing for each polygon its ID, mean velocity (km/yr), diameter of the equivalent circle (km), and residence time (years) as the ratio D/vel.

Author(s)

Jorge Garcia Molinos

References

Loarie et al. 2009. The velocity of climate change. Nature, 462, 1052-1055.

See Also

gVoCC

Examples


# Load example Exclusive Economic Zone polygon

?EEZ
?HSST
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")
tr <- tempTrend(yrSST, th = 10)
sg <- spatGrad(yrSST, th = 0.0001, projected = FALSE)
v <- gVoCC(tr,sg)
vel <- v[[1]]
# Calculating area internally
a1 <- resTime(EEZ, vel, areapg = NA)
a1
# Using the area field from the polygon data table
a2 <- resTime(EEZ, vel, areapg = as.numeric(as.numeric(levels(EEZ$Area_km2))[EEZ$Area_km2]))
a2

JorGarMol/VoCC documentation built on Aug. 17, 2022, 11:07 p.m.