Repository navigation
New parameter spreadClimateSplit: the spread climate as a between-year and a within-year term - #108
Merged
Merged
Conversation
…etween-year and a within-year term Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
…me from fireSenseUtils::climateSplitRefPixels(); cell labels from elfCellLabels() Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
eliotmcintire
force-pushed
the
climateSplit
branch
from
November 20, 2026 23:35
f5bab06 to
cea86d1
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
…ons(), also for a reused split fit Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
…m the between-year term (CMD_yr:fuel), never _dev; checkSpreadInteractions() no longer stops Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
…limateSplit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
eliotmcintire
added a commit
that referenced
this pull request
Nov 21, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
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.
The fire spread model uses one climate coefficient for both how dry a year is overall and how one place differs from the rest of the region within a year. This adds an option, off by default, that gives each its own coefficient, so a run can test whether year-to-year climate then explains more of the variation in fire size.
Affects: nothing changes unless a run sets
spreadClimateSplit = TRUE; then the spread model has two climate terms in place of one, and the fit data are rebuilt.Depends-on: PredictiveEcology/fireSenseUtils#244
Technical details
Part of one change with PredictiveEcology/fireSenseUtils#244, fireSense_spreadFit (PredictiveEcology/fireSense_spreadFit#132) and fireSense_spreadPredict (PredictiveEcology/fireSense_spreadPredict#44). Motivation: in ELF 6.6.2 the
l_pow05fit gives climate 2% of the between-year variance of the spread linear predictor (the random year effect takes the rest), although annual climate correlates 0.47-0.60 with annual fire size and area. The single coefficient is also pulled by the spatial gradient, which is confounded with fuel.New parameter
spreadClimateSplit(defaultFALSE).FALSEgives the same formula string as before (spreadFormula(RHS)is unchanged, so cache keys that hold it do not move; the parameter itself is in theprepSpreadFitDatakey, so that event re-runs once).TRUE:<C>_yr + <C>_devwhere it had<C>(fireSenseUtils::climateSplitCols()), for example~ 1 + CMD_yr + CMD_dev + youngAge + ...;annualSpreadCovariates(climateSplit = TRUE)replacesCin each year's table byC_yr, the year's median ofCover that year's burnable pixels (burnablePixels, the ELF's flammable pixels: the pixels a prediction has), andC_dev = C - C_yr, withfireSenseUtils::splitSpreadClimate().Design choice to confirm: the median is taken over the ELF's burnable pixels (the data year's
landcoverDTs: flammable, land cover not 0; chosen withfireSenseUtils::climateSplitRefPixels(), the same function the prediction uses), not over the fitted fire-buffer pixels. A buffer median would be biased toward where fires occurred and a prediction cannot reproduce it, so the fit and the prediction would use different between-year values. The cost is one moreclimateRasterToDataTable()call (cached) over the burnable pixels, only when the option is on. WithwholeLandscapeSpreadCovariatesthe two pixel sets are the same.Sign rule and ranges: see fireSense_spreadFit#132 (names with
CMD/MDCkeep the lower bound 0 on both terms;Tmaxsmterms stay free; fixed ranges for both).Checked, no change:
fireSense_dataPrepPredict(its covariate table has the base climate; the ledger row's names carry the split).mod$spreadFormulaClimateand the hindcast path read the climate variable from the ledger throughspreadFitLedgerInputs(), fixed in fireSenseUtils#244. A prediction needs nospreadClimateSplitsetting. A fit reused from the ledger (doFitFALSE, e.g. a predict-only or hindcast job) keeps its own split:Init()setsmod$spreadClimateSplitfrom the ledger row's coefficient names (isClimateSplitCol()), anduseClimateSplit(mod, Par)makes that win over the parameter when building the formula and the tables. A reused unsplit fit stays unsplit even with the parameterTRUE; a refit follows the parameter.Overlap with the
spreadInteractionswork: that one also edits the formula builder (RHS, about line 1070) and the fit tables. This diff changes only the climate part ofRHS:paste0(<climate terms>, collapse = " + "). It also addsclimateSplitColsandsplitSpreadClimateto theprepSpreadFitData.cacheExtra.spreadInteractions = "climate:fuel"now works with the split (Eliot, 2026-11-20: fuel interacts with the between-year term only). Before,checkSpreadInteractions()(R/spreadFormula.R) stopped on the combination, because the interactions were built from the unsplitCMD, which the split removes. NowspreadRHS()builds each interaction from<climate>_yr(paste0(spreadVars, fireSenseUtils::climateSplitYrSuffix)):CMD_yr:fuel, neverCMD_dev:fuel.checkSpreadInteractions()lost itsclimateSplitargument, since the check no longer depends on the split; its other rules (#116: interactions needspreadCovariates = "all") are unchanged. Formula for a split ELF with fuelsdom_agb_Pice_mar,dom_agb_Pinu_ban,dom_agb_Popu_tre,nfLCC_1_2,treedWetland,treedWetland_agb:~ 1 + CMD_sm_yr + CMD_sm_dev + youngAge + dom_agb_Pice_mar + dom_agb_Pinu_ban + dom_agb_Popu_tre + nfLCC_1_2 + treedWetland + treedWetland_agb + CMD_sm_yr:dom_agb_Pice_mar + CMD_sm_yr:dom_agb_Pinu_ban + CMD_sm_yr:dom_agb_Popu_tre + CMD_sm_yr:treedWetland_agb. WithspreadCovariates = "climate"and the split the formula isCMD_yr + CMD_dev; with"fuel"it has no climate term (the split does nothing). Merged development 1.3.0.9040 (#116) into this branch:spreadRHS()keeps #116'sclimateTerms/fuelTerms, withclimateTermsfrom the split names. Tests:test-spreadInteractions.Rhas exact formula terms for split with interactions,_devnever interacting, and"climate"/"fuel"with the split; the old test that expected the stop is replaced. Full suite after the merge: 0 failures, 0 errors, 1 skip, 619 passed; development 564.Climate in the ceiling and activation (
spreadClimate, now on development): the climate columns ofclimateRefare every annual covariate that is not a 0/1 indicator (fireSenseUtils::spreadClimateCols()), soC_yrandC_devare both climate columns, each with its own reference, and both move the ceiling (or are the linear predictor in activation). Nothing to change here; a new test checks it.Reuses:
fireSenseUtils::climateSplitCols(),splitSpreadClimate(),climateSplitRefPixels(),isClimateSplitCol(),climateRasterToDataTable()(the call is now a small local functionclimateAt()used for the fitted pixels and the burnable pixels),burnablePixelsByFireYear()output; new: nothing in this module (the shared logic is in fireSenseUtils).Tests (in
test-wholeLandscapeSpreadCovariates.R, which has the annual-table fixture): with the split, the tables haveCMD_yr(the median over burnable pixels 1:16, not over the buffer pixels), constant within a year,CMD_dev = CMD - CMD_yr, noCMD, and the same rows; the default formula string~ 1 + CMD + youngAge + class1 + class2is unchanged andTRUEgives~ 1 + CMD_yr + CMD_dev + youngAge + ...; the parameter defaults toFALSE.test-metadata.Rhas the new parameter name. Reuse tests intest-spreadClimateOwnELF.R(a ledger fit withCMD_yr/CMD_devand the parameter FALSE gets the split; an unsplit fit with TRUE stays unsplit; a refit follows the parameter) and the formula test withmod$spreadClimateSplit. Full suite (convertToPackage()copy, fireSenseUtils with the branch installed in a scratch library): base (development 1.3.0.9039) 0 failures, 0 errors, 1 skip, 547 passed; branch 0 failures, 0 errors, 1 skip (dataPrepBuildcold/warm cache needsDPF_EQUIVALENCE_FIXTURE, skipped on base too), 586 passed.No version bump. The
reqdPkgsfloor on fireSenseUtils is0.2.3.9186, the version fireSenseUtils#244 will have once it merges (development is at 9184; if another fireSenseUtils PR merges first, the floor is raised to match). Until then CI installs 9184, so theDepends-online is what holds this PR back.🤖 Generated with Claude Code
https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6