Skip to contents

Raises each cell to the lowest spill elevation reachable from the grid edge or NA cells (Barnes, Lehman and Mulla 2014); epsilon > 0 adds a minimal gradient.

Usage

FillSinks(dem, epsilon = 0)

Arguments

dem

Elevation matrix.

epsilon

Gradient increment.

Value

Filled matrix.

References

Barnes, R., Lehman, C. and Mulla, D. (2014). Priority-flood: an optimal depression-filling and watershed-labeling algorithm for digital elevation models. Computers and Geosciences 62, 117-127.

Examples

FillSinks(rbind(c(5, 5, 5), c(5, 1, 5), c(5, 5, 5)))
#>      [,1] [,2] [,3]
#> [1,]    5    5    5
#> [2,]    5    5    5
#> [3,]    5    5    5