
The fundamental watersheds that FWA_Upstream reaches from some of them
Source:R/wet_ws_closure.R
wet_ws_reach.RdWhich rows of ws lie in the FWA_Upstream set of at least one of the
rows from (each counting itself), by the same ranges
wet_upstream_sums() sums over, with irregularly coded polygons from
irregular_pairs. Over an upstream-closed ws such as
wet_ws_closure()'s, those rows are the least set that gives the from
rows their sums: wet_upstream_sums() over them, with irregular_pairs
cut to the id_up rows kept, gives the from rows the same sums as over
all of ws, up to the order the doubles are added in.
Arguments
- ws
data.framewithwatershed_feature_id,wscodeandlocalcode(FWA ltree codes as text).- from
Logical, one per row of
ws: the rows whose upstream sets to join.- irregular_pairs
Optional
data.frame(watershed_feature_id, id_up), aswet_upstream_sums()takes it. Without it, irregularly coded rows are left out with a warning, aswet_upstream_sums()leaves them out.
Examples
ws <- data.frame(watershed_feature_id = 1:5,
wscode = c("100", "100", "100.000300", "100.000300", "100.000700"),
localcode = c("100", "100.000500", "100.000300", "100.000300.000010",
"100.000700"))
# row 2 sits on the main stem above position 000500: it reaches itself
# and the tributary at 000700, not row 1 or the tributary at 000300
wet_ws_reach(ws, ws$watershed_feature_id == 2)
#> [1] FALSE TRUE FALSE FALSE TRUE