basindelin: Delineates hydrological or cold-air drainage basins

View source: R/cadtools.R

basindelinR Documentation

Delineates hydrological or cold-air drainage basins

Description

The function basindelin uses a digital elevation dataset to delineate hydrological basins, merging adjoining basis separated by a low boundary if specified.

Usage

basindelin(dtm, boundary = 0)

Arguments

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.

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.

Value

a SpatRast of basins sequentially numbered as integers.

Examples

library(terra)
basins <- basindelin(rast(dtm100m))
plot(basins, main = "Basins")

ilyamaclean/microclima documentation built on Sept. 5, 2024, 8:37 p.m.