dVelocity {climetrics} | R Documentation |
Distant-based Velocity of Climate Change
Description
The method is developed based on the approach used in Garcia et al. (2014)
Gradiant-based velocity is also implemented in the package and is available through the gVelocity
function.
Garcia, R.A., Cabeza, M., Rahbek, C. and Araújo, M.B. (2014). Multiple dimensions of climate change and their implications for biodiversity. Science, 344(6183).
Usage
dVelocity(x,...,t1, t2, ny)
Arguments
x |
The first input climate variable that can be a RasterStack or RasterBrick, or a raster time series |
... |
additional input climate variables in case of using multiple climate variables that can be entered as |
t1 |
a chanracter or a numeric vector, specifying the index of raster layers for time 1 |
t2 |
a chanracter or a numeric vector, specifying the index of raster layers for time 2 |
ny |
integer; specifies the number of years between time 1 and time2, if the input is Raster time series, it is not needed as it will be identified by the function |
Value
A single Raster layer (RasterLayer or SpatRaster depending on the input)
Author(s)
Shirin Taheri; Babak Naimi
taheri.shi@gmail.com; naimi.b@gmail.com
Examples
filePath <- system.file("external/", package="climetrics") # path to the dataset folder
pr <- rast(paste0(filePath,'/precip.tif'))
tmean <- rast(paste0(filePath,'/tmean.tif'))
n <- readRDS(paste0(filePath,'/dates.rds')) # corresoinding dates
head(n) # Dates corresponds to the layers in climate variables
####################
# use rts function in the rts package to make a raster time series:
pr.t <- rts(pr,n)
tmean.t <- rts(tmean,n)
###########################
dv <- dVelocity(pr.t,tmean.t,t1='1991/2000',t2='2010/2020')
plot(dv)