dVoCC: Distance-based velocity based on geographically closest...

View source: R/dVoCC.R

dVoCCR Documentation

Distance-based velocity based on geographically closest climate analogue

Description

Function to calculate the geographically closest climate analogues and related distance-based velocity. Cell analogues are identified by comparing the baseline climatic conditions at each focal cell with those existing for all other (target) cells in the future by reference to a specified climatic threshold. The function allows for the specification of search distances and incorporates both least-cost path and Great Circle (as-the-crow-flies) distances.

Usage

dVoCC(clim, n, tdiff, method = "Single", climTol, geoTol, distfun = "GreatCircle",
trans = NA, lonlat = TRUE)

Arguments

clim

data.frame with the value for the climatic parameters (columns) by cell (rows), arranged as follows (see examples below): The first 2n columns must contain the present and future values for each of the n climatic variables (V1p, V1f, V2p, V2f,...). Where cell-specific analogue thresholds (see "variable" in "method" below) are to be calculated, the next (2n+1:3n) columns should contain the standard deviation (or any other measure of climatic variability) of each variable for the baseline period. These columns are not required if using the "Single" method. The last three columns of the table should contain an identifyier and centroid coordinates of each cell.

n

integer defining the number of climatic variables.

tdiff

integer defining the number of years (or other temporal unit) between periods.

method

character string specifying the analogue method to be used. 'Single': a constant, single analogue threshold for each climate variable is applied to all cells (Ohlemuller et al. 2006, Hamann et al. 2015); climate analogy corresponds to target cells with values below the specified threshold for each climatic variable. 'Variable': a cell-specific climate threshold is used for each climatic variable to determine the climate analogues associated with each cell by reference to its baseline climatic variability (Garcia Molinos et al. 2017).

climTol

numeric a vector of length n giving the tolerance threshold defining climate analogue conditions for each climatic variable. If a cell-specific threshold is being used, this function parameter should be passed as NA.

geoTol

integer impose a geographical distance threshold (in km for lat/lon or map units if projected). If used, the pool of potential climate analogues will be limited to cells within that distance from the focal cell.

distfun

character string specifying the function to be used for estimating distances between focal and target cells. Either 'Euclidean', 'GreatCircle' (Great Circle Distances) or 'LeastCost' (Least Cost Path Distances). The latter requires a transition matrix supplied to the function via de 'trans' argument.

trans

TransitionLayer gdistance object to be used for the analogue search if distfun = 'LeastCost'.

lonlat

logical is the analysis to be done in unprojected (lon/lat) coordinates?

Value

A data.frame containing the cell id of the future analogue for each focal cell (NA = no analogue available), together with the climatic ("climDis") and geographical ("geoDis") distances in input units, the bearing ("ang", degrees North), and resulting climate velocity ("vel", km/yr). Mean climatic distances are returned for multivariate analogues.

Author(s)

Jorge Garcia Molinos

References

Ohlemuller et al. 2006. Towards European climate risk surfaces: the extent and distribution of analogous and non-analogous climates 1931-2100. Global Ecology and Biogeography, 15, 395-405.
Hamann et al. 2015. Velocity of climate change algorithms for guiding conservation and management. Global Change Biology, 21, 997-1004.
Garcia Molinos et al. 2017. Improving the interpretability of climate landscape metrics: An ecological risk analysis of Japan's Marine Protected Areas. Global Change Biology, 23, 4440-4452.

See Also

climPCA, climPlot

Examples


?JapTC

# Create a data frame with the necessary variables in the required order
clim <- na.omit(data.frame(getValues(JapTC), cid = 1:ncell(JapTC)))
clim[,c("x","y")] <- xyFromCell(JapTC, clim$cid)

# Constant threshold, distance-restricted velocity based on geographical distances
avocc1 <- dVoCC(clim, n = 3, tdiff = 40, method = "Single", climTol = c(10, 0.1, 0.1),
geoTol = 160, distfun = "GreatCircle", trans = NA, lonlat = TRUE)

# Cell-specific, distance-unrestricted climate analogue velocity based on least-cost path distances
# First, create the conductance matrix (all land cells considered to have conductance of 1)
r <- raster(JapTC)
r[!is.na(JapTC[[1]])] <- 1
h8 <- gdistance::transition(r, transitionFunction=mean, directions=8)
h8 <- gdistance::geoCorrection(h8, type="c")
# Now calculate the analogue velocity using the baseline SD for each variable as analogue threshold
avocc2 <- dVoCC(clim, n = 3, tdiff = 40, method = "Variable", climTol = NA, geoTol = Inf,
distfun = "LeastCost", trans = h8, lonlat = TRUE)

# Plot results
r1 <- r2 <- raster(JapTC)
r1[avocc1$focal] <- avocc1$vel
r2[avocc2$focal] <- avocc2$vel
plot(stack(r1,r2))


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