Fix duplicate youngAge term in the spread formula - #46
Merged
Merged
Conversation
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
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.
prepare_SpreadFit()in fireSense_dataPrepFit.R:774 built the spread formula's RHS asclimate + youngAgeTxt + vegCols, andvegColsalready contains ayoungAgecolumn wheneverfireSenseUtils::fireSenseCovariatesCreate()finds young forest or non-forest pixels, which two real ELFs (14.3, 14.4, run 2026-09-27) did. The formula then listedyoungAgetwice;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 excludesyoungAgeTxtand the spread climate variable fromvegColsbefore building the RHS, so each of those is contributed only by its explicit term;vegColsitself is left untouched for the non-annual covariate table that still needsyoungAge. Verified with a new test that extracts and evaluates the formula-building statements fromprepare_SpreadFit()against a small fabricated veg table with a non-zeroyoungAgecolumn: it reproduces"~ 0 + CMD + youngAge + fuelA + youngAge"ondevelopmentand gives"~ 0 + CMD + youngAge + fuelA"on this branch. Full suite: 154/154 passing ondevelopment, 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