Fill sinks

Algorithm

The Fill sinks operation removes local depressions from a DEM by replacing these local depressions by flat areas in the output DEM.

Process:

  1. Removal of depressions that consist of a single pixel (local pits, i.e. any pixel with a smaller height value than its 8 neighbouring pixels):
  2. When a single pixel is encountered that has a smaller height value than all of its 8 neighbours (Fig. 1a);

     

    Figure 1a: Find a sink that consists of a single pixel (pixel in red).   Figure 1b: Assign to this pixel, the smallest value found among its 8 neighbour pixels (pixel in green).
     

     

  3. Removal of depressions that consist of multiple pixels (i.e. any group of adjacent pixels where the pixels have smaller height values than all pixels that surround such a depression):
  4. General process:

    When a group of adjacent pixels is encountered where the pixels have smaller height values than all neighbours of this group;

    Detailed process:

    1. Scan the DEM, from top to bottom and from left to right, to find the first pixel that is part of a sink area (Fig. 2a).
    2. In other words, find a pixel with lower or equal height value than all its 8 neighbours.

    3. Determine all pixels that contribute to this particular sink (Fig. 2b).
    4. In other words, find the catchment area of this sink; iterative process evaluating height values of outward neighbours.

    5. Locate the outlet pixel for this sink and determine the value of the pixel just 'before' the outlet (Fig. 2c).
    6. Then:

    7. For all pixels that contribute to this sink and that have a value smaller than the value that was kept in mind in step 2c, assign these pixels the height value found in step 2c (Fig. 2d).
    8. In other words, sinks are 'filled up' so that flat areas are formed which will definitely have an outlet.

    9. Mark all pixels of the catchment that was currently handled, so that these pixels will not be scanned again.
    10. Continue scanning the DEM to find another initial sink.
  5. Additional rules:

  6. The height values of the following pixels will never be changed in the output map:

Figures explaining the detailed process of filling depressions of multiple pixels:

Figure 2a: Find first sink (pixel in black).   Figure 2b: Find all pixels that contribute to this sink (colored pixels).
 

 

Figure 2c: Determine the outlet for this sink (pixel in black), and determine the pixel just before the outlet (pixel in blue). Keep the value of the pixel just before the outlet in mind (value 3).   Figure 2d: To all pixels that contribute to this sink and which have a smaller value than the value kept in mind in 2c, assign the height value kept in mind in 2c (pixels in black).
 

 

See also: