nlm.binarize
Habitat (2) and matrix (1) of a map (NLMR's util_binarize): the share of habitat given, the cells with the highest values. Several shares give a stack, a map each.
| Input | Type | What it is |
maprequired | map | the values (a neutral landscape) |
| Output | Type | What it is |
map | any | 1 matrix, 2 habitat: a map, or a stack by share |
| Setting | Type | What it is |
breaksrequired | any | the share of habitat, in [0, 1], or several |
nlm.classify
Classes 1, 2... of a map (NLMR's util_classify): by the weights, each class's share of the cells (the cells sorted, the boundaries at the cumulative shares); by a real landscape's shares of its values; or in n classes by Jenks's natural breaks.
| Input | Type | What it is |
maprequired | map | the values (a neutral landscape) |
real | map | a real landscape whose classes' shares to take |
| Output | Type | What it is |
classes | map | the classes 1, 2... |
| Setting | Type | What it is |
n | integer | the classes, by natural breaks |
weights | any | each class's share of the cells (null for an even share of what the others leave) |
mask_value | number | the real landscape's value to leave out |
nlm.curds
A hierarchical binary map (NLMR's nlm_curds, curdling): at each level every cell splits into steps x steps cells and a share of them becomes matrix (0), the rest habitat (1); with wheyes, a share of the matrix turns back to habitat (wheyed curdling). Its side is the product of the steps.
| Output | Type | What it is |
map | map | 1 habitat, 0 matrix |
| Setting | Type | What it is |
curdsrequired | any | each level's share of matrix cells, e.g. [0.5, 0.3, 0.6] |
stepsrequired | any | each level's split, e.g. [32, 6, 2] |
wheyes | any | each level's share of matrix turned to habitat |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
nlm.distance_gradient
The distance of every cell to a rectangle of cells (NLMR's nlm_distancegradient). As NLMR's (the default): terra's distance, on a lon/lat grid of 1 degree cells for maps up to 360 x 90 (metres on the sphere), else GDAL's proximity in cells; otherwise the exact distance between the cells' centres, in map units.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the distances |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
originrequired | any | the rectangle, 1-based and inclusive: NLMR's [row from, row to, column from, column to] (as its checks: the second at most the columns and the fourth at most the rows); without NLMR's, [column from, column to, row from, row to] |
nlmr_compat | bool | NLMR's distances and origin (default true) |
nlm.edge_gradient
A gradient that peaks in the middle of the map and falls to its edges along a direction (NLMR's nlm_edgegradient): the planar gradient rescaled and folded around 0.5.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the gradient |
direction | number | its direction, in degrees |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
direction | number | in degrees, 0 north to 90 east (default: a uniform draw from 0 to 360 with the seed) |
nlm.fbm
A fractal surface from 0 to 1 (NLMR's nlm_fbm, fractional Brownian motion): rough for a small fractal dimension, smooth for a large one (2 is a plane).
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the surface, 0 to 1 |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
dimension | number | the fractal dimension, in (0, 2] (default 1) |
nlm.gaussian_field
A smooth random surface from 0 to 1 (NLMR's nlm_gaussianfield): a Gaussian field whose autocorrelation fades over the range given. A driver, a suitability or an elevation to try a model on; reclassified, a map of classes.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the field, 0 to 1 |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
range | number | the range of the autocorrelation, in cells (default 10) |
variance | number | of the autocorrelated part (default 5) |
nugget | number | the variance of the noise without structure (default 0.2) |
nlm.merge
Landscapes merged (NLMR's util_merge): the primary plus the sum of the secondary ones times the scaling, e.g. a gradient with noise on it.
| Input | Type | What it is |
primaryrequired | map | the primary landscape |
secondaryrequired | any | a map or a stack of maps on its grid |
| Output | Type | What it is |
map | map | the merged landscape |
| Setting | Type | What it is |
rescale | bool | rescale the values to 0-1 (default true) |
scaling | number | of the secondary landscapes (default 1) |
nlm.mosaic_field
A mosaic random field (NLMR's nlm_mosaicfield, spatstat's rMosaicField): the sum of n mosaics, each a Poisson line tessellation with a normal value per tile; optionally every step's sum and the infinite field (a log-Gaussian Cox process).
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the sum of the n mosaics |
steps | stack | the sum after each step (collect) |
infinit | map | the infinite field (infinit) |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
n | integer | the mosaics (default 20; 0 for only the infinite field) |
mean | number | of the tiles' values (default 0.5) |
sd | number | of the tiles' values (default 0.5) |
collect | bool | every step's sum too (default false) |
infinit | bool | the infinite field too (default false) |
nlmr_compat | bool | NLMR's quirks (default true): its steps rescaled with the first's range |
nlm.mosaic_gibbs
A Voronoi mosaic of classes from germs kept apart (NLMR's nlm_mosaicgibbs): spatstat's rSSI germs at least R apart, each with a class 1..patch_classes, every cell the class of its nearest germ. As NLMR (nlmr_compat, the default) the k-th class goes to the k-th Voronoi cell in the order GEOS lists them (GEOS 3.11 or later, next to GDAL); else each germ keeps its own class.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the mosaic |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
germsrequired | integer | how many germs |
nlmr_compat | bool | NLMR's assignment of the values to the Voronoi cells by GEOS's order (default true) |
rrequired | number | the shortest distance between germs, in cells |
patch_classesrequired | integer | the classes |
nlm.mosaic_tess
A Voronoi mosaic of random values (NLMR's nlm_mosaictess): random germs (sf's st_sample), a uniform value each, every cell the value of its nearest germ. As NLMR (nlmr_compat, the default) the k-th value goes to the k-th Voronoi cell in the order GEOS lists them (GEOS 3.11 or later, next to GDAL) and the values are floats, as terra::rasterize writes them; else each germ keeps its own value, in double precision.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the mosaic |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
germsrequired | integer | how many germs |
nlmr_compat | bool | NLMR's assignment of the values to the Voronoi cells by GEOS's order (default true) |
nlm.mpd
A fractal surface by midpoint displacement (NLMR's nlm_mpd, the diamond-square algorithm): each step halves the cells and displaces the midpoints by a deviation that shrinks with the roughness. NLMR's grid (the default) is the odd side above the larger dimension, less its border: it may differ from the size asked for (a warning says so).
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the surface |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
roughness | number | in [0, 1]: how fast the deviation shrinks (0.5) |
deviation | number | the first step's deviation (default 1) |
torus | bool | wrap the edges around (default false) |
nlmr_compat | bool | NLMR's grid (default true) |
nlm.neigh
A map of categories grown by neighbourhood (NLMR's nlm_neigh): cells are filled one at a time, with the category of their neighbours (probability p_neigh) or, around empty ones, at random (p_empty), until each category has its share. Categories 0, 1...
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the categories |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
p_neighrequired | number | the probability of a cell with filled neighbours, [0, 1] |
p_emptyrequired | number | the probability of a cell without, [0, 1] |
categories | integer | how many (default 3) |
neighbourhood | integer | 4 (default) or 8 neighbours |
proportions | any | each category's share of the cells, summing to 1 (default equal shares) |
nlm.percolation
A random binary map (NLMR's nlm_percolation): each cell is 1 with the probability given (a uniform draw below it, by column), else 0.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | 1 and 0 |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
prob | number | the probability of a 1, in [0, 1] (default 0.5) |
nlm.planar_gradient
A linear gradient across the map along a direction (NLMR's nlm_planargradient): eastness times the column plus southness times the row.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the gradient |
direction | number | its direction, in degrees |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
direction | number | in degrees, 0 north to 90 east (default: a uniform draw from 0 to 360 with the seed) |
nlm.random
Spatially random values (NLMR's nlm_random): a uniform draw for every cell, by column as R fills a matrix. The null model of a landscape without structure.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the values (0 to 1) |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
nlm.random_cluster
A map of patches of classes 1, 2... (NLMR's nlm_randomcluster, Saura & Martínez-Millán 2000): a share p of the cells grows into clusters, each of a class drawn with the weights, and the rest takes its neighbours' class. A forest map to try MSPA or a land change model on. The weights give the shares only roughly: the clusters are classed as wholes, so with few large clusters (p above about 0.59, the percolation threshold, where one cluster spans the map) one class may take most of it.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the classes 1, 2... |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
p | number | the share of cells in clusters, up to 1 (default 0.5) |
weights | any | the classes' weights, their share of the clusters (default [0.5, 0.5]: two classes) |
neighbourhood | integer | of a cluster's cells: 4 (default) or 8 |
nlm.random_rectangular_cluster
Overlapping rectangles of random values (NLMR's nlm_randomrectangularcluster): rectangles with sides from minl to maxl cells, each of a uniform value, until the map is covered.
| Input | Type | What it is |
like | map | a map whose grid to draw on (else rows x columns) |
| Output | Type | What it is |
map | map | the values |
| Setting | Type | What it is |
rows | integer | rows (default 256) |
columns | integer | columns (default 256) |
resolution | number | the cells' side (default 1) |
seed | integer | the seed of R's generator (default 1): NLMR's map for it |
rescale | bool | rescale the values to 0-1 (default true) |
minlrequired | integer | the shortest side, in cells |
maxlrequired | integer | the longest, at most the rows and the columns |
nlm.rescale
A map rescaled to 0-1 (NLMR's util_rescale): (x - min) / (max - min), all 0 when the minimum and maximum are all.equal.
| Input | Type | What it is |
maprequired | map | the values |
| Output | Type | What it is |
map | map | rescaled |