R/initialize.R
neutralLandscapeMap.RdThis is a wrapper for the nlm_mpd function in the NLMR package.
The main addition is that it makes sure that the output raster conforms
in extent with the input raster x, since nlm_mpd can output a smaller raster.
neutralLandscapeMap(
x,
pad = 10L,
type = c("nlm_mpd", "nlm_gaussianfield", "nlm_distancegradient", "nlm_edgegradient",
"nlm_fbm", "nlm_mosaicfield", "nlm_mosaicgibbs", "nlm_mosaictess", "nlm_neigh",
"nlm_percolation", "nlm_planargradient", "nlm_random",
"nlm_randomrectangularcluster"),
...
)A RasterLayer/SpatRaster to use as a template.
Integer. Number of cells by which to pad x internally to ensure
nlm_mpd produces a raster corresponding to the dimensions of x.
One of the supported NLMR functions.
Further arguments passed to NLMR function specified in type
(except ncol, nrow and resolution, which are extracted from x).
A RasterLayer/SpatRaster with same extent as x, with randomly generated values.
nlm_mpd
# \donttest{
if (requireNamespace("NLMR", quietly = TRUE) &&
requireNamespace("raster", quietly = TRUE)) {
library(terra)
nx <- ny <- 100L
r <- rast(nrows = ny, ncols = nx,
xmin = -nx/2, xmax = nx/2,
ymin = -ny/2, ymax = ny/2)
## or with raster package:
# r <- raster::raster(nrows = ny, ncols = nx,
# xmn = -nx/2, xmx = nx/2,
# ymn = -ny/2, ymx = ny/2)
map1 <- neutralLandscapeMap(r,
type = "nlm_mpd",
roughness = 0.65,
rand_dev = 200,
rescale = FALSE,
verbose = FALSE)
if (interactive()) plot(map1)
}
# }