Learn R Programming

SpaDES.tools (version 0.3.6)

gaussMap: Produce a raster of a random Gaussian process.

Description

This is a wrapper for the RFsimulate function in the RandomFields package. The main addition is the speedup argument which allows for faster map generation. A speedup of 1 is normal and will get progressively faster as the number increases, at the expense of coarser pixel resolution of the pattern generated.

Usage

gaussMap(
  x,
  scale = 10,
  var = 1,
  speedup = 1,
  method = "RMexp",
  alpha = 1,
  inMemory = FALSE,
  ...
)

Arguments

x

A spatial object (e.g., a RasterLayer).

scale

The spatial scale in map units of the Gaussian pattern.

var

Spatial variance.

speedup

An numeric value indicating how much faster than 'normal' to generate maps. It may be necessary to give a value larger than 1 for large maps. Default is 1.

method

The type of model used to produce the Gaussian pattern. Should be one of "RMgauss" (Gaussian covariance model), "RMstable" (the stable powered exponential model), or the default, "RMexp" (exponential covariance model).

alpha

A required parameter of the 'RMstable' model. Should be in the interval [0,2] to provide a valid covariance function. Default is 1.

inMemory

Should the RasterLayer be forced to be in memory? Default FALSE.

...

Additional arguments to raster.

Value

A raster map with same extent as x, with a Gaussian random pattern.

See Also

RFsimulate and extent

Examples

Run this code
# NOT RUN {
if (require(RandomFields)) {
  library(raster)
  nx <- ny <- 100L
  r <- raster(nrows = ny, ncols = nx, xmn = -nx/2, xmx = nx/2, ymn = -ny/2, ymx = ny/2)
  speedup <- max(1, nx/5e2)
  map1 <- gaussMap(r, scale = 300, var = 0.03, speedup = speedup, inMemory = TRUE)
  if (interactive()) Plot(map1)

  # with non-default method
  map1 <- gaussMap(r, scale = 300, var = 0.03, method = "RMgauss")
}
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab