Skip to content

Multiply the expected ignitions by the fit's spatial field - #51

Merged
eliotmcintire merged 1 commit into
developmentfrom
spatialField
Nov 30, 2026
Merged

eliotmcintire merged 1 commit into
developmentfrom
spatialField

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

Fire ignition predictions can now include a smooth map of where ignitions are more or less likely than the fitted model alone expects. A fit that carries such a map has its expected ignitions scaled up or down place by place.

Affects: nothing for existing fits. A fit made with the new spatial field option (in the ignition fit module) has its expected ignitions per pixel multiplied by the field's factor; escapes are unchanged.

Depends-on: PredictiveEcology/fireSenseUtils#269

Technical details

The fit stores the field as plain numbers, modelList$spatialField (fireSenseUtils fitSpatialField()). IgnitionPredictRun() multiplies each pixel's ignition mean by exp(f) (fireSense_ignitionPredict.R, the predsIgns[f$rows] line). spatialFieldFactorOf() makes the factor for every cell of ignitionFitRTM once per fit, through fireSenseUtils::spatialFieldFactor() (rasterise the field on its fit grid, project to ignitionFitRTM only if the geometry differs), and keeps it in mod$spatialFactor for the following years; it is made again only if the fit's field changes. Pixels outside the fitted area, or NA in the field, get a factor of 1, as does a fit without a field. With several ELFs each fit applies its own field to its own pixels. reqdPkgs: fireSenseUtils floor 0.2.3.9199, the version the fireSenseUtils PR is expected to be bumped to (TODO in the comment: confirm after it merges). The module calls no mgcv function, so mgcv is in fireSenseUtils' imports, not here.

Reuses: fireSenseUtils::spatialFieldFactor(), foldMeanPrediction(), ignitionFitsByELF(), the toy fit helpers of setup-toyIgnition.R; new: spatialFieldFactorOf() (keeps the factor between years; nothing existing caches per-fit results across run events).

Tests (written first; test-spatialField.R, plus one in test-multiELF.R): a field of known factors multiplies the means, escapes untouched; no field is identical to before; NA and unreached pixels are 1; the field of a larger grid is projected; the factor is made once over three years; a field saved with saveRDS() and reloaded predicts identically; each ELF's field applies to its own pixels. On the base the new tests fail (7 failures). Full suite (convertToPackage + test_local, scratch library with fireSenseUtils from the PR branch): branch 159 passed, 0 failed; base 148 passed, 0 failed.

NEWS bullet added; no version bump.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh

A fit with modelList$spatialField (fireSense_ignitionFit spatialField = "twoStage") has each
pixel's expected ignitions multiplied by exp(f). The factor is made once per fit and kept in mod.

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 30, 2026
@eliotmcintire
eliotmcintire merged commit 80e01c1 into development Nov 30, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the spatialField branch November 30, 2026 20:18
eliotmcintire added a commit that referenced this pull request Nov 30, 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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant