strucDivDom {StrucDiv} | R Documentation |
Returns the structural diversity value, the gray level co-occurrence matrix (GLCM) and the structural diversity matrix of the domain.
Description
The function strucDivDom
returns the spatial, i.e. horizontal, structural diversity value for the domain (i.e. the input raster).
'Spatial structural diversity' will hereafter be used synonymous to 'structural diversity'.
The function also returns the gray level co-occurrence matrix (GLCM) and the structural diversity matrix of
the domain. Structural diversity is calculated on every element of the GLCM,
which generates the structural diversity matrix.
Usage
strucDivDom(x, dist = 1, angle = "all", rank = FALSE, fun, delta = 0)
Arguments
x |
raster layer. Input raster layer for which structural diversity should be calculated. |
dist |
integer. The distance between two pixels that should be considered as a pair,
defaults to |
angle |
string. The angle on which pixels should be considered as pairs.
Takes 5 options: |
rank |
logical. Should pixel values be replaced with ranks in each GLCM? Defaults to |
fun |
function, the structural diversity metric. Takes one of the following: |
delta |
numeric, takes three options: |
Details
The memory requirement of the function is determined
by raster::canProcessInMemory()
.
If the raster file cannot be processed in memory, its size needs to be
reduced before strucDivDom
can be used.
Value
The output is a list containing the structural diversity value of the domain, which can be accessed with $div. the list also contains the gray level co-occurrence matrix ($GLCM) and the structural diversity matrix ($divMat) of the domain.
Examples
## Not run:
# Calculate entropy on simulated random patch data
a <- raster::raster(matrix(rnorm(100), 10, 10))
sdivDom <- strucDivDom(a, angle = "vertical", fun = entropyDom)
# Structural diversity value of the domain
div <- sdivDom$div
# Gray level co-occurrence matrix
glcm <- sdivDom$GLCM
# Diversity matrix
divmat <- sdivDom$divMat
## End(Not run)