Calculate a selected group of metrics
calculate_lsm(
landscape,
level = NULL,
metric = NULL,
name = NULL,
type = NULL,
what = NULL,
directions = 8,
count_boundary = FALSE,
consider_boundary = FALSE,
edge_depth = 1,
cell_center = FALSE,
classes_max = NULL,
neighbourhood = 4,
ordered = TRUE,
base = "log2",
full_name = FALSE,
verbose = TRUE,
progress = FALSE
)
tibble
A categorical raster object: SpatRaster; Raster* Layer, Stack, Brick; stars or a list of SpatRasters.
Level of metrics. Either 'patch', 'class' or 'landscape' (or vector with combination).
Abbreviation of metrics (e.g. 'area').
Full name of metrics (e.g. 'core area').
Type according to FRAGSTATS grouping (e.g. 'aggregation metrics').
Selected level of metrics: either "patch", "class" or "landscape".
It is also possible to specify functions as a vector of strings, e.g. what = c("lsm_c_ca", "lsm_l_ta")
.
The number of directions in which patches should be connected: 4 (rook's case) or 8 (queen's case).
Include landscape boundary in edge length.
Logical if cells that only neighbour the landscape boundary should be considered as core.
Distance (in cells) a cell has to be away from the patch edge to be considered as core cell.
If true, the coordinates of the centroid are forced to be a cell center within the patch.
Potential maximum number of present classes.
The number of directions in which cell adjacencies are considered as neighbours: 4 (rook's case) or 8 (queen's case). The default is 4.
The type of pairs considered. Either ordered (TRUE) or unordered (FALSE). The default is TRUE.
The unit in which entropy is measured. The default is "log2", which compute entropy in "bits". "log" and "log10" can be also used.
Should the full names of all functions be included in the tibble.
Print warning messages.
Print progress report.
Wrapper to calculate several landscape metrics. The metrics can be specified
by the arguments what
, level
, metric
, name
and/or type
(combinations
of different arguments are possible (e.g. level = "class", type = "aggregation metric"
).
If an argument is not provided, automatically all possibilities are
selected. Therefore, to get all available metrics, don't specify any of the
above arguments.
For all metrics based on distances or areas please make sure your data is valid
using check_landscape
.
McGarigal K., SA Cushman, and E Ene. 2023. FRAGSTATS v4: Spatial Pattern Analysis Program for Categorical Maps. Computer software program produced by the authors; available at the following web site: https://www.fragstats.org
list_lsm
if (FALSE) {
landscape <- terra::rast(landscapemetrics::landscape)
calculate_lsm(landscape, progress = TRUE)
calculate_lsm(landscape, what = c("patch", "lsm_c_te", "lsm_l_pr"))
calculate_lsm(landscape, level = c("class", "landscape"),
type = "aggregation metric")
}
Run the code above in your browser using DataLab