Skip to contents

Adds a strahler stream order.

Algorithm: If more than one upstream flowpath has an order equal to the maximum upstream order then the downstream flowpath is assigned the maximum upstream order plus one. Otherwise it is assigned the maximum upstream order.

To match the NHDPlus algorithm, non-dendritic network connectivity and a divergence attribute must be included. All secondary paths will have the stream_order of upstream primary paths and a stream_calculator value of 0. Secondary paths have no affect on the order of downstream paths.

Requires a toid attribute or fromnode, tonode, and divergence attributes that will be used to construct a toid attribute.

Usage

add_streamorder(x, status = TRUE)

# S3 method for data.frame
add_streamorder(x, status = TRUE)

# S3 method for hy
add_streamorder(x, status = TRUE)

Arguments

x

data.frame network compatible with hydroloom_names.

status

boolean if status updates should be printed.

Value

data.frame containing added stream_order and stream_calculator attribute.

Examples

x <- sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom"))

x <- dplyr::select(x, COMID, FromNode, ToNode, Divergence)

x <- add_streamorder(x)

plot(sf::st_geometry(x), lwd = x$stream_order, col = "blue")

plot(sf::st_geometry(x), lwd = x$stream_calculator, col = "blue")