Skip to content

Residual climate signal in the hindcast score - #34

Open
eliotmcintire wants to merge 2 commits into
developmentfrom
residualClimate
Open

eliotmcintire wants to merge 2 commits into
developmentfrom
residualClimate

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

The hindcast score now checks whether what the simulation gets wrong (area burned, fire size) still follows the year's climate. If it does, the simulator is missing something.

Affects: four new score tables (residualClimate_years.csv, _slopes.csv, _pooled.csv, _spreadSD.csv) beside the existing ones; existing tables and scores do not change. The module now needs fireSenseUtils >= 0.2.3.9196.

Reuses: readHindcastSim, readHindcastObserved, readHindcastCovariate, hindcastCore, readLedgerRow (extended), scoredYears, obsBy, climateInputs and climatePooledYears (now share zScore(), medianAreaBy(), logRatio()), logSlope (now calls the new olsSlope()), fireSenseUtils::climateTermBase/climateCovRanges; new: residualYears, residualSlopes, poolResidualSlopes, spreadClimateSD, readHindcastCovariates, writeResidualClimate (nothing existing gives residuals by year, a random-effects pool, the fitted climate term SD, or a temp-then-rename csv write), olsSlope/logRatio/medianAreaBy (generalised from logSlope and the pooled-years code, which now call them).

Technical details
  • Residual: log(median over runs of sim / obs) for annual area (area50), mean and median size of fires of minHa or more. Years with observed area 0 have no area, mean or median residual; areaOffset (minHa added to both) is defined for them. A simulated size is NA with fewer than 10 runs with a fire.
  • Slopes: residual on the within-ELF z-score (over the scored years) of each covariate in elf$covariates (CMD, CMDsm, CMDsp, cumMDC, Tmaxsm, PPTsm, whichever the hindcast has) and on own, the first climate term of the ledger row. Output slope, SE, n, and the slope with the own variable also in the model (NA for the own variable, and for ELFs without spread coefficients).
  • Pooled over ELFs: median of the per-ELF slopes and a DerSimonian-Laird random-effects slope with 95% interval and tau, for the plain and the after-own slopes.
  • spreadClimateSD: per kept set, SD over the scored years of coefficient * (value - min) / (max - min) next to yearSpreadSD, with a median row per ELF. Only plain and _yr terms (_dev, _curve need pixel values). Without fit$params it returns NULL, so other simulators are scored too.
  • Reader: ELF inputs gain covariates; readLedgerRow() also returns params and covMinMax. runWave1() returns residualClimate. fireSenseUtils floor raised to 0.2.3.9196 (first with climateTermBase).
  • Tests: new test-residualClimate.R (injected slope recovered for area and both sizes, obs = 0 years, after-own slope, NA without a fit, pooled summary, writer) and one in test-byset.R. Full suite: branch 165 passed, 0 failed, 0 skipped; base 154 passed. The new tests fail on base (functions missing).
  • Out of scope: the module's other writers (write.csv, saveRDS) still write in place.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh

…mate?

Per ELF and scored year, log(sim / obs) of annual area, mean and median fire size, regressed on the
within-ELF z-score of every annual climate covariate and on the ELF's own spread-fit variable (slope,
SE, n, slope after the own variable); pooled over ELFs (median, random-effects). The SD of the fitted
spread climate term next to yearSpreadSD. Written as residualClimate_{years,slopes,pooled,spreadSD}.csv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
@eliotmcintire eliotmcintire added enhancement New feature or request backwards compatible Does not break existing behaviour labels Dec 4, 2026
…ate response; read the covariates once

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 Does not break existing behaviour enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant