Skip to contents

Identifies and masks the top or bottom quantile of elevation values within a given polygon overlaying a digital elevation model (DEM).

Usage

elevQuantile(dem, runout_ply, quant = 0.05, upper = TRUE)

Arguments

dem

A SpatRaster object representing a digital elevation model (DEM).

runout_ply

A SpatVector polygon (or compatible SpatialPolygons* object) defining the area from which to extract elevation values.

quant

A numeric value between 0 and 1 indicating the proportion (quantile) of elevation values to extract. Defaults to 0.05 (top/bottom 5%).

upper

Logical. If TRUE, the function selects the highest elevation percentile; if FALSE, it selects the lowest. Defaults to TRUE.

Value

A SpatRaster object where selected cells are marked with 1 and all others are set to NA.

Details

This function is useful for identifying areas of extreme elevation within a polygon, such as potential landslide release zones (upper) or deposition zones (lower), based on percentile thresholds.

Examples

if (FALSE) { # \dontrun{
library(terra)
dem <- rast("dem.tif")
runout_ply <- vect("runout_area.shp")
release_zone <- elevQuantile(dem, runout_ply, quant = 0.05, upper = TRUE)
} # }