View source: R/add_streamorder-level.R
add_streamorder | R Documentation |
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.
add_streamorder(x, status = TRUE)
## S3 method for class 'data.frame'
add_streamorder(x, status = TRUE)
## S3 method for class 'hy'
add_streamorder(x, status = TRUE)
x |
data.frame network compatible with hydroloom_names. |
status |
boolean if status updates should be printed. |
data.frame containing added stream_order
and stream_calculator
attribute.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.