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 5 forks source link

Test all pixels, not just interior ones #36

Closed wkearn closed 5 months ago

wkearn commented 5 months ago

Many of the tests as written did not work for pixels that are on the border, which have slightly different rules. A sill pixel on the border does not need to have lower neighbors because it is considered an outlet. Such pixels might otherwise count as flats, if they have no lower neighbors and are surround by higher neighbors, so we also need to check if the pixel is on the border for those tests.

test/random_dem.cpp now scans every pixel and checks the properties accordingly, border pixels are managed by skipping neighbors that are outside the bounds of the array and by the flag current_pixel_on_border, which is used to skip tests whose properties only hold for pixels on the interior