This function quantifies the amount of change between historical and future climate conditions inside a species' habitat.
departure(x, y, s.dat, ...)# S4 method for GLdeparture,missing,cnfa
departure(x, s.dat, filename = "", ...)
# S4 method for GLdeparture,missing,Spatial
departure(x, s.dat, field, fun = "last", filename = "", ...)
# S4 method for Raster,Raster,cnfa
departure(
x,
y,
s.dat,
center = TRUE,
scale = TRUE,
filename = "",
progress = FALSE,
parallel = FALSE,
n = 1,
...
)
# S4 method for Raster,Raster,Spatial
departure(
x,
y,
s.dat,
center = TRUE,
scale = TRUE,
filename = "",
progress = FALSE,
parallel = FALSE,
n = 1,
...
)
Raster* object, typically a brick or stack of historical climate raster layers or a brick of absolute differences (see Details)
Raster* object, future climate values with the same layers as x
SpatialPolygons*, sf, or cnfa object detailing species presence
Additional arguments for clusterR
character. Optional filename to save the Raster* output to
file. If this is not provided, a temporary file will be created for large x
field of s.dat
that specifies presence. This is
equivalent to the field
argument of raster::rasterize
. Options
are 'first', 'last' (default), and 'count'
function or character. Determines what values to assign to cells
with multiple spatial features, similar to the fun
argument in
rasterize
logical. If TRUE
then the values of x
and
y
will be centered on the means of the historical
climate data
logical. If TRUE
then the values of x
and
y
will be scaled by the sds of the historical
climate data
logical. If TRUE
, messages and progress bar will be
printed
logical. If TRUE
then multiple cores are utilized
numeric. Optional number of CPU cores to utilize for parallel processing
Returns an S4 object of class departure
with the following slots:
Original function call
Departure factor. Vector of length p that describes the amount of departure between future and historical conditions for each climate variable
Magnitude of the departure factor
p x p historical global covariance matrix
RasterBrick of climate departures, with p layers
Raster layer of weights used for departure calculation
For comparisons of multiple species in the same study area, it is much more
efficient to first construct a Raster* object of absolute differences between
the historical and future values, so that the differences do not need to be
recalculated for each species. This can be achieved with by passing x
and y
to the difRaster
function, and then passing the
results to the departure
function.
When only one Raster* object is supplied, it is assumed that x
is
a Raster* object containing the absolute differences of a historical and
future dataset.
Rinnan, D. Scott and Lawler, Joshua. Climate-niche factor analysis: a spatial approach to quantifying species vulnerability to climate change. Ecography (2019): <doi:10.1111/ecog.03937>.
# NOT RUN {
dep1 <- departure(x = climdat.hist, y = climdat.fut, s.dat = ABPR, field = "CODE")
# using difRaster as an initial step
# for multi-species comparison
gld <- GLdeparture(x = climdat.hist, y = climdat.fut)
dep2 <- departure(x = gld, s.dat = ABPR, field = "CODE")
# same results either way
all.equal(dep1@df, dep2@df)
# }
Run the code above in your browser using DataLab