to_flownetwork {hydroloom} | R Documentation |
to flownetwork
Description
converts an hy
object into a flownetwork with "id", "toid",
"upmain" and "downmain attributes.
Usage
to_flownetwork(x, warn_dendritic = TRUE)
Arguments
x |
data.frame network compatible with hydroloom_names. |
warn_dendritic |
logical if TRUE and a dendritic |
Details
Required attributes:
id
and toid
or fromnode
and tonode
divergence
an attribute containing 0, 1, or 2 where 0 indicates there is only one
downstream connection, 1 is the main connection downstream
of a diversion and 2 is secondary connection downstream of a diversion.
levelpath
,
integer attribute which will have one and only one matching value upstream
at a confluence.
Value
data.frame "id", "toid", "upmain" and "downmain attributes. A check is run to ensure upmain and downmain are valid with one and only one upmain and one and only one downmain from any given network element.
Examples
f <- sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom"))
to_flownetwork(f)