Skip to content

Apply bridge gradient along downstream path in frs_cluster#157

Merged
NewGraphEnvironment merged 4 commits intomainfrom
153-cluster-bridge-path
Apr 14, 2026
Merged

Apply bridge gradient along downstream path in frs_cluster#157
NewGraphEnvironment merged 4 commits intomainfrom
153-cluster-bridge-path

Conversation

@NewGraphEnvironment
Copy link
Copy Markdown
Owner

Summary

  • Apply bridge_gradient and bridge_distance along the downstream trace path in frs_cluster — segment-by-segment gradient stop and distance cap via fwa_downstreamtrace
  • Upstream check remains boolean (FWA_Upstream — spawning exists anywhere upstream). Path gradient is unreliable upstream because FWA_Upstream returns all tributaries; row_number() interleaves tributary segments with mainstem, incorrectly disconnecting rearing near mainstem spawning
  • direction="both": upstream boolean + downstream path gradient

Test plan

  • 705 tests pass
  • Code-check clean
  • ADMS: no regression from 0.13.6 baseline
  • BULK: CH rearing improved from prior +6% excess

Fixes #153
Relates to NewGraphEnvironment/sred-2025-2026#16

🤖 Generated with Claude Code

NewGraphEnvironment and others added 4 commits April 14, 2026 08:43
Relates to #153

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Upstream cluster check now traces segment-by-segment via FWA_Upstream
join against the streams table, mirroring the downstream pattern:
cluster_maximums → upstream segments ordered ASC → distance cap →
nearest_connect vs nearest_barrier → keep if spawning before barrier.

Previously used FWA_Upstream as a boolean ("does spawning exist anywhere
upstream?") with no gradient or distance constraint. This caused excess
rearing: clusters passed the upstream check even when a >5% gradient
barrier existed between rearing and spawning.

Both .frs_cluster_upstream() and .frs_cluster_both() updated.

Relates to #153

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* main:
  Bump to v0.13.6 and archive PWF for issue #154
  Support spawn_connected rules for waterbody-adjacent spawning (#155)
FWA_Upstream returns all upstream segments including tributaries.
row_number() on a branching network interleaves tributary segments
with mainstem — a steep tributary gets a lower rn than nearby
mainstem spawning, incorrectly disconnecting rearing 123m from
spawning with zero gradient.

Upstream check reverted to boolean FWA_Upstream (spawning exists
anywhere upstream). Downstream path gradient kept — fwa_downstreamtrace
is linear, row_number works. direction="both" now correctly combines
upstream boolean + downstream path gradient.

Relates to #153

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NewGraphEnvironment NewGraphEnvironment merged commit 899fb62 into main Apr 14, 2026
1 check passed
@NewGraphEnvironment NewGraphEnvironment deleted the 153-cluster-bridge-path branch April 14, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

frs_cluster: apply bridge_gradient and bridge_distance along path

1 participant