lacunarity: Lacunarity

Description Usage Arguments Details Value Examples

View source: R/lacunarity.R

Description

Computes the Lacunarity of a Spatial Raster object or a list of Spatial Raster objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
lacunarity(
  x,
  box = "SQUARE",
  r_vec = NULL,
  r_max = NULL,
  plot = FALSE,
  save_plot = FALSE,
  progress = FALSE,
  ncores = 1L
)

Arguments

x

SpatRaster or list of SpatRaster OR character; Raster image that can be loaded using rast. x can also be character, refering to a folder. In that case all files in the folder with the ending ".tif" will be used

box

character; Either SQUARE for a square neighborhood window, or CIRCLE for a round neighborhood window

r_vec

integer vector (optional); Vector of box diameter values. Every r must be odd and >2. It is recommended that no r value is greated than half of the shorter dimension of x. If r_vec is NULL (default), r_vec will be generated automatically

r_max

integer (optional); Maximum value of r, r_vec will be cut off for values >r

plot

logical; Should the summary Lacunarity figure, showing Lacunarity of all SpatRasters be printed?

save_plot

FALSE or folder path; If not FALSE, a folder path to save Lacunarity plots (see details)

progress

logical; Show progress bar?

ncores

numeric; The number of cores to use

Details

lacunarity is based on the algorithm for binary images provided by Plotnick et al. 1993. Hoechstetter et al. 2011 further applyed this algorithm on continuous raster images. If x is a binary raster (e.g. Land Use) Lacunarity is beening calculated using the Plotnicks algorithm.

Value

tibble containing all Lacunarity values: name and i refer to the name and index of the raster input. x is the box diameter (a 5X5 box has a diameter of 5 with a radius of 2). lac indicates the Lacunarity value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Create a SpatRast as input
mat_sample <- matrix(data = c(
   1,1,0,1,1,1,0,1,0,1,1,0,
   0,0,0,0,0,1,0,0,0,1,1,1,
   0,1,0,1,1,1,1,1,0,1,1,0,
   1,0,1,1,1,0,0,0,0,0,0,0,
   1,1,0,1,0,1,0,0,1,1,0,0,
   0,1,0,1,1,0,0,1,0,0,1,0,
   0,0,0,0,0,1,1,1,1,1,1,1,
   0,1,1,0,0,0,1,1,1,1,0,0,
   0,1,1,1,0,1,1,0,1,0,0,1,
   0,1,0,0,0,0,0,0,0,1,1,1,
   0,1,0,1,1,1,0,1,1,0,1,0,
   0,1,0,0,0,1,0,1,1,1,0,1
   ), nrow = 12, ncol = 12, byrow = TRUE
)
x <- terra::rast(mat_sample)

lacunarity(x)

STBrinkmann/spatLac documentation built on Feb. 13, 2022, 8:21 a.m.