This function applies a height-based mask to a Canopy Height Model (CHM),
focusing on areas with heights above a specified lower
threshold and,
optionally, below an upper
threshold.
Usage
mosaic_chm_mask(
dsm,
lower,
upper = NULL,
window_size = c(5, 5),
interpolation = "Tps"
)
Arguments
- dsm
A
SpatRaster
object representing the digital surface model. Must be a single-layer raster.- lower
A numeric value specifying the lower height threshold. All heights greater than this value are retained.
- upper
An optional numeric value specifying the upper height threshold. If provided, only heights between
lower
andupper
are retained.- window_size
An integer (meters) specifying the window size (rows and columns, respectively) for creating a DTM using a moving window. Default is c(10, 10).
- interpolation
(optional) A character string specifying the interpolation method to use when
points
are provided. Options are "Kriging" (default) or "Tps" (Thin Plate Spline).
Details
The mosaic_chm
function, used internally, generates the DTM from the DSM by
downsampling and smoothing raster data, applying a moving window to extract
minimum values and then interpolating the results. The CHM is computed as the
height difference between the DSM and DTM. This function calculates and
applies a mask based on height thresholds.