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

Identify flat pixels in DEM #31

Closed wkearn closed 5 months ago

wkearn commented 5 months ago

Resolves #8

src/identifyflats.c adds the function identifyflats, which labels pixels in a DEM whose elevation is equal to the minimum elevation of their neighbors (flats) or whose elevation is equal to that of a neighboring flat (sills).

src/CMakeLists.txt adds src/identifyflats.c the library sources

include/topotoolbox.h adds the prototype for identifyflats

test/fillsinks.cpp is renamed to test/random_dem.cpp because we use random DEMs to test a variety of TopoToolbox functions

test/random_dem.cpp now runs identifyflats after fillsinks to label flats and sills in the DEM. The following properties are tested:

  1. No flat pixel should have a neighbor that is lower than it
  2. Every sill pixel should have at least one neighbor lower than it
  3. Every sill pixel should border a flat pixel

These tests are incorporated into the loop over neighboring pixels.

test/CMakeLists.txt renames the fillsinks test to the random_dem test.