neutralLandscapeMap {SpaDES.tools} | R Documentation |
Produce a neutral landscape using a midpoint displacement algorithm
Description
This 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.
Usage
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"),
...
)
Arguments
x |
A |
pad |
Integer. Number of cells by which to pad |
type |
One of the supported |
... |
Further arguments passed to |
Value
A RasterLayer
/SpatRaster
with same extent as x
, with randomly generated values.
See Also
nlm_mpd
Examples
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)
}
[Package SpaDES.tools version 2.0.7 Index]