Computes one or more terrain metrics from a user-supplied bathymetric or elevation raster.
Usage
derive_terrain(
x,
metrics = "default",
scales = NULL,
units = c("degrees", "radians"),
neighbors = 8,
positive_depth = NULL,
filename = "",
overwrite = FALSE,
progress = TRUE
)Arguments
- x
A raster-like object accepted by
as_bathy().- metrics
Character vector of metrics, or
"default".- scales
Optional BPI/TPI window sizes used when multiscale BPI is requested.
- units
Slope and aspect units,
"degrees"or"radians".- neighbors
Neighborhood passed to
terra::terrain().- positive_depth
Optional logical documenting the input sign convention. Metric values are not sign-flipped unless a specific function says so.
- filename
Optional output raster path.
- overwrite
Logical. Allow overwriting
filename.- progress
Logical. Reserved for long-running workflows.
Value
A terra::SpatRaster containing named metric layers.
Details
Terrain metrics are scale-sensitive. Slope, curvature, rugosity, TPI, BPI, roughness, and surface-area style metrics depend on grid resolution, smoothing, and focal-window size. Use projected coordinate systems when distances or slopes are interpreted in real linear units.
Examples
bathy <- read_bathy(blueterra_example("bathy"))
terrain <- derive_terrain(bathy, metrics = c("slope", "aspect", "bpi"))
names(terrain)
#> [1] "slope_deg" "aspect_deg" "bpi_3x3" "bpi_11x11"
