Skip to content

Fix duplicate youngAge term in the spread formula - #46

Merged
eliotmcintire merged 1 commit into
developmentfrom
fix/spread-formula-youngAge-once
Sep 27, 2026
Merged

eliotmcintire merged 1 commit into
developmentfrom
fix/spread-formula-youngAge-once

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

prepare_SpreadFit() in fireSense_dataPrepFit.R:774 built the spread formula's RHS as climate + youngAgeTxt + vegCols, and vegCols already contains a youngAge column whenever fireSenseUtils::fireSenseCovariatesCreate() finds young forest or non-forest pixels, which two real ELFs (14.3, 14.4, run 2026-09-27) did. The formula then listed youngAge twice; terms() silently drops the duplicate, so the formula ends up with one fewer distinct term than the raw covariate count downstream code expects. The fix excludes youngAgeTxt and the spread climate variable from vegCols before building the RHS, so each of those is contributed only by its explicit term; vegCols itself is left untouched for the non-annual covariate table that still needs youngAge. Verified with a new test that extracts and evaluates the formula-building statements from prepare_SpreadFit() against a small fabricated veg table with a non-zero youngAge column: it reproduces "~ 0 + CMD + youngAge + fuelA + youngAge" on development and gives "~ 0 + CMD + youngAge + fuelA" on this branch. Full suite: 154/154 passing on development, 158/158 on this branch (the 4 new assertions), same 1 pre-existing skip (an opt-in fixture-based test) on both.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv

prepare_SpreadFit() (fireSense_dataPrepFit.R ~774) built the spread
formula's RHS as `climate + youngAgeTxt + vegCols`, but vegCols
already includes a "youngAge" column whenever
fireSenseUtils::fireSenseCovariatesCreate() finds young forest or
non-forest pixels (ELFs 14.3/14.4, 2026-09-27 cache entries). The
formula then listed youngAge twice; terms() silently drops the
duplicate, leaving one fewer distinct term than the covariates
actually used downstream. youngAgeTxt and the spread climate
variable are now excluded from vegCols before building the RHS.

Version 1.2.0.9012 -> 1.2.0.9013.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv
@eliotmcintire
eliotmcintire merged commit 6c84a94 into development Sep 27, 2026
6 checks passed
@eliotmcintire
eliotmcintire deleted the fix/spread-formula-youngAge-once branch September 27, 2026 16:45
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.

1 participant