Repository navigation
Hindcast youngAge built as the spread fit builds it (youngAgeAtYear) - #46
Merged
Merged
Conversation
…() with the data year's time since disturbance and the fires after it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
…anBeYoungAge = FALSE stops in a hindcast; fire-source selection through firePixelsByYear Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
…:clearYoungAge), uses the fit's fire source, resolves its inputs once per year Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
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
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.
A hindcast of a fire year counted "recently burned" land differently from the spread model's fit, so it saw too many young pixels, in both the spread and the ignition covariates. It now counts them the same way as the fit.
Affects: hindcast spread and ignition covariates (and their cache keys) change for every hindcast year; forecasts are unchanged.
Depends-on: PredictiveEcology/fireSenseUtils#239
Technical details
Defect: for a hindcast of year Y,
youngAgecame from cohort ages (fireSenseCovariatesCreate()) and the data year's non-forest time since disturbance, which theageNonForestevent never advances inside one year (yearsElapsed0). Fires between the data year and Y were ignored. The ignition path had the same defect:prepare_IgnitionAndEscapePredict()calledprepare_FuelCovsCoarse()with the un-aged time since disturbance, where the fit usesprepare_FuelCovsCoarseByYear()(fireSense_dataPrepFit.R, ignition fit). The spread fit usesfireSenseUtils::youngAgeAtYear()(addAnnualYoungAge,fireSense_dataPrepFit.R:1121-1123). On ELF 6.6.2, 2010: youngAge was 2.8% of burned pixels in the hindcast, 1.5% in the fit.Fix: new
hindcastYoungAgeInputs()gives the data year'snonForest_timeSinceDisturbanceselement (dataYearElement(before = TRUE), the ruletakeLatestVegetation()uses), Y =floor(time(sim))and the fires (firePixelsByYear()fromhistoricalFireRaster, elsefirePolysForAge: the fit's choice; a hindcast with neither stops). Spread:fireSenseCovariatesCreate(youngAge = FALSE)as the fit does (its fuel table is made with cutoff -1), thenyoungAgefromyoungAgeAtYear(); fuel, non-forest land cover and treed wetland are then cleared on young pixels in the table withfireSenseUtils::clearYoungAge()(the rule the ignition fit uses).fireSense_spreadPredictalone is not enough: it clears fuel only for a linear-fuel fit (fireSense_spreadPredict.R:512-516), so a log-scale fit would have kept fuel on young pixels. Ignition:prepare_FuelCovsCoarseByYear().nonForestCanBeYoungAge = FALSEstops in a hindcast withfireSenseUtils::stopIfNonForestCannotBeYoung(), as the fit does. Forecasts (a module simulatescohortData) are unchanged: their cohorts are simulated. New inputsfirePolysForAge,historicalFireRaster(fromfireSense_dataPrepFit); The inputs are worked out once per year and kept inmod, not at every covariate event. Floor: set after fireSenseUtils#239 merges.Reuses:
fireSenseUtils::youngAgeAtYear(),prepare_FuelCovsCoarseByYear(),firePixelsByYear(),stopIfNonForestCannotBeYoung(),tsdTable(),clearYoungAge(),dataYearElement(),simulatedObjects(); new:hindcastYoungAgeInputs()(gathers the predict module's inputs for those functions; nothing existing does that) andisHindcast()(the testtakeLatestVegetation()had inline, now shared).Tests (
test-latestVegetation.R): a 2004 fire after data year 2003 makes pixels young in a 2005 hindcast and the spreadyoungAgeequalsyoungAgeAtYear()'s; fires fromfirePolysForAge; ageing without fires; fuel of cohort-young pixels is kept; fuel and land cover cleared on young pixels in the table (a log-scale fit then needs nothing fromfireSense_spreadPredict); a hindcast with no fire data stops; inputs kept once per year; ignitionyoungAgeequals the share of young pixels per coarse cell;nonForestCanBeYoungAge = FALSEstops in a hindcast, not in a forecast; a forecast keeps cohortyoungAge. Ten failures on base with these tests, none on the branch. Expectations onyoungAgecells 5, 6, 9 changed (time since disturbance, not cohort age, decides) and one fuel comparison moved from cell 1 to cell 2 (cell 1 is now young, so cleared); the test helper gives hindcastsfirePolysForAge = list(). Full suite (convertToPackage()+test_local(), one thread, scratch library with the fireSenseUtils branch): branch 395 pass, 0 fail, 0 skip; base 378 pass, 0 fail, 0 skip.Hindcast covariates, and so cache keys, change.
🤖 Generated with Claude Code
https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6