pub fn preprocess(
values: &Array2<f64>,
water_ntile: f64,
lake_flatness: i32,
vertical_ratio: f64,
flatness_scale: f64,
stats_region: Option<&[bool]>,
) -> Result<Array2<f64>>Expand description
flatness_scale density-compensates the lake-flatness test: it
multiplies the normalized threshold (lake_flatness/255). 1.0 = naive
upstream semantics at the grid’s own sampling. For a disc grid viewed
through a coarser anisotropic window, pass (disc_step /
display_row_step) so the test measures the same terrain slope at any
sampling density.
stats_region: optional boolean mask restricting the cells used for the
normalization min/max and the water percentile. When decisions are made
on a big disc but displayed through a smaller window, pass the window’s
footprint so the water level matches what upstream’s window-scoped
percentile would have computed; the resulting mask is still attached to
fixed physical locations (rotation-stable).