Skip to content

Optional smooth climate curve term for the spread formula (spreadClimateCurve) - #118

Merged
eliotmcintire merged 4 commits into
developmentfrom
climateHinge
Nov 26, 2026
Merged

eliotmcintire merged 4 commits into
developmentfrom
climateHinge

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

This adds an optional smooth extra climate term to the spread model's formula, so the model can respond more steeply to climate in dry years. It is off by default.

Affects: Nothing changes unless spreadClimateCurve = TRUE; the default formula string, covariate tables and ledger rows are the same as before.

Depends-on: PredictiveEcology/fireSenseUtils#265
Depends-on: PredictiveEcology/fireSense_spreadFit#146
Depends-on: PredictiveEcology/fireSense_spreadPredict#53

Technical details

New parameter spreadClimateCurve (default FALSE), next to spreadClimateSplit. With TRUE each spread climate variable C gets a covariate C_curve = softplus(C - k, s) (fireSenseUtils::softplus()) with its own coefficient, after the variable's other climate terms in the formula (spreadRHS(climateCurve =); it does not interact). k is the ELF's median and s its sd of C over the burnable pixels of all the fit years. annualSpreadCovariates() (fireSense_dataPrepFit.R) makes the term from the pixel's own value before splitSpreadClimate() removes it, reusing the burnable-pixel climate the split already reads, and returns k and s as an attribute that prepare_SpreadFit() puts in sim$climateCurvePars (new output). fireSense_spreadFit stores it in the ledger row and fireSense_spreadPredict rebuilds the term from it. The coefficient's sign is free; a negative value would flatten the dry side. A reused ledger fit keeps its own curve terms and k, s (mod$spreadClimateCurve, as for the split). The new fireSenseUtils functions (addClimateCurve(), climateCurvePars(), softplus(), climateTermCols()) are in the prepSpreadFitData cache key.

Reuses: fireSenseUtils::climateCurvePars(), addClimateCurve(), climateCurveSuffix, softplus(), ledgerClimateCurvePars() (fireSenseUtils#265); the module's climateAt(burnableIndex), useClimateSplit() pattern (useClimateCurve()), spreadRHS(), fireSenseUtils::climateTermCols() / isClimateTermCol(); new: useClimateCurve() (the same three-line rule as useClimateSplit() for the curve flag). The fixtures wholeFixture() and ownAndNeighbourLedger() moved from two test files into helper-spreadFixtures.R so a third test file can use them.

Tests: new test-spreadClimateCurve.R (values with the stored k, s; reused k, s; with the split; unchanged without; formula order; parameter default; reuse rules from the ledger) and a test that addAnnualYoungAge() returns the list it is given with its tables changed in place. Module suite (convertToPackage() + test_local(), scratch library, fireSenseUtils from the branch): base 157 blocks, 614 passed, 0 failed; the new test file on the base code: 13 fail; branch 167 blocks, 656 passed, 0 failed, 1 skipped (needs a fixture variable, as on the base). CI testthat-module / Test module passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh

eliotmcintire and others added 2 commits November 25, 2026 16:15
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
…s sd (replaces the hard hinge)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
@eliotmcintire eliotmcintire added enhancement New feature or request backwards compatible Existing code and results keep working unchanged labels Nov 25, 2026
eliotmcintire and others added 2 commits November 25, 2026 17:09
…l, climateTermBase); test that addAnnualYoungAge returns its input

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
@eliotmcintire
eliotmcintire merged commit d2e0405 into development Nov 26, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the climateHinge branch November 26, 2026 04:18
eliotmcintire added a commit that referenced this pull request Nov 26, 2026
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

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