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

Refactor flats/sills tests #32

Closed wkearn closed 2 months ago

wkearn commented 2 months ago

The previous tests ensured that the labeled flats and sills were correct, but they did not ensure that every pixel that should be either a flat or a sill was correct. This refactors the random_dem test to make it easier to add new properties. We now compute certain features of the neighborhood like the number of neighbors higher than the current pixel or the number of neighbors that are sills in the loop over the neighborhood. After leaving that loop, we test various properties that are expected of these neighborhood statistics.

Two new tests are added to ensure that any pixel that has no lower neighbors is labeled a flat and that every pixel that borders a flat that has the same elevation as it and has a lower neighbor is labeled a sill.