Fix youngAge mutual exclusivity in makeMutuallyExclusive() and fireSenseCovariatesCreate() - #92
Merged
Merged
Conversation
…orest youngAge is final makeMutuallyExclusive() (R/makeMutuallyExclusive.R:19-28) recomputed the rows to zero from the key column inside the pattern loop, so once a pattern matched the key column itself (as "youngAge" could) the column was zeroed and every later pattern then saw no non-zero rows to zero. Rows are now fixed once per key column, before any zeroing, and a pattern can no longer match the key column itself. fireSenseCovariatesCreate() (R/fuelClassPrep.R) applied makeMutuallyExclusive() before youngAge was finalized for non-forest pixels, so those pixels kept their nfLCC_* land-cover value. The exclusivity step now runs after youngAge is final, and also zeroes treedWetland, per the rule that anything young is not anything else. Adds youngAgeExclusiveCols(), exported, so fireSense_SpreadPredict can derive the same youngAge-exclusivity rule the fit uses without a second copy of the logic. Version 0.2.3.9047. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv
…xclusivity # Conflicts: # NEWS.md
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #92 +/- ##
===============================================
+ Coverage 42.96% 44.35% +1.38%
===============================================
Files 40 40
Lines 3798 3803 +5
===============================================
+ Hits 1632 1687 +55
+ Misses 2166 2116 -50 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Sep 28, 2026
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.
makeMutuallyExclusive()(R/makeMutuallyExclusive.R:19-28) recomputed the rows to zero from the key column inside its pattern loop, so once a pattern matched the key column itself youngAge got zeroed instead of staying 1, and every later pattern then found no rows left to zero.fireSenseCovariatesCreate()(R/fuelClassPrep.R) also applied this exclusivity step before youngAge was finalized for non-forest pixels, so those pixels kept their nfLCC_* land-cover value, andtreedWetlandwas never cleared for young pixels at all.The fix computes the rows to zero once per key column before any zeroing, excludes the key column from its own pattern matches, and moves the exclusivity step in
fireSenseCovariatesCreate()to run after youngAge andtreedWetlandare both final. A new exported helper,youngAgeExclusiveCols(), letsfireSense_SpreadPredictderive the identical rule the fit uses instead of keeping a second copy.Verified with new failing-first tests, matching the symptom seen on real ELF 14.3 cached inputs: before the fix, 4624 pixels had youngAge = 1 going into the fit's objective, and 0 after the (broken) exclusivity step.
devtools::load_all()+testthat::test_dir(): 291 tests / 770 expectations pass ondevelopment, 296 tests / 790 expectations pass on this branch (0 failures either way; the new/changed tests fail ondevelopmentand pass here).R CMD check --no-testsis clean (0 errors, 0 warnings, 0 notes). Version bumped to 0.2.3.9047.Merge this before PredictiveEcology/fireSense_spreadFit#46 and PredictiveEcology/fireSense_spreadPredict#21, which both floor their
fireSenseUtilsdependency on this version.🤖 Generated with Claude Code
https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv