interpBathy | R Documentation |
Generate a bathymetric digital elevation model (DEM) for a given waterbody using either Inverse Distance Weighting or Ordinary Kriging interpolation. For high densities of point data, we recommend rarifying prior to interpolation to improve accuracy and reduce computation time (see rarify function).
interpBathy(
outline,
df,
x,
y,
z,
zeros = FALSE,
separation = NULL,
crsUnits = "dd",
res = 10,
method = "IDW",
fact = NULL,
nmax = 20,
idp = 2,
model = "Sph",
psill = NULL,
range = NULL,
nugget = 0,
kappa = NULL
)
outline |
shapefile outline of a waterbody |
df |
dataframe of coordinates and depths for a given waterbody |
x |
character giving name of longitude column |
y |
character giving name of latitude column |
z |
character giving name of depth column |
zeros |
logical describing if bounding zeros are needed (FALSE) or provided (TRUE), default = FALSE |
separation |
number describing distance between points, units from CRS |
crsUnits |
character describing CRS units of input outline, either "dd" (decimal degrees) or "m" (meters), default = "dd" |
res |
number describing desired cell resolution in meters, default = 10 |
method |
character describing method of interpolation, options include Inverse Distance Weighted ("IDW") or Ordinary Kriging ("OK"). Default = "IDW" |
fact |
numeric value describing the factor by which raster resolution should be increased, default = NULL If 'crsUnits' and 'res' are defined, fact = NULL |
nmax |
numeric value describing number of neighbors used in interpolation, default = 20 |
idp |
numeric value describing inverse distance power value for IDW interpolation |
model |
character describing type of model used in Ordinary Kriging, options include 'Sph', 'Exp', 'Gau', 'Sta', default = 'Sph' |
psill |
numeric value describing the partial sill value for OK interpolation, default = NULL |
range |
numeric describing distance beyond which there is no spatial correlation in Ordinary Kriging models, default = NULL |
nugget |
numeric describing variance at zero distance in Ordinary Kriging models, default = 0 |
kappa |
numeric value describing model smoothness, default = NULL |
If 'res' and 'crsUnits' are specified (recommended), the output raster is returned in the original projection at the specified resolution. If 'res' and 'crsUnits' are not specified, 'fact' must be defined as a numeric value by which the resolution of the output DEM will be increased (1 = no change). Output raster will be returned in the original projection of the input.
For the model argument there are four different methods included here that are supported by gstat::vgm ("Sph", "Exp", "Gau", "Mat"). "Sph" = The default gstat::vgm method. Spherical model characterized by a curve that rises steeply to defined range then flattens, indicates no spatial correlation between points beyond that range. "Exp" = Exponential model characterized by spatial correlation decaying with distance. "Gau" = Gaussian model similar to spatial model but with stronger decay at shorter distances. "Mat" = Matern model Three parameters (psill, range, kappa) are incorporated from a fitted variogram (default = NULL). If specified in function input, chosen values will overwrite variogram values.
DEMs generated using OK method will have two layers; the first are the interpolated values and the second are the variances associated with each measurement
DEM of waterbody bathymetry
Tristan Blechinger & Sean Bertalot, Department of Zoology & Physiology, University of Wyoming
#load example outline
outline <- terra::vect(system.file("extdata", "example_outline.shp", package = 'rLakeHabitat'))
#load example xyz data
data <- read.csv(system.file("extdata", "example_depths.csv", package = 'rLakeHabitat'))
#run function
interpBathy(outline, data, "x", "y", "z", zeros = FALSE, separation = 10,
crsUnit = "dd", res = 5, method = "IDW", nmax = 4, idp = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.