Learn R Programming

mrangr (version 1.0.1)

grf: Generate a Gaussian Random Field

Description

Generates a Gaussian random field (GRF) based on the Matern model of spatial autocorrelation.

Usage

grf(x, range, fun = "scale", ...)

Value

A SpatRaster object containing the generated Gaussian random field.

Arguments

x

A template raster of class SpatRaster (from the terra package).

range

Numeric. The range parameter of the variogram model (in spatial units of x raster).

fun

A function to apply to the generated values (default is scale to standardize the GRF).

...

Additional arguments passed to the function specified in fun.

Examples

Run this code
library(terra)
r <- rast(nrows = 100, ncols = 100, xmin = 0, xmax = 100, ymin = 0, ymax = 100)
grf_field <- grf(r, range = 30)
plot(grf_field)


Run the code above in your browser using DataLab