| Title: | Simulating Neutral Landscape Models |
|---|---|
| Description: | Provides neutral landscape models (<doi:10.1007/BF02275262>, <https://sci-hub.in/10.1007/bf02275262>). Neutral landscape models range from "hard" neutral models (completely random distributed), to "soft" neutral models (definable spatial characteristics) and generate landscape patterns that are independent of ecological processes. Thus, these patterns can be used as null models in landscape ecology. 'NLMR' combines a large number of algorithms from other published software for simulating neutral landscapes. The simulation results are obtained in a spatial data format (raster* objects from the 'raster' package) and can, therefore, be used in any sort of raster data operation that is performed with standard observation data. |
| Authors: | Marco Sciaini [aut] (ORCID: <https://orcid.org/0000-0002-3042-5435>), Matthias Fritsch [aut], Maximilian Hesselbarth [aut], Craig Simpkins [aut] (ORCID: <https://orcid.org/0000-0003-3212-1379>), Cédric Scherer [aut] (ORCID: <https://orcid.org/0000-0003-0465-2543>), Sebastian Hanß [aut] (ORCID: <https://orcid.org/0000-0002-3990-4897>), Jakub Nowosad [aut, cre] (ORCID: <https://orcid.org/0000-0002-1057-3721>), Laura Graham [rev] (Laura reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/188), Jeffrey Hollister [rev] (Jeffrey reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/188) |
| Maintainer: | Jakub Nowosad <[email protected]> |
| License: | GPL-3 |
| Version: | 1.2.0 |
| Built: | 2026-05-23 09:10:11 UTC |
| Source: | https://github.com/ropensci/NLMR |
Simulates a random curd neutral landscape model with optional wheys.
nlm_curds( curds, recursion_steps, wheyes = NULL, resolution = 1, user_seed = NULL )nlm_curds( curds, recursion_steps, wheyes = NULL, resolution = 1, user_seed = NULL )
curds |
[ |
recursion_steps |
[ |
wheyes |
[ |
resolution |
[ |
user_seed |
[ |
Random curdling recursively subdivides the plane into blocks. At each level of the recursion, a fraction of the blocks are declared as habitat (value == TRUE) while the remaining blocks continue to be defined as matrix (value == FALSE) and enter the next recursive cycle.
The optional argument (wheyes) allows wheys to be added, in which a set proportion of cells that were
declared matrix (value == FALSE) during recursion, are now set as habitat cells (value == TRUE).
If
the models resembles a binary random map.
Note that you can not set ncol and nrow with this landscape algorithm. The amount of cells and hence dimension of the raster is given by the vector product of the recursive steps.
raster
Keitt TH. 2000. Spectral representation of neutral landscapes. Landscape Ecology 15:479-493.
Szaro, Robert C., and David W. Johnston, eds. Biodiversity in managed landscapes: theory and practice. Oxford University Press, USA, 1996.
# simulate random curdling (random_curdling <- nlm_curds(curds = c(0.5, 0.3, 0.6), recursion_steps = c(32, 6, 2))) # simulate wheyed curdling (wheyed_curdling <- nlm_curds(curds = c(0.5, 0.3, 0.6), recursion_steps = c(32, 6, 2), wheyes = c(0.1, 0.05, 0.2))) ## Not run: # Visualize the NLMs raster::plot(random_curdling) raster::plot(wheyed_curdling) ## End(Not run)# simulate random curdling (random_curdling <- nlm_curds(curds = c(0.5, 0.3, 0.6), recursion_steps = c(32, 6, 2))) # simulate wheyed curdling (wheyed_curdling <- nlm_curds(curds = c(0.5, 0.3, 0.6), recursion_steps = c(32, 6, 2), wheyes = c(0.1, 0.05, 0.2))) ## Not run: # Visualize the NLMs raster::plot(random_curdling) raster::plot(wheyed_curdling) ## End(Not run)
Simulates a distance-gradient neutral landscape model.
nlm_distancegradient(ncol, nrow, resolution = 1, origin, rescale = TRUE)nlm_distancegradient(ncol, nrow, resolution = 1, origin, rescale = TRUE)
ncol |
[ |
nrow |
[ |
resolution |
[ |
origin |
[ |
rescale |
[ |
The function takes the number of columns and rows as input and creates a
RasterLayer with the same extent. Origin is a numeric vector of
xmin, xmax, ymin, ymax for a rectangle inside the raster from which the
distance is measured.
RasterLayer
nlm_edgegradient,
nlm_planargradient
# simulate a distance gradient distance_gradient <- nlm_distancegradient(ncol = 100, nrow = 100, origin = c(20, 30, 10, 15)) ## Not run: # visualize the NLM raster::plot(distance_gradient) ## End(Not run)# simulate a distance gradient distance_gradient <- nlm_distancegradient(ncol = 100, nrow = 100, origin = c(20, 30, 10, 15)) ## Not run: # visualize the NLM raster::plot(distance_gradient) ## End(Not run)
Simulates an edge-gradient neutral landscape model.
nlm_edgegradient( ncol, nrow, resolution = 1, direction = NA, user_seed = NULL, rescale = TRUE )nlm_edgegradient( ncol, nrow, resolution = 1, direction = NA, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
direction |
[ |
user_seed |
[ |
rescale |
[ |
Simulates a linear gradient orientated on a specified or random direction that has a central peak running perpendicular to the gradient direction.
RasterLayer
Travis, J.M.J. & Dytham, C. (2004) A method for simulating patterns of habitat availability at static and dynamic range margins. Oikos, 104, 410–416.
nlm_distancegradient,
nlm_planargradient
# simulate random curdling edge_gradient <- nlm_edgegradient(ncol = 100, nrow = 100, direction = 80) ## Not run: # visualize the NLM raster::plot(edge_gradient) ## End(Not run)# simulate random curdling edge_gradient <- nlm_edgegradient(ncol = 100, nrow = 100, direction = 80) ## Not run: # visualize the NLM raster::plot(edge_gradient) ## End(Not run)
Creates a two-dimensional fractional Brownian motion neutral landscape model.
nlm_fbm( ncol, nrow, resolution = 1, fract_dim = 1, user_seed = NULL, rescale = TRUE, ... )nlm_fbm( ncol, nrow, resolution = 1, fract_dim = 1, user_seed = NULL, rescale = TRUE, ... )
ncol |
[ |
nrow |
[ |
resolution |
[ |
fract_dim |
[ |
user_seed |
[ |
rescale |
[ |
... |
Unused |
Neutral landscapes are generated using fractional Brownian motion,
an extension of Brownian motion in which the amount of correlation between
steps is controlled by frac_dim. A high value of frac_dim produces a
relatively smooth, correlated surface while a low value produces a rough, uncorrelated one.
character(1) Temporary maintenance message.
Travis, J.M.J. & Dytham, C. (2004). A method for simulating patterns of habitat availability at static and dynamic range margins. Oikos , 104, 410–416.
Martin Schlather, Alexander Malinowski, Peter J. Menck, Marco Oesting, Kirstin Strokorb (2015). nlm_fBm. Journal of Statistical Software, 63(8), 1-25. URL http://www.jstatsoft.org/v63/i08/.
# simulate fractional brownian motion fbm_raster <- nlm_fbm(ncol = 20, nrow = 30, fract_dim = 0.8) ## Not run: # visualize the NLM raster::plot(fbm_raster) ## End(Not run)# simulate fractional brownian motion fbm_raster <- nlm_fbm(ncol = 20, nrow = 30, fract_dim = 0.8) ## Not run: # visualize the NLM raster::plot(fbm_raster) ## End(Not run)
Simulates a spatially correlated random fields (Gaussian random fields) neutral landscape model.
nlm_gaussianfield( ncol, nrow, resolution = 1, autocorr_range = 10, mag_var = 5, nug = 0.2, mean = 0.5, user_seed = NULL, rescale = TRUE )nlm_gaussianfield( ncol, nrow, resolution = 1, autocorr_range = 10, mag_var = 5, nug = 0.2, mean = 0.5, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
autocorr_range |
[ |
mag_var |
[ |
nug |
[ |
mean |
[ |
user_seed |
[ |
rescale |
[ |
Gaussian random fields are a collection of random numbers on a spatially discrete set of coordinates (landscape raster). Natural sciences often apply them with spatial autocorrelation, meaning that objects which distant are more distinct from one another than they are to closer objects.
character(1) Temporary maintenance message.
Kéry & Royle (2016) Applied Hierarchical Modeling in Ecology Chapter 20
# simulate random gaussian field gaussian_field <- nlm_gaussianfield(ncol = 90, nrow = 90, autocorr_range = 60, mag_var = 8, nug = 5) ## Not run: # visualize the NLM raster::plot(gaussian_field) ## End(Not run)# simulate random gaussian field gaussian_field <- nlm_gaussianfield(ncol = 90, nrow = 90, autocorr_range = 60, mag_var = 8, nug = 5) ## Not run: # visualize the NLM raster::plot(gaussian_field) ## End(Not run)
Simulates a mosaic random field neutral landscape model.
nlm_mosaicfield( ncol, nrow, resolution = 1, n = 20, mosaic_mean = 0.5, mosaic_sd = 0.5, user_seed = NULL, collect = FALSE, infinit = FALSE, rescale = TRUE )nlm_mosaicfield( ncol, nrow, resolution = 1, n = 20, mosaic_mean = 0.5, mosaic_sd = 0.5, user_seed = NULL, collect = FALSE, infinit = FALSE, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
n |
[ |
mosaic_mean |
[ |
mosaic_sd |
[ |
user_seed |
[ |
collect |
[ |
infinit |
[ |
rescale |
[ |
RasterLayer or List with RasterLayer/s and/or RasterBrick
Schwab, Dimitri, Martin Schlather, and Jürgen Potthoff. "A general class of
mosaic random fields." arXiv preprint arXiv:1709.01441 (2017).
Baddeley, Adrian, Ege Rubak, and Rolf Turner. Spatial point patterns:
methodology and applications with R. CRC Press, 2015.
# simulate mosaic random field mosaic_field <- nlm_mosaicfield(ncol = 100, nrow = 200, n = NA, infinit = TRUE, collect = FALSE) ## Not run: # visualize the NLM raster::plot(mosaic_field) ## End(Not run)# simulate mosaic random field mosaic_field <- nlm_mosaicfield(ncol = 100, nrow = 200, n = NA, infinit = TRUE, collect = FALSE) ## Not run: # visualize the NLM raster::plot(mosaic_field) ## End(Not run)
Simulate a neutral landscape model using the Gibbs algorithm introduced in Gaucherel (2008).
nlm_mosaicgibbs( ncol, nrow, resolution = 1, germs, R, patch_classes, user_seed = NULL, rescale = TRUE )nlm_mosaicgibbs( ncol, nrow, resolution = 1, germs, R, patch_classes, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
germs |
[ |
R |
[ |
patch_classes |
[ |
user_seed |
[ |
rescale |
[ |
nlm_mosaicgibbs offers the second option of simulating a neutral landscape model
described in Gaucherel (2008).
The method works in principal like the tessellation method (nlm_mosaictess),
but instead of a random point pattern the algorithm fits a simulated realization of the Strauss
process. The Strauss process starts with a given number of points and
uses a minimization approach to fit a point pattern with a given interaction
parameter (0 - hardcore process; 1 - Poisson process) and interaction radius
(distance of points/germs being apart).
RasterLayer
Gaucherel, C. (2008) Neutral models for polygonal landscapes with linear networks. Ecological Modelling, 219, 39 - 48.
# simulate polygonal landscapes mosaicgibbs <- nlm_mosaicgibbs(ncol = 40, nrow = 30, germs = 20, R = 0.02, patch_classes = 12) ## Not run: # visualize the NLM raster::plot(mosaicgibbs) ## End(Not run)# simulate polygonal landscapes mosaicgibbs <- nlm_mosaicgibbs(ncol = 40, nrow = 30, germs = 20, R = 0.02, patch_classes = 12) ## Not run: # visualize the NLM raster::plot(mosaicgibbs) ## End(Not run)
Simulate a neutral landscape model using the tesselation approach introduced in Gaucherel (2008).
nlm_mosaictess( ncol, nrow, resolution = 1, germs, user_seed = NULL, rescale = TRUE )nlm_mosaictess( ncol, nrow, resolution = 1, germs, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
germs |
[ |
user_seed |
[ |
rescale |
[ |
nlm_mosaictess offers the first option of simulating a neutral landscape model
described in Gaucherel (2008). It generates a random point pattern (germs)
with an independent distribution and uses the Voronoi tessellation to simulate mosaic landscapes.
RasterLayer
Gaucherel, C. (2008) Neutral models for polygonal landscapes with linear networks. Ecological Modelling, 219, 39 - 48.
# simulate polygonal landscapes mosaictess <- nlm_mosaictess(ncol = 30, nrow = 60, germs = 200) ## Not run: # visualize the NLM raster::plot(mosaictess) ## End(Not run)# simulate polygonal landscapes mosaictess <- nlm_mosaictess(ncol = 30, nrow = 60, germs = 200) ## Not run: # visualize the NLM raster::plot(mosaictess) ## End(Not run)
Simulates a midpoint displacement neutral landscape model.
nlm_mpd( ncol, nrow, resolution = 1, roughness = 0.5, rand_dev = 1, user_seed = NULL, torus = FALSE, rescale = TRUE, verbose = TRUE )nlm_mpd( ncol, nrow, resolution = 1, roughness = 0.5, rand_dev = 1, user_seed = NULL, torus = FALSE, rescale = TRUE, verbose = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
roughness |
[ |
rand_dev |
[ |
user_seed |
[ |
torus |
[ |
rescale |
[ |
verbose |
[ |
The algorithm is a direct implementation of the midpoint displacement algorithm. It performs the following steps:
Determine the smallest fit of
max(ncol, nrow) in n^2 + 1 and assign value to n.
Setup matrix of size (n^2 + 1)*(n^2 + 1).
Afterwards, assign a random value to the four corners of the matrix.
For each square in the matrix, assign the average of the four corner points plus a random value to the midpoint of that square.
For each diamond in the matrix, assign the average of the four corner points plus a random value to the midpoint of that diamond.
At each iteration the roughness, an approximation to common Hurst exponent, is reduced.
RasterLayer
https://en.wikipedia.org/wiki/Diamond-square_algorithm
# simulate midpoint displacement midpoint_displacememt <- nlm_mpd(ncol = 100, nrow = 100, roughness = 0.3) ## Not run: # visualize the NLM raster::plot(midpoint_displacememt) ## End(Not run)# simulate midpoint displacement midpoint_displacememt <- nlm_mpd(ncol = 100, nrow = 100, roughness = 0.3) ## Not run: # visualize the NLM raster::plot(midpoint_displacememt) ## End(Not run)
Create a neutral landscape model with categories and clustering based on neighborhood characteristics.
nlm_neigh( ncol, nrow, resolution = 1, p_neigh, p_empty, categories = 3, neighbourhood = 4, proportions = NA, user_seed = NULL, rescale = TRUE )nlm_neigh( ncol, nrow, resolution = 1, p_neigh, p_empty, categories = 3, neighbourhood = 4, proportions = NA, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
p_neigh |
[ |
p_empty |
[ |
categories |
[ |
neighbourhood |
[ |
proportions |
[ |
user_seed |
[ |
rescale |
[ |
The algorithm draws a random cell and turns it into a given category based on
the probabilities p_neigh and p_empty, respectively. The decision is
based on the probability p_neigh, if there is any cell in the Moore- (8 cells) or
Von-Neumann-neighborhood (4 cells), otherwise it is based on p_empty. To create
clustered neutral landscape models, p_empty should be (significantly) smaller than
p_neigh. By default, the Von-Neumann-neighborhood is used to check adjacent
cells. The algorithm starts with the highest categorical value. If the
proportion of cells with this value is reached, the categorical value is
reduced by 1. By default, a uniform distribution of the categories is
applied.
RasterLayer
Scherer, Cédric, et al. "Merging trait-based and individual-based modelling: An animal functional type approach to explore the responses of birds to climatic and land use changes in semi-arid African savannas." Ecological Modelling 326 (2016): 75-89.
# simulate neighborhood model neigh_raster <- nlm_neigh(ncol = 50, nrow = 50, p_neigh = 0.7, p_empty = 0.1, categories = 5, neighbourhood = 4) ## Not run: # visualize the NLM raster::plot(neigh_raster) ## End(Not run)# simulate neighborhood model neigh_raster <- nlm_neigh(ncol = 50, nrow = 50, p_neigh = 0.7, p_empty = 0.1, categories = 5, neighbourhood = 4) ## Not run: # visualize the NLM raster::plot(neigh_raster) ## End(Not run)
Generates a random percolation neutral landscape model.
nlm_percolation(ncol, nrow, resolution = 1, prob = 0.5, user_seed = NULL)nlm_percolation(ncol, nrow, resolution = 1, prob = 0.5, user_seed = NULL)
ncol |
[ |
nrow |
[ |
resolution |
[ |
prob |
[ |
user_seed |
[ |
The simulation of a random percolation map is accomplished in two steps:
Setup matrix of size (ncol*nrow).
For each cell in the matrix a single uniformly
distributed random number is generated and tested against a probability
prob. If the random number is smaller than prob, the cell is set to
TRUE; if it is higher the cell is set to FALSE.
RasterLayer
1. Gardner RH, O'Neill R V, Turner MG, Dale VH. 1989. Quantifying scale-dependent effects of animal movement with simple percolation models. Landscape Ecology 3:217 - 227.
2. Gustafson, E.J. & Parker, G.R. (1992) Relationships between landcover proportion and indices of landscape spatial pattern. Landscape Ecology , 7, 101 - 110.
# simulate percolation model percolation <- nlm_percolation(ncol = 100, nrow = 100, prob = 0.5) ## Not run: # visualize the NLM raster::plot(percolation) ## End(Not run)# simulate percolation model percolation <- nlm_percolation(ncol = 100, nrow = 100, prob = 0.5) ## Not run: # visualize the NLM raster::plot(percolation) ## End(Not run)
Simulates a planar gradient neutral landscape model.
nlm_planargradient( ncol, nrow, resolution = 1, direction = NA, user_seed = NULL, rescale = TRUE )nlm_planargradient( ncol, nrow, resolution = 1, direction = NA, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
direction |
[ |
user_seed |
[ |
rescale |
[ |
Simulates a linear gradient sloping in a specified or random direction.
RasterLayer
Palmer, M.W. (1992) The coexistence of species in fractal landscapes. The American Naturalist, 139, 375 - 397.
nlm_distancegradient,
nlm_edgegradient
# simulate planar gradient planar_gradient <- nlm_planargradient(ncol = 200, nrow = 200) ## Not run: # visualize the NLM raster::plot(planar_gradient) ## End(Not run)# simulate planar gradient planar_gradient <- nlm_planargradient(ncol = 200, nrow = 200) ## Not run: # visualize the NLM raster::plot(planar_gradient) ## End(Not run)
Simulates a spatially random neutral landscape model with values drawn a uniform distribution.
nlm_random(ncol, nrow, resolution = 1, user_seed = NULL, rescale = TRUE)nlm_random(ncol, nrow, resolution = 1, user_seed = NULL, rescale = TRUE)
ncol |
[ |
nrow |
[ |
resolution |
[ |
user_seed |
[ |
rescale |
[ |
The function takes the number of columns and rows as input and creates a
RasterLayer with the same extent. Each raster cell is randomly assigned a
value between 0 and 1 drawn from an uniform distribution (runif(1,0,1)).
RasterLayer
# simulate spatially random model random <- nlm_random(ncol = 200, nrow = 100) ## Not run: # visualize the NLM raster::plot(random) ## End(Not run)# simulate spatially random model random <- nlm_random(ncol = 200, nrow = 100) ## Not run: # visualize the NLM raster::plot(random) ## End(Not run)
Simulates a random cluster nearest-neighbour neutral landscape.
nlm_randomcluster( ncol, nrow, resolution = 1, p, ai = c(0.5, 0.5), neighbourhood = 4, user_seed = NULL, rescale = TRUE )nlm_randomcluster( ncol, nrow, resolution = 1, p, ai = c(0.5, 0.5), neighbourhood = 4, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
p |
[ |
ai |
Vector with the cluster type distribution (percentages of occupancy). This directly controls the number of types via the given length. |
neighbourhood |
[ |
user_seed |
[ |
rescale |
[ |
This is a direct implementation of steps A - D of the modified random clusters algorithm by Saura & Martínez-Millán (2000), which creates naturalistic patchy patterns.
Raster with random values ranging from 0-1.
Saura, S. & Martínez-Millán, J. (2000) Landscape patterns simulation with a modified random clusters method. Landscape Ecology, 15, 661 – 678.
# simulate random clustering random_cluster <- nlm_randomcluster(ncol = 30, nrow = 30, p = 0.4, ai = c(0.25, 0.25, 0.5)) ## Not run: # visualize the NLM raster::plot(random_cluster) ## End(Not run)# simulate random clustering random_cluster <- nlm_randomcluster(ncol = 30, nrow = 30, p = 0.4, ai = c(0.25, 0.25, 0.5)) ## Not run: # visualize the NLM raster::plot(random_cluster) ## End(Not run)
Simulates a random rectangular clusters neutral landscape model with values ranging 0-1.
nlm_randomrectangularcluster( ncol, nrow, resolution = 1, minl, maxl, user_seed = NULL, rescale = TRUE )nlm_randomrectangularcluster( ncol, nrow, resolution = 1, minl, maxl, user_seed = NULL, rescale = TRUE )
ncol |
[ |
nrow |
[ |
resolution |
[ |
minl |
[ |
maxl |
[ |
user_seed |
[ |
rescale |
[ |
The random rectangular cluster algorithm starts to fill a raster randomly
with rectangles defined by minl and maxl until the surface
of the landscape is completely covered.
This is one type of realisation of a "falling/dead leaves" algorithm,
for more details see Galerne & Gousseau (2012).
RasterLayer
Gustafson, E.J. & Parker, G.R. (1992). Relationships between landcover proportion and indices of landscape spatial pattern. Landscape ecology, 7, 101–110. Galerne B. & Gousseau Y. (2012). The Transparent Dead Leaves Model. Advances in Applied Probability, Applied Probability Trust, 44, 1–20.
# simulate random rectangular cluster randomrectangular_cluster <- nlm_randomrectangularcluster(ncol = 50, nrow = 30, minl = 5, maxl = 10) ## Not run: # visualize the NLM raster::plot(randomrectangular_cluster) ## End(Not run)# simulate random rectangular cluster randomrectangular_cluster <- nlm_randomrectangularcluster(ncol = 50, nrow = 30, minl = 5, maxl = 10) ## Not run: # visualize the NLM raster::plot(randomrectangular_cluster) ## End(Not run)
Classify continuous landscapes into landscapes with discrete classes
util_classify(x, n, weighting, level_names, real_land, mask_val) ## S3 method for class 'RasterLayer' util_classify( x, n = NULL, weighting = NULL, level_names = NULL, real_land = NULL, mask_val = NULL )util_classify(x, n, weighting, level_names, real_land, mask_val) ## S3 method for class 'RasterLayer' util_classify( x, n = NULL, weighting = NULL, level_names = NULL, real_land = NULL, mask_val = NULL )
x |
raster |
n |
Number of classes |
weighting |
Vector of numeric values that are considered to be habitat percentages (see details) |
level_names |
Vector of names for the factor levels. |
real_land |
Raster with real landscape (see details) |
mask_val |
Value to mask (refers to real_land) |
Mode 1: Calculate the optimum breakpoints using Jenks natural breaks optimization, the number of classes is determined with 'n'. The Jenks optimization seeks to minimize the variance within categories, while maximizing the variance between categories.
Mode 2: The number of elements in the weighting vector determines the number of classes in the resulting matrix. The classes start with the value 1. If non-numerical levels are required, the user can specify a vector to turn the numerical factors into other data types, for example into character strings (i.e. class labels). If the numerical vector of weightings does not sum up to 1, the sum of the weightings is divided by the number of elements in the weightings vector and this is then used for the classificat#' .
Mode 3: For a given 'real' landscape the number of classes and the weightings are extracted and used to classify the given landscape (any given weighting parameter is overwritten in this case!). If an optional mask value is given the corresponding class from the 'real' landscape is cut from the landscape beforehand.
RasterLayer
## Not run: # Mode 1 util_classify(fractal_landscape, n = 3, level_names = c("Land Use 1", "Land Use 2", "Land Use 3")) # Mode 2 util_classify(fractal_landscape, weighting = c(0.5, 0.25, 0.25), level_names = c("Land Use 1", "Land Use 2", "Land Use 3")) # Mode 3 real_land <- util_classify(gradient_landscape, n = 3, level_names = c("Land Use 1", "Land Use 2", "Land Use 3")) fractal_landscape_real <- util_classify(fractal_landscape, real_land = real_land) fractal_landscape_mask <- util_classify(fractal_landscape, real_land = real_land, mask_val = 1) landscapes <- list( '1 nlm' = fractal_landscape, '2 real' = real_land, '3 result' = fractal_landscape_real, '4 result with mask' = fractal_landscape_mask ) raster::plot(landscapes) ## End(Not run)## Not run: # Mode 1 util_classify(fractal_landscape, n = 3, level_names = c("Land Use 1", "Land Use 2", "Land Use 3")) # Mode 2 util_classify(fractal_landscape, weighting = c(0.5, 0.25, 0.25), level_names = c("Land Use 1", "Land Use 2", "Land Use 3")) # Mode 3 real_land <- util_classify(gradient_landscape, n = 3, level_names = c("Land Use 1", "Land Use 2", "Land Use 3")) fractal_landscape_real <- util_classify(fractal_landscape, real_land = real_land) fractal_landscape_mask <- util_classify(fractal_landscape, real_land = real_land, mask_val = 1) landscapes <- list( '1 nlm' = fractal_landscape, '2 real' = real_land, '3 result' = fractal_landscape_real, '4 result with mask' = fractal_landscape_mask ) raster::plot(landscapes) ## End(Not run)