Skip to content

One ELF rescales with its ledger row's covMinMax_spread - #29

Merged
eliotmcintire merged 1 commit into
developmentfrom
fix-ledger-covminmax
Oct 14, 2026
Merged

eliotmcintire merged 1 commit into
developmentfrom
fix-ledger-covminmax

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

A single fitted fire region now rescales its prediction covariates with the ranges stored with its fit, as several regions already did. Before, it used ranges rebuilt by the fitting module in the current run, which in a hindcast could lack a fitted term and leave it unscaled without any message.

Affects: Predictions are unchanged wherever the rebuilt ranges equalled the fit's (every current NRV run); a hindcast now rescales exactly as the fit did, and stops if a fitted covariate has no range.

Technical details

Defect: fireSense_spreadPredict.R:154 passed sim$covMinMax_spread for one ELF, while the multi-ELF path (:175) used sa$covMinMax_spread[[i]]. fireSense_spreadFit runs spreadFitPrep() in every run (its spreadFitPrepare event, :426, also when the ledger has the row) and rebuilds sim$covMinMax_spread from the run's fireSense_spreadFormula; a hindcast's formula can differ from the fit's terms (fireSense_dataPrepFit#69). fireSenseUtils::spreadProbFromIntegerCovs() rescales only the columns of covMinMax, so a fitted term it lacked stayed on its raw x1000 scale.

Fix: ledgerCovMinMax(sa, i, default), beside ledgerCovCentre(), returns the row's covMinMax_spread, else default (sim$covMinMax_spread, for a row written before ranges were stored). spreadProbOneELF() stops when a fitted covariate has no range. Reused: ledgerCovCentre() pattern, paramSetForRep(), spreadProbOneELF().

Tests: new test-ledgerCovMinMax.R (row ranges used, fallback for a row without them, stop on a missing range; the first fails on development: the prediction ignores the row's ranges). Module suite 58 tests, 0 failures (convertToPackage + test_local).

🤖 Generated with Claude Code

https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv

…inMax_spread

The single-ELF path used sim$covMinMax_spread, which fireSense_spreadFit rebuilds in every run
from that run's covariate tables; in a hindcast those follow a formula rebuilt for another
year, so a fitted term could have no range and silently stay on its raw scale.
ledgerCovMinMax() takes the row's ranges (the fit's), like ledgerCovCentre(); a row without
them (an older ledger) still uses sim$covMinMax_spread. A fitted covariate with no range stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv
@eliotmcintire eliotmcintire added bug Something isn't working backwards compatible Existing code and results keep working unchanged labels Oct 14, 2026
@eliotmcintire
eliotmcintire merged commit e98ba25 into development Oct 14, 2026
6 checks passed
@eliotmcintire
eliotmcintire deleted the fix-ledger-covminmax branch October 14, 2026 18:32
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant