krig_gd {wingen}R Documentation

Krige moving window maps

Description

Perform interpolation of the raster(s) produced by window_gd using autoKrige

Usage

krig_gd(
  r,
  grd = NULL,
  index = 1,
  coords = NULL,
  agg_grd = NULL,
  disagg_grd = NULL,
  agg_r = NULL,
  disagg_r = NULL,
  autoKrige_output = FALSE,
  lower_bound = TRUE,
  upper_bound = TRUE,
  krig_method = "ordinary",
  resample = FALSE,
  resample_first = TRUE
)

Arguments

r

SpatRaster produced by window_gd

grd

object to create grid for kriging; can be a SpatRaster or RasterLayer. If undefined, will use r to create a grid.

index

integer indices of layers in raster stack to krige (defaults to 1; i.e., the first layer)

coords

if provided, kriging will occur based only on values at these coordinates. Can be provided as an sf points, a two-column matrix, or a data.frame representing x and y coordinates

agg_grd

factor to use for aggregation of grd, if provided (this will decrease the resolution of the final kriged raster; defaults to NULL)

disagg_grd

factor to use for disaggregation of grd, if provided (this will increase the resolution of the final kriged raster; defaults to NULL)

agg_r

factor to use for aggregation of r, if provided (this will decrease the number of points used in the kriging model; defaults to NULL)

disagg_r

factor to use for disaggregation, of r if provided (this will increase the number of points used in the kriging model; defaults to NULL)

autoKrige_output

whether to return full output from autoKrige including uncertainty rasters (defaults to FALSE). If TRUE, returns a list with the kriged input raster layer ("raster"), kriged variance ("var"), kriged standard deviation ("stdev"), and full autoKrige output ("autoKrige_output").

lower_bound

if TRUE (default), converts all values in the kriged raster less than the minimum value of the input raster, to that minimum

upper_bound

if TRUE (default), converts all values in the kriged raster greater than the maximum value of the input raster, to that maximum

krig_method

method to use for kriging. If ordinary, ordinary/simple kriging is performed (formula: ~ 1; default). If universal, universal kriging is performed (formula = ~ x + y).

resample

whether to resample grd or r. Set to "r" to resample r to grd. Set to "grd" to resample grd to r (defaults to FALSE for no resampling)

resample_first

if aggregation or disaggregation is used in addition to resampling, specifies whether to resample before (resample_first = TRUE) or after (resample_first = FALSE) aggregation/disaggregation (defaults to TRUE)

Value

a SpatRaster object or a list of autoKrige outputs (if autoKrige_output = TRUE)

Examples

load_mini_ex()
wpi <- window_gd(mini_vcf, mini_coords, mini_lyr, L = 10, rarify = TRUE)
kpi <- krig_gd(wpi, mini_lyr)
plot_gd(kpi, main = "Kriged Pi")


[Package wingen version 2.1.2 Index]