get_streamorder: Get Streamorder

Description Usage Arguments Value Examples

View source: R/get_codes.R

Description

Applies a topological sort and calculates 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 max upstream order.

Usage

1
get_streamorder(x, status = FALSE)

Arguments

x

data.frame with dendritic ID and toID columns.

status

logical emit progress update messages?

Value

numeric stream order in same order as input

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
source(system.file("extdata", "walker_data.R", package = "nhdplusTools"))

test_flowline <- prepare_nhdplus(walker_flowline, 0, 0, FALSE)

test_flowline <- data.frame(
  ID = test_flowline$COMID,
  toID = test_flowline$toCOMID)

(order <- get_streamorder(test_flowline))

walker_flowline$order <- order

plot(sf::st_geometry(walker_flowline), lwd = walker_flowline$order, col = "blue")

nhdplusTools documentation built on Aug. 18, 2021, 5:07 p.m.