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.
mosaic_chm_mask(
dsm,
lower,
upper = NULL,
window_size = c(5, 5),
interpolation = "Tps"
)An SpatRaster object representing the masked CHM.
A SpatRaster object representing the digital surface model. Must
be a single-layer raster.
A numeric value specifying the lower height threshold. All heights greater than this value are retained.
An optional numeric value specifying the upper height threshold.
If provided, only heights between lower and upper are retained.
An integer (meters) specifying the window size (rows and columns, respectively) for creating a DTM using a moving window. Default is c(10, 10).
(optional) A character string specifying the
interpolation method to use when points are provided. Options are
"Kriging" (default) or "Tps" (Thin Plate Spline).
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.