Learn R Programming

SpaDES.tools (version 0.1.1)

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, 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.

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 {
library(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)
Plot(map1)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab