Skip to content

firePixelsByYear checks the raster geometry; stopIfNonForestCannotBeYoung shared - #239

Merged
eliotmcintire merged 4 commits into
developmentfrom
fire-pixels-for-age
Nov 16, 2026
Merged

eliotmcintire merged 4 commits into
developmentfrom
fire-pixels-for-age

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Four small shared helpers so the spread fit and its hindcasts treat "recently burned" land in the same way. No change to any result.

Affects: nothing for users now; the data-preparation modules (the fit and the hindcast) call these instead of each keeping a copy.

Technical details

firePixelsByYear(fireRaster =, template =) now stops when the raster and template differ in geometry (R/timeSinceDisturbance.R); fireSense_dataPrepFit had that check in its own allFirePixelsByYear(), and fireSense_dataPrepPredict needs it too. firePixelsByYear() already prefers fireRaster over firePolys, so it is also the one place that picks the fire source. stopIfNonForestCannotBeYoung() moves here from fireSense_dataPrepFit (R/youngAge.R): nonForestCanBeYoungAge = FALSE is unsupported, and the hindcast now follows the fit. New tsdTable() (the pixelID/tsd table youngAgeAtYear() reads) replaces three copies (prepare_FuelCovsCoarseByYear(), fireSense_dataPrepFit addAnnualYoungAge(), fireSense_dataPrepPredict). New clearYoungAge() is the rule that clears fuel (to logMinB(0)), non-forest land cover and treed wetland where youngAge is 1, taken out of prepare_FuelCovsCoarseByYear(); the hindcast's spread covariates call it, because fireSense_spreadPredict clears fuel only for a linear-fuel fit (fireSense_spreadPredict.R:512-516, fuelCols is empty for a log-scale fit).

Reuses: firePixelsByYear() (generalised in place, with the fit's geometry check); new: stopIfNonForestCannotBeYoung() (moved), tsdTable() (the table was built three times), clearYoungAge() (moved out of prepare_FuelCovsCoarseByYear(); the hindcast needs the same rule).

Tests (test-youngAgeAtYear.R): geometry mismatch stops; raster used when both given; the stop function; tsdTable(); clearYoungAge(). R CMD check --no-manual (scratch library, rcmdcheck, tests and vignettes run): 0 errors, 0 warnings, 2 notes (.git in the worktree, objFunInner global s, both already in the base).

Used by PredictiveEcology/fireSense_dataPrepFit and PredictiveEcology/fireSense_dataPrepPredict#46. The version bump follows the merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

…nForestCannotBeYoung moves here from fireSense_dataPrepFit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.52%. Comparing base (09ac39f) to head (53885a2).
⚠️ Report is 4 commits behind head on development.

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #239      +/-   ##
===============================================
+ Coverage        93.49%   93.52%   +0.02%     
===============================================
  Files               67       67              
  Lines             5242     5265      +23     
===============================================
+ Hits              4901     4924      +23     
  Misses             341      341              

☔ 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 0ab500d into development Nov 16, 2026
16 checks passed
@eliotmcintire
eliotmcintire deleted the fire-pixels-for-age branch November 16, 2026 22:28
eliotmcintire added a commit that referenced this pull request Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards compatible Existing code and results keep working unchanged enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant