Description Usage Arguments Details Value References See Also Examples
Given a set of spatial covariates and a set of spatial coordinates, create a graph representing a parameterized conductance surface.
1 | conductance_surface(covariates, coords, directions = 4, saveStack = TRUE)
|
covariates |
A |
coords |
A |
directions |
If |
saveStack |
If |
NAs are shared across rasters in covariates
, and a warning is thrown if a given cell has mixed NA and non-NA values across the stack. Comparing models with different patterns of missing spatial data (e.g. fit to different stacks of rasters) can give superficially inconsistant results, as these essentially involve different sets of vertices. Thus model comparison should use models fitted to the same radish_graph
object.
Disconnected components are identified and removed, so that only the largest connected component in the graph is retained. The function aborts if there are focal cells that belong to a disconnected component.
Rasters of categorical covariates must have an associated RAT to be 'recognized' as categorical, see ratify
and examples
below. The names of levels are taken from the VALUE
column of the RAT, if it exists (otherwise, the integer codes in the ID
column are used).
An object of class radish_graph
Pope NS. In prep. Fast gradient-based optimization of resistance surfaces.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(raster)
data(melip)
covariates <- raster::stack(list(altitude=raster::scale(melip.altitude),
forestcover=raster::scale(melip.forestcover)))
surface <- conductance_surface(covariates, melip.coords, directions = 8)
# categorical covariates:
# rasters of categorical covariates must have an associated RAT, see 'details'
forestcover_class <- cut(raster::values(melip.forestcover), breaks = c(0, 1/3, 1/6, 1))
melip.forestcover_cat <-
raster::ratify(raster::setValues(melip.forestcover, as.numeric(forestcover_class)))
RAT <- levels(melip.forestcover_cat)[[1]]
RAT$VALUE <- levels(forestcover_class) #explicitly define level names
levels(melip.forestcover_cat) <- RAT
covariates_cat <- raster::stack(list(forestcover = melip.forestcover_cat,
altitude = melip.altitude))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.