TopoToolbox / libtopotoolbox

A C library for the analysis of digital elevation models.
https://topotoolbox.github.io/libtopotoolbox/
GNU General Public License v3.0
0 stars 3 forks source link

Identify presills #33

Closed wkearn closed 2 months ago

wkearn commented 2 months ago

Output whether a pixel is a presill, a flat which borders a sill of the same height. The output of identifyflats is a 32-bit bitfield where the zeroth bit identifies flats, the first bit identifies sills and the second bit identifies presills. Presill pixels thus have the value 5, because all presills are also flats. This is more complicated to use, but it enables identifying flats, sills and presills with a single bitwise and rather than multiple checks. While we do export identifyflats, I anticipate that users are mostly likely to use it in the context of running the entire flow-routing process, so they won't need to deal with the complicated output type.

Presills are needed for #9.

src/identifyflats.c now identifies presills while scanning through the DEM.

test/random_dem.cpp adds tests for the new behavior of identifyflats.