Snow-departure vignette for the Kootenay Lake region (v0.2.1)#57
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the FWCP Peace pattern at smaller scale:
data-raw/example_aoi_kootenay_lake.R - unions four BC FWA watershed
groups (KOTL + LARL + DUNC + SLOC) via bcdata. Output is
inst/extdata/example_aoi_kootenay_lake.gpkg, ~24,200 km^2,
bbox 49N-51N / 118.5W-115.5W. Anchored on Kootenay Lake;
LARL captures Trail/Rossland/Red Mountain at the south end.
data-raw/example_context_kootenay_lake.R - bundled context layers
via fresh (fwapg). 12 towns (Nelson, Castlegar, Trail, Rossland,
Kaslo, Nakusp, Slocan, New Denver, Argenta, Crawford Bay,
Kimberley, Cranbrook), 24 lakes >200 ha (vs Peace's 1000 ha
threshold - smaller AOI supports more detail), named rivers,
stream segments order>=5, highways, the 4 WSGs as polygons,
4 ecoregions clipped to AOI (TOP, SBF, NCM, PTR). Geometries
simplified at 50 m tolerance (vs Peace's 200 m). Output
inst/extdata/context_kootenay_lake.gpkg is 2.2 MB.
Existing KOTL bundled assets (example_aoi_kotl.gpkg etc.) stay in
place for the README quick-start - new AOI lives alongside under
the kootenay_lake_* namespace, doesn't replace.
Caught and fixed an inherited filter bug: Kaslo / Nakusp / Slocan /
New Denver are stored in the GNS as feature_type 'Village (1)' not
'Village'. Added 'Village (1)' to the SELECT filter. The Peace
script's town list happened to not have any feature_type=='Village'
entries so the bug was latent.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 2 - data-raw/kootenay_lake_vignette_data.R precomputes the heavy data via cd_extract -> cd_baseline -> cd_anomaly -> cd_trend -> cd_compare for the regional + per-ecoregion + per-WSG breakdowns, plus the spatial-pattern tmean departure raster, plus the WSG x ecoregion overlap (4 WSGs x 4 ecoregions = 12 non-zero cells, small enough to inline into the rds). Output: inst/vignette-data/ kootenay_lake.rds (404 KB) + kootenay_lake_departure_tmean.tif (3 KB). Mirrors data-raw/peace_fwcp_vignette_data.R with the per-WSG list added. Phase 3 - vignettes/kootenay-lake.Rmd cloned from peace-fwcp.Rmd and adapted to the Kootenay context. Section structure mirrors the Peace vignette: Area of Interest, Connect to the Data Catalog, Extract Climate Time Series, Trends, Daytime Highs and Overnight Lows, Snowpack (seasonal table + 4 annual time-series + per-WSG facets - new), Recent vs Pre-warming, Spatial Pattern, Per-Ecoregion Variation (with Snow per ecoregion + Snow per watershed group sub-sections), Watershed Groups Across Ecoregions, Interpretation, References. Bibliography reuses vignettes/references.bib (11 entries from #54). Headline numbers (regional, 2015-2025 vs 1951-1980 baseline): Annual SWE -23% (Peace was -10%) Annual snowfall -15% (Peace was -6%) Annual snowmelt -16% (Peace was -7%) DOY-50 shift -12.6 days earlier Annual prcp -7% SIGNIFICANT (Peace was roughly stable) The Kootenay story differs sharply from Peace - in Peace, snow was "redistributed" (less summer, more spring melt) on flat snowfall; in the Kootenays, total annual snowfall is also down, consistent with Knowles 2006's threshold finding that significant snowfall-fraction declines occur where winter wet-day Tmin > -5C (Kootenays sit in that regime; Peace doesn't). And precipitation itself is declining here, not flat - making this a "warmer AND drier" story rather than the Peace's "warmer with mostly-stable precipitation." Phase 4 - Watershed Groups Across Ecoregions section adapted for the 4-WSG AOI. WSG x ecoregion overlap table built from the rds inline (no separate commentary CSV needed - 4 rows is small). KOTL/DUNC/SLOC are essentially within Northern Columbia Mountains; LARL is the only WSG that meaningfully splits across two ecoregions (NCM + Selkirk-Bitterroot Foothills). Render: 6.8 s. 12 csl-entries in References. 166 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
74 paired station-years across 3 usable Kootenay ASWS sites (Moyie Mountain 1835m Purcells, Redfish Creek 2100m Selkirks alpine, Farron 1230m insufficient years). Pooled r=0.90 (vs Peace's 0.51 — much better correlation). Mean bias -54% (vs Peace's -36% — sharper). Bias stable at Moyie (p=0.15); marginal drift at Redfish (p=0.07, ~12 mm/yr widening). Vignette methodology paragraph updated with the actual Kootenay numbers replacing the generic 'should carry over' placeholder. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
pkgdown auto-discovers vignettes from vignettes/ so no _pkgdown.yml change needed. Render order will follow file alphabetical (kootenay-lake before peace-fwcp); leaving as-is for now — explicit articles ordering can be added later if motivated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
New
vignettes/kootenay-lake.Rmdcovering the southern Kootenays — KOTL + LARL + DUNC + SLOC, ~24,200 km². The "keep + expand" resolution of #49: drop the legacy single-WSG KOTL vignette (already removed in v0.1.4), replace it with a regional vignette that mirrors the FWCP Peace pattern, and use the v0.2.0 snow vars to tell the snow story for a region with a sharp east-west precipitation gradient. Closes #56.Headline scientific findings (regional, 2015-2025 vs 1951-1980)
The Kootenay Lake Region story is meaningfully different from the FWCP Peace just to the north:
Two distinct mechanisms:
What's in this PR
data-raw/example_aoi_kootenay_lake.R— builds the AOI from union of 4 WSGs viabcdata. Outputinst/extdata/example_aoi_kootenay_lake.gpkg.data-raw/example_context_kootenay_lake.R— bundled context layers (12 towns including Trail/Rossland/Red Mountain via LARL, plus Nelson, Castlegar, Kaslo, Nakusp, Slocan, New Denver, Argenta, Crawford Bay, Kimberley, Cranbrook). Found and fixed a latent bug in the inherited Peace pattern:Village (1)feature_type filter was missing, so smaller communities (Kaslo, Nakusp, Slocan, New Denver) were being dropped. Outputinst/extdata/context_kootenay_lake.gpkg.data-raw/kootenay_lake_vignette_data.R— regional + per-ecoregion + per-WSG precompute. The per-WSG list is new (peace-fwcp.Rmd doesn't have one); 4 facets is small enough to show directly. Outputinst/vignette-data/kootenay_lake.rds(404 KB) +kootenay_lake_departure_tmean.tif(3 KB).vignettes/kootenay-lake.Rmd— full regional vignette mirroringpeace-fwcp.Rmdstructure with three Kootenay-specific additions: per-WSG facet plots inside Per-Ecoregion Variation, Snowpack interpretation reflecting the snow-vs-rain threshold finding, Watershed Groups Across Ecoregions section sized for 4 WSGs (vs Peace's 16). Bibliography reusesvignettes/references.bibfrom Snowpack-departure methodology lit review: rag-build + 11 papers + citation map #54 — Najafi et al. 2017 covers the Columbia basin so no new lit review needed.data-raw/qa_snow_validation_kootenay_lake.R— ASWS QA at 5 sites in the AOI. Notable findings:Test plan
devtools::test()clean (166 PASS, 0 FAIL)Village (1)filter)Out of scope
example_aoi_kotl.gpkg.Notes
This vignette is the second of the planned three reporting climate-departure appendices in this package family (cf #47). Ports directly to a hypothetical
fish_passage_kootenay_2025reporting context, mirroring howpeace-fwcpports tofish_passage_peace_reporting_2025.Fixes #56
Relates to NewGraphEnvironment/sred-2025-2026#23
🤖 Generated with Claude Code