#226: PARS vignette accessible_km bcfp-equivalence demo (v0.44.1)#229
Merged
Conversation
Extend PARS vignette to demonstrate accessible_km bcfp-equivalence. Full faithful regen scope: re-model stale fresh_default (GR) PARS post-#223, regenerate all cached artifacts, add accessible_km subsection. Phases + live-verified findings scaffolded. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kSEJoad4Bc553qU8eFiE6
Phase 2+3. data-raw/wsg_vignette_data.R gains a link (lnk_rollup_wsg) vs bcfp (streams_vw_bcfp, IN (1,2)) accessible/spawning/rearing km rollup -> pars_accessible.rds, mirroring parity_crosssection.R's validated computation. Adds a segmentation-parity guard that refuses to build the gpkg when fresh/fresh_default disagree by >1% (the pre-#223 grayling-corruption class). Regenerated all cached artifacts from the post-#223 merged state (fresh_default PARS re-modelled + merge=TRUE recompute first): accessible 6822.47|6822.88|-0.01% (exact), spawning +0.93%, rearing -0.53%; mapping_code parity 98.91%; gpkg 11.9 MB, 8 layers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kSEJoad4Bc553qU8eFiE6
Adds '### Accessible habitat (km)' under the parity section: a link-vs-bcfp km table (accessible/spawning/rearing) from pars_accessible.rds + computed prose (6,822.5 vs 6,822.9 km, -0.01%) bridging to the per-segment mapping_code disagreements. Loads pars_accessible.rds and lists it under Cached inputs. Fixes the stale hardcoded map captions (19,233/31,932/1,764) by inline-computing n_gr/n_bt/n_gronly from the loaded streams layer so they track the cached artifact. Verified via a DB-free knit (accessible numbers + computed captions render; stale values gone). code-check: guard diff_pct against a zero bcfp denominator (NA, not Inf/NaN) on the generic-reuse path; PARS artifact unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kSEJoad4Bc553qU8eFiE6
#226 PARS vignette accessible_km bcfp-equivalence demo + full post-#223 artifact regeneration (re-modelled fresh_default grayling schema, segmentation guard, computed map captions). Docs + data-gen only; patch bump. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kSEJoad4Bc553qU8eFiE6
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kSEJoad4Bc553qU8eFiE6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
vignettes/pars-habitat-connectivity.Rmdto demonstrateaccessible_kmbcfishpass-equivalence, and regenerates the cached artifacts from the post-#223 state.New Accessible habitat (km) section: a link-vs-bcfishpass roll-up table (bull-trout accessible / spawning / rearing, from cached
pars_accessible.rds) + computed prose — link models 6,822.5 km of accessible bull-trout habitat against bcfishpass's 6,822.9 km, a −0.01% difference (the #223 access-segmentation fix; spawning/rearing agree within the 5% habitat band). It bridges the two parity lenses: the aggregate habitat totals match to hundredths of a percent even where the per-segmentmapping_codedisagrees, because the disagreements fall on short reaches that don't move the totals.Full faithful regeneration (the load-bearing bit)
"Regenerate the artifacts from the merged state" was not docs-only.
fresh_default(the Arctic-grayling schema) was still on pre-#223 segmentation (48,558 PARS segments vsfresh's 97,538). The gpkg's singlestreamslayer joinsfreshgeometry +mapping_code_bttofresh_defaultmapping_code_gronid_segment, so a naive regeneration would have attached grayling tokens to mismatched geometry and shipped a corrupted grayling map.Fix: re-modelled the
defaultconfig for PARS intofresh_default(data-raw/wsg_run_one.R+ amerge = TRUErecompute viawsg_recompute_one.Rfor cross-WSG;DAM) so both configs share segmentation. The join is then faithful — exact GR segment count (19,232) and 99.93% aggregate length; the residual per-segment wiggle is local habitat-break redistribution, sub-pixel at basin scale. Added a segmentation-parity guard todata-raw/wsg_vignette_data.Rthat refuses a mixed-segmentation build so this class of bug can't silently recur.Also
data-raw/wsg_vignette_data.Rgains the accessible roll-up cache (pars_accessible.rds), mirroringdata-raw/parity_crosssection.R's validatedlnk_rollup_wsg()+fresh.streams_vw_bcfpIN (1,2)computation.mapping_codeparity refreshes 99.04% → 98.91% (denser post-BT/ST accessible_km over-credit: access segmentation drops the accessibility frontier #223 segmentation).lnk_db_conn()is in aneval = FALSEdemo chunk./code-checkguarded a latentdiff_pctdiv-by-zero on the generic-reuse path.pars.gpkg).Closes #226. Relates to #221, #223. SRED: NewGraphEnvironment/sred#24.
🤖 Generated with Claude Code
https://claude.ai/code/session_014kSEJoad4Bc553qU8eFiE6