frs_order_child: classify direct children of large-order streams
Post-classification function to add rearing (or other habitat labels) for segments on direct tributaries of large rivers where channel width measurements underrepresent habitat value. Runs after frs_cluster.
Why
Small streams flowing directly into large rivers support rearing even when measured channel width is below the species threshold. The parent river supplies flow, temperature, and access. Channel width measurement on these small streams doesn't reflect the biological reality of being connected to a large system.
The concept: direct children
"Direct child" = stream_order equals stream_order_max on the blue_line_key. The entire tributary IS that order — it flows directly into the parent river, not a sub-tributary within a larger network.
Distance
Walks upstream from the tributary mouth (DRM 0). distance_max caps how far up to include — the lower portion of the tributary where fish actually rear.
No separate gradient_max parameter needed — the species rear_gradient_max already filtered segments during frs_habitat_classify.
Parameters
frs_order_child(conn, table, habitat,
species,
label = "rearing",
parent_order_min = 5, # minimum stream_order_parent
child_order_min = NULL, # NULL = 1 (any order)
child_order_max = NULL, # NULL = stream_order_max (direct children only)
distance_max = NULL) # NULL = whole tributary, or metres from mouth (DRM <= N)
Usage
# Direct children of order 5+ rivers, first 300m, any order
frs_order_child(conn, table, habitat, species = "BT",
parent_order_min = 5, distance_max = 300)
# Only 3rd order and above direct children
frs_order_child(conn, table, habitat, species = "BT",
parent_order_min = 5, child_order_min = 3)
# Only 1st and 2nd order direct children, 100m from mouth
frs_order_child(conn, table, habitat, species = "BT",
parent_order_min = 5, child_order_max = 2, distance_max = 100)
SQL
UPDATE habitat SET rearing = TRUE
FROM streams s
WHERE accessible = TRUE
AND rearing IS NOT TRUE
AND s.stream_order = s.stream_order_max
AND s.stream_order_parent >= parent_order_min
AND s.stream_order >= child_order_min
AND s.stream_order <= child_order_max
AND s.downstream_route_measure <= distance_max
Requirements
- stream_order_parent (fwa_stream_networks_order_parent, by blue_line_key)
- stream_order_max (fwa_stream_networks_order_max, by blue_line_key)
- Both via frs_col_join
Relates to NewGraphEnvironment/bcfishpass#10
frs_order_child: classify direct children of large-order streams
Post-classification function to add rearing (or other habitat labels) for segments on direct tributaries of large rivers where channel width measurements underrepresent habitat value. Runs after frs_cluster.
Why
Small streams flowing directly into large rivers support rearing even when measured channel width is below the species threshold. The parent river supplies flow, temperature, and access. Channel width measurement on these small streams doesn't reflect the biological reality of being connected to a large system.
The concept: direct children
"Direct child" = stream_order equals stream_order_max on the blue_line_key. The entire tributary IS that order — it flows directly into the parent river, not a sub-tributary within a larger network.
Distance
Walks upstream from the tributary mouth (DRM 0). distance_max caps how far up to include — the lower portion of the tributary where fish actually rear.
No separate gradient_max parameter needed — the species rear_gradient_max already filtered segments during frs_habitat_classify.
Parameters
Usage
SQL
Requirements
Relates to NewGraphEnvironment/bcfishpass#10