voccTraj: Climate velocity trajectories

View source: R/voccTraj.R

voccTrajR Documentation

Climate velocity trajectories

Description

Function to calculate vocc trajectories after Burrows et al (2014). Trajectories are calculated by propagating climatic isopleths using the magnitude and direction of local (cell) velocities. This is a slightly modified version of the original Burrows et al. (2014) approach in that iterations of a trajectory are based on cumulative time travelled instead of using fixed time steps.

Usage

voccTraj(lonlat, vel, ang, mn, tyr, trajID = 1:nrow(lonlat), correct = FALSE)

Arguments

lonlat

data.frame with the longitude and latitude (in decimal degrees) of the points to project.

vel

raster with the magnitude of gradient-based climate velocity.

ang

raster with velocity angles in degrees.

mn

raster with the overall mean climatic value over the period of interest.

tyr

integer temporal length of the period of interest.

trajID

integer specifying the identifiers for the trajectories.

correct

logical does the input raster need to be corrected to account for cropped margins? Unless the raster extent is global, calculation of trajectories will throw an error at the margins as the trajectories go beyond the raster extent (no input values). To avoid this, an option is given for expanding the extent by the resolution of the raster (1 column/row) with NAs. Note that those trajectories reaching the extent limits will be artificially bounced back so should be discarded at that point. Alternatively, users may choose to crop to a larger extent to the domain of interest (appropriately defined by lonlat), so the extra extent buffer for those trajectories getting to the border of the raster.

Value

a data.frame containing the coordinates ("x", "y") of the constituent points and identification number ("trajIDs") for each trajectory.

Author(s)

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

References

Burrows et al. 2014. Geographical limits to species-range shifts are suggested by climate velocity. Nature, 507, 492-495.

See Also

gVoCC, trajClas

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")
tr <- tempTrend(yrSST, th = 10)
sg <- spatGrad(yrSST, th = 0.0001, projected = FALSE)
v <- gVoCC(tr,sg)
vel <- v[[1]]
ang <- v[[2]]

# calculate the annual SST mean over the period
mn <- mean(yrSST, na.rm = T)

# get the set of starting cells for the trajectories
lonlat <- na.omit(data.frame(xyFromCell(vel, 1:ncell(vel)), vel[], ang[], mn[]))[,1:2]

# Calculate trajectories
# The following throws an error due to the trajectories moving beyond the raster extent
traj <- voccTraj(lonlat, vel, ang, mn, tyr = 50)

This accounts for the extent issue
traj <- voccTraj(lonlat, vel, ang, mn, tyr = 50, correct = TRUE)


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