Skip to contents

This function interpolates values for each year between two specified years with simple interpolation using two raster objects containing e.g. habitat suitability values predicted using a species distribution model.

Usage

interp(r1, r2, y1, y2, rastername = NULL, dir_save = NULL)

Arguments

r1

SpatRaster. Raster object for the initial year

r2

SpatRaster. Raster object for the final year

y1

numeric. Initial year

y2

numeric. Final year

rastername

character. Word used as prefix in raster file name. Default NULL

dir_save

character. Directory path and name of the folder in which the raster files will be saved. If NULL, function will return a SpatRaster object, else, it will save raster in a given directory. Default NULL

Value

If dir_save is NULL, the function returns a SpatRaster with suitability interpolation for each year. If dir_save is used, function outputs are saved in the directory specified in dir_save.

Details

This function interpolates suitability values assuming that annual changes in suitability are linear. This function could be useful for linking SDM output based on averaged climate data and climate change scenarios to other models that require suitability values disaggregated in time periods, such as population dynamics (Keith et al., 2008; Conlisk et al., 2013; Syphard et al., 2013).

References

  • Keith, D.A., Akçakaya, H.R., Thuiller, W., Midgley, G.F., Pearson, R.G., Phillips, S.J., Regan, H.M., Araujo, M.B. & Rebelo, T.G. (2008) Predicting extinction risks under climate change: coupling stochastic population models with dynamic bioclimatic habitat models. Biology Letters, 4, 560-563.

  • Conlisk, E., Syphard, A.D., Franklin, J., Flint, L., Flint, A. & Regan, H.M. (2013) Management implications of uncertainty in assessing impacts of multiple landscape-scale threats to species persistence using a linked modeling approach. Global Change Biology 3, 858-869.

  • Syphard, A.D., Regan, H.M., Franklin, J. & Swab, R. (2013) Does functional type vulnerability to multiple threats depend on spatial context in Mediterranean-climate regions? Diversity and Distributions, 19, 1263-1274.

Examples

if (FALSE) {
require(terra)
require(dplyr)

f <- system.file("external/suit_time_step.tif", package = "flexsdm")
abma <- terra::rast(f)
plot(abma)

int <- interp(
  r1 = abma[[1]],
  r2 = abma[[2]],
  y1 = 2010,
  y2 = 2020,
  rastername = "Abies",
  dir_save = NULL
)

int
}