powered by
Generates a Gaussian random field (GRF) based on the Matern model of spatial autocorrelation.
grf(x, range, fun = "scale", ...)
A SpatRaster object containing the generated Gaussian random field.
SpatRaster
A template raster of class SpatRaster (from the terra package).
Numeric. The range parameter of the variogram model (in spatial units of x raster).
x
A function to apply to the generated values (default is scale to standardize the GRF).
scale
Additional arguments passed to the function specified in fun.
fun
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