
Nested-set upstream index for a hydrofabric (flowpath + nexus grain)
Source:R/network_properties.R
hf_upstream_index.RdResolves the `flowpath -> nexus -> flowpath` topology to a direct flowpath graph and runs [upstream_index()] over it. Shared by [write_hydrofabric()] so a hydrofabric is indexed the same way however it is written. A divergent nexus (two downstreams) is flagged; the index is exact only on a rooted tree.
Usage
hf_upstream_index(
flowpaths,
nexus = NULL,
fp_id = "flowpath_id",
fp_toid = "flowpath_toid",
nex_id = "nexus_id",
nex_toid = "nexus_toid"
)Value
A data frame with `flowpath_id`, `upstream_id`, `num_upstreams` aligned to `flowpaths` (attributes `n_outlets`, `n_divergences`, `n_bad`).
See also
Other network properties:
accumulate_downstream(),
get_hydroseq(),
get_levelpath(),
get_pathlength(),
get_pfafstetter(),
get_streamlevel(),
get_streamorder(),
merge_groups(),
upstream_index()
Examples
fp <- data.frame(flowpath_id = c("1","2","3"), flowpath_toid = c("nex-9","0","nex-9"))
nex <- data.frame(nexus_id = "nex-9", nexus_toid = "2")
hf_upstream_index(fp, nex)
#> flowpath_id upstream_id num_upstreams
#> 1 1 3 0
#> 2 2 1 2
#> 3 3 2 0