Skip to content

spreadClimate = "activation": fuel sets each pixel's spread ceiling, climate sets how much of it is reached - #255

Merged
eliotmcintire merged 2 commits into
developmentfrom
feat/climateActivation
Nov 20, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
feat/climateActivation

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

This adds a third way for climate to enter the fire-spread model. Fuel sets how far each pixel can go, and a dry year moves every pixel toward its own limit by the same share, so the fuel contrast stays the same from wet to dry years, as the burned-area data show. The year-to-year random effect sits beside climate, not beside fuel.

Affects: nothing for existing fits; a fit made with spreadClimate = "activation" (fireSense_spreadFit) uses the new form, and prediction applies it from the ledger row.

Technical details

The gap: spreadLinkInputs() (R/spreadProbGates.R:254-285 on development) has one per-pixel form only, climate moving pc. Every place that reads logisticPars[1] as the ceiling (spreadLinkInputs() pc0 > p50 stop, objFunSpread.R:818 saturation summary, :911 and spreadProbGates() gates, spreadFitValidation.R:268 response plot) assumes maxAsymptote is fitted.

The change:

  • spreadLinkInputs(activationIntercept =): a third branch. pc_i = f + (p50 - f) * plogis(eta_i) with eta_i the non-climate columns (intercept included); x_i = activationIntercept + sum(beta_clim * (clim - climateRef)). NA rows are unburnable. spreadProbFromCovs() passes it through.
  • Parameter layout: activationIntercept (activationInterceptTxt) comes right after the covariate coefficients, before the random-effect sds; maxAsymptote is not fitted. splitSpreadPar() takes the intercept out and puts powerLawPc50 in the maxAsymptote slot, unless a named set has one (a ledger row). So every logisticPars[1] reader gets p50, which is the ceiling of every pixel in this mode, with no branch of its own. The gates and the saturation summary look at p, not at p at the reference climate.
  • spreadRandomEffectArgs() sets the objective's new fitActivationIntercept from the bounds, as it does fitYearSpreadSD. So runDEoptim(), its re-score, its profile and simulated members, and the module's emulator get it. spreadProbGates() and spreadFitValidationData() find it by name. Without it the argument is NULL and left out of every cache key.
  • checkLinkParams(activation =): the mode needs "powerLawSmooth" with lowerAsymptote = lowerSpreadProb. Below the floor the other forms fall faster for a higher pc, which would rank rich fuel below poor in wet years (review finding).
  • New constants: spreadClimateTxt (ledger column "spreadClimate"), spreadClimateOptions, activationInterceptTxt, spreadActivationInterceptBounds (c(-10, 10)).

Reuses: spreadClimateSplit(), unburnableLinkPars(), linearLinkPars(), linearLinkProb(), the NA-row block and per-cell pars matrix of the ceiling branch, the per-cell linkPars path to SpaDES.tools::spreadCpp() (objFunSpread.R crop matrix), fixLogisticPars(), logisticParamNames, spreadRandomEffectArgs() and checkLinkParams() (both extended in place), omitNullArgs(); new: nothing beyond the branch and the constants (no existing function computes a fuel-set pc).

Tests: new tests/testthat/test-climateActivation.R. It checks that p per pixel equals the formula, that the ratio of p - f between pixels is the same across climate, that p never exceeds p50, that NA rows are unburnable, that the objective's p equals spreadProbFromCovs() (what fireSense_spreadPredict calls) and its gates and summary use p and p50, the whole-landscape path, the validation and response plot, runDEoptim() keys, and a frozen-value regression of "predictor" and "ceiling". On the base the new file fails (10 failing tests; its frozen-value test passes there). Base vs branch, identical() on 20 outputs of predictor and ceiling (p, link inputs, gates, seeded buffered and whole-landscape objective simulations): all identical.

Full suite (devtools::load_all() + testthat::test_dir()): branch (on 0.2.3.9182) 833 tests, 0 failed, 3 skipped, 3464 expectations; the same branch before #253 merged, 829 tests, 0 failed, against base 970e7b5 818 tests, 0 failed, 3 skipped, 3305 expectations. R CMD check --no-manual (scratch library): 0 errors, 0 warnings, 2 notes, neither from this change (.git of the worktree; data.table sum(s) in objFunInner(), objFunSpread.R:1141 on development).

Modules: PredictiveEcology/fireSense_spreadFit#142 and PredictiveEcology/fireSense_spreadPredict#51, with floor >= 0.2.3.9183 (this PR merging next, after the 0.2.3.9182 bump). fireSense_burn needs no change: it reads the per-cell parameters and adds the year draw to x.

Second commit (powerLawPcAtP50 and the Fable review of these PRs):

  • pcAtP50 = TRUE (new argument of .objfunSpreadFit(), runDEoptim(), spreadProbGates(), spreadFitValidationData()): p_c fixed at p50 in any mode, by the activation's mechanism. maxAsymptote is left out of the fitted parameters and splitSpreadPar() puts powerLawPc50 in its place, so no bound has zero width; Add powerLawPcAtP50: fix p_c at the calibrated p50 fireSense_spreadFit#141's equal bounds give NaN in the emulator's emulatorSpace(). NULL is left out of calls and keys.
  • With powerLawPc50 given, the objective stops on an unnamed par whose length does not match the formula and link (review L6). Without powerLawPc50 there is no check: 13 existing tests pass other layouts there.
  • activationDudYearShare(): pnorm(-activationIntercept / yearSpreadSD) per set, 0 (or 1 for a negative intercept) without a year effect (review H1). New ledger constants spreadFitDudYearShareTxt, spreadFitPcAtP50Txt.
  • runDEoptim()'s start-up message lists activationIntercept apart from the logistic parameters (L5).

