View source: R/add_streamorder-level.R
add_streamlevel | R Documentation |
Applies a topological sort and calculates stream level. Algorithm: Terminal level paths are assigned level 1 (see note 1). Paths that terminate at a level 1 are assigned level 2. This pattern is repeated until no paths remain.
If a TRUE/FALSE coastal attribute is included, coastal terminal paths begin at 1 and internal terminal paths begin at 4 as is implemented by the NHD stream leveling rules.
add_streamlevel(x, coastal = NULL)
## S3 method for class 'data.frame'
add_streamlevel(x, coastal = NULL)
## S3 method for class 'hy'
add_streamlevel(x, coastal = NULL)
x |
data.frame network compatible with hydroloom_names. |
coastal |
character attribute name containing a logical flag indicating if a given terminal catchment flows to the coast of is an inland sink. If no coastal flag is included, all terminal paths are assumed to be coastal. |
data,frame containing added stream_level
attribute
x <- sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom"))
x <- add_toids(x)
y <- add_streamlevel(x)
plot(sf::st_geometry(y), lwd = y$streamlevel, col = "blue")
x$coastal <- rep(FALSE, nrow(x))
y <- add_streamlevel(x, coastal = "coastal")
unique(y$streamlevel)
x$coastal[!x$Hydroseq == min(x$Hydroseq)] <- TRUE
y <- add_streamlevel(x)
unique(y$streamlevel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.