basindelin | R Documentation |
The function basindelin
uses a digital elevation dataset to delineate
hydrological basins, merging adjoining basis separated by a low boundary if specified.
basindelin(dtm, boundary = 0)
dtm |
a SpatRast object of elevations |
boundary |
optional numeric value. If greater than 0, adjoining basins separated by elevation differences < boundary are merged (see details. |
This function searches for the lowest grid cell in dtm
and assigns it
as basin 1. All immediately adjacent pixels (in 8 directions) not previously assigned
are then assigned as being part of this basin if higher than the focal cell. The process is repeated
until no higher further cells are found. The next lowest unassigned grid cell is identified
and assigned as basin 2 and the process repeated until all grid cells are assigned a basin number.
If boundary > 0
, edge grid cells are identified and the height difference from all
surrounding cells calculated. If the height difference is less than boundary
, basins
are merged and the basins renumbered sequentially.
a SpatRast of basins sequentially numbered as integers.
library(terra)
basins <- basindelin(rast(dtm100m))
plot(basins, main = "Basins")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.