Reuses (second commit): splitSpreadPar(), fixedLogisticPars, logisticParamNames, omitNullArgs(); new: activationDudYearShare() (nothing computed the dud-year share).

Full suite after the second commit: 838 tests, 0 failed, 3 skipped, 3487 expectations. R CMD check: 0 errors, 0 warnings, the same 2 notes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh

… is x

spreadLinkInputs() gets a third branch, selected by activationIntercept: pc_i =
f + (p50 - f) * plogis(eta_i) from the non-climate columns, x_i =
activationIntercept + the climate term (spreadClimateSplit()), NA rows unburnable
(unburnableLinkPars()). In the fit's parameters activationIntercept comes right
before the random-effect sds and maxAsymptote is not fitted: splitSpreadPar() puts
powerLawPc50 in its place, so the gates and saturation summary read p50 as the
ceiling; with the activation they look at p. spreadRandomEffectArgs() sets the
objective's fitActivationIntercept from the bounds; runDEoptim(), its re-score,
spreadProbGates() and spreadFitValidationData() pass or infer it.
checkLinkParams(activation =) requires powerLawSmooth at the floor. New
constants spreadClimateTxt, spreadClimateOptions, activationInterceptTxt,
spreadActivationInterceptBounds. Predictor and ceiling are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
@eliotmcintire eliotmcintire added the enhancement New feature or request label Nov 20, 2026
eliotmcintire added a commit to PredictiveEcology/fireSense_spreadPredict that referenced this pull request Nov 20, 2026
ledgerSpreadClimate() reads the row's mode (fireSenseUtils::spreadClimateTxt);
a row without it is "ceiling" with climateRef_spread and a power-law link, else
"predictor", as before. ledgerLinkArgs() passes spreadClimate = "activation" for
such a row only; spreadProbOneELF() then takes activationIntercept out of the
covariate coefficients and gives it to fireSenseUtils::spreadLinkInputs(), and
stops when the set and the row disagree. ledgerLinkNumber() checks the
activation's link with checkLinkParams(activation =). The per-pixel parameters go
out through linkParsRas() as with the ceiling, so fireSense_burn is unchanged.
Floor fireSenseUtils >= 0.2.3.9183 (PredictiveEcology/fireSenseUtils#255).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
…eview fixes

pcAtP50 (fireSense_spreadFit's powerLawPcAtP50) uses the activation's mechanism:
maxAsymptote is not in the fitted parameters and splitSpreadPar() puts
powerLawPc50 in its place. It is an explicit argument of .objfunSpreadFit(),
runDEoptim() (to the fit and the re-score, out of the key when NULL),
spreadProbGates() and spreadFitValidationData(). With powerLawPc50 given, the
objective stops on an unnamed par of the wrong length (Fable review L6).
activationDudYearShare() gives pnorm(-activationIntercept / yearSpreadSD) per
set (H1); ledger constants spreadFitDudYearShareTxt and spreadFitPcAtP50Txt.
runDEoptim()'s start-up message lists activationIntercept apart (L5).

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

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #255      +/-   ##
===============================================
+ Coverage        93.13%   93.27%   +0.14%     
===============================================
  Files               68       68              
  Lines             5141     5204      +63     
===============================================
+ Hits              4788     4854      +66     
+ Misses             353      350       -3     

☔ 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 441df21 into development Nov 20, 2026
16 checks passed
@eliotmcintire
eliotmcintire deleted the feat/climateActivation branch November 20, 2026 13:24
eliotmcintire added a commit that referenced this pull request Nov 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
AllenLarocque pushed a commit to AllenLarocque/fireSense_spreadFit that referenced this pull request Nov 29, 2026
With spreadClimate = "activation" fuel sets each pixel's ceiling below p50 and
climate is the linear predictor (fireSenseUtils::spreadLinkInputs()). The bounds
leave out maxAsymptote (maxAsymptoteBoundsOf(activation =)) and add
activationIntercept after the covariates (new parameter
activationInterceptBounds, default fireSenseUtils::spreadActivationInterceptBounds).
The fit gets climateRef and p50 as the ceiling mode does (climateAsReference(),
spreadPowerLawPc50()); checkSpreadLink() accepts the mode and checks its link
with fireSenseUtils::checkLinkParams(activation =). The ledger row gets p50 as
maxAsymptote (addFixedParsToLedger(maxAsymptote =)) and, for a mode other than
"predictor", its spreadClimate (fireSenseUtils::spreadClimateTxt); a "predictor"
row is unchanged. Floor fireSenseUtils >= 0.2.3.9183
(PredictiveEcology/fireSenseUtils#255).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant