scripts/0297's rule: a visit on a stream edge is in when its gradient lies in
[0, grad_max] and either the size test holds (width in
[size_min, 9999], or MAD at least size_min) or the exception does (a river
of at least exc_q m³/s within exc_d m downstream on the flow source
src). A NA gradient, width or MAD fails its test. The river, wetland and
lake branches of link's rules are constant across the rules a grid varies, so
a scoring population holds stream-branch visits only, and a visit off the
stream edges is out here.
Arguments
- d
data.frameof visits withedge_type,blue_line_key,downstream_route_measureand the columns named bycols.- rule
one row of
knw_tune_grid()'s table.- walks
the index
knw_walk_index()returns, orNULLwhen no rule in play has an exception.- cols
named
character: which columns ofdcarrygrad,widthandmad.- src
character(1)the flow source the exception reads.- edge_stream
integerthe stream-branch edge types.- no_lake_target, no_reg_target
logical(1)fail the exception where the river found is a lake segment, or lies on a regulated reach.
Examples
d <- data.frame(edge_type = c(1000, 1000, 1250), blue_line_key = 1, downstream_route_measure = 1:3,
segment_gradient = c(0.02, 0.02, 0.01), cw_deploy = c(2, 1, 50),
mad_pick = c(0.3, 0.1, 40))
r <- data.frame(size_var = "width", size_min = 1.5, grad_max = 0.0549, exc_q = NA, exc_d = NA)
knw_rule_in(d, r)
#> [1] TRUE FALSE FALSE
