Skip to content

Fix youngAge mutual exclusivity in makeMutuallyExclusive() and fireSenseCovariatesCreate() - #92

Merged
eliotmcintire merged 2 commits into
developmentfrom
fix/youngage-exclusivity
Sep 28, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
fix/youngage-exclusivity

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

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, and treedWetland was 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 and treedWetland are both final. A new exported helper, youngAgeExclusiveCols(), lets fireSense_SpreadPredict derive 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 on development, 296 tests / 790 expectations pass on this branch (0 failures either way; the new/changed tests fail on development and pass here). R CMD check --no-tests is 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 fireSenseUtils dependency on this version.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv

…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
@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.35%. Comparing base (e9ff8ba) to head (b48ac45).
⚠️ Report is 1 commits behind head on development.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eliotmcintire
eliotmcintire merged commit 5f1e007 into development Sep 28, 2026
14 checks passed
@eliotmcintire
eliotmcintire deleted the fix/youngage-exclusivity branch September 28, 2026 17:53
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