Skip to content

Year climate term: same yearly mean as the fit, input checks - #48

Merged
eliotmcintire merged 5 commits into
developmentfrom
ignitionYearClimate2
Nov 20, 2026
Merged

eliotmcintire merged 5 commits into
developmentfrom
ignitionYearClimate2

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

This follow-up makes the prediction use exactly the same "how dry was the year" number as the fit, and checks its inputs. Before, the two could differ and shift every year's predicted ignitions by the same factor.

Affects: predicted ignitions for fits with a year climate term; fits without one are unchanged.

Depends-on: PredictiveEcology/fireSenseUtils#254
Depends-on: PredictiveEcology/fireSense_dataPrepPredict#51

Technical details

yearClimateMultiplierOf() (fireSense_ignitionPredict.R) now calls fireSenseUtils::yearClimateMeans(covariates, variable), the fit's own definition (unweighted mean over rows where the variable is not NA and coreFraction is above 0). The predict covariates now carry coreFraction from fireSense_dataPrepPredict (its PR; without it the mean would include the buffer). The mean is taken from the covariates before na.omit(), for the pixels of the fit's ELF (the ELF assignment is made once, on the table before na.omit(), and each fit keeps its rows both before and after it, so the raster post-process runs once per prediction), so a pixel with an NA in an unrelated column still counts, as in the fit. It stops if the fit has the term and the covariates have no coreFraction; it stops if the covariates hold more than one year or lack the stored variable, and gives 1 with a warning if the year has no usable row. The stored norm is applied by yearClimateMultiplier(). Floor fireSenseUtils >= 0.2.3.9183.

Reuses: fireSenseUtils::yearClimateMeans(), yearClimateMultiplier(); new: nothing.

Tests: full suite branch 139 pass, 0 fail; base (development) 120 pass, 0 fail. New: the post-process runs once; NA in an unrelated column (single and multi ELF); stops without coreFraction; real boosters predict covariates with the extra column and scaleAsFit() leaves it; definition matches the fit (core and NA rows), several ELF fits each with their own term or none, missing variable, two years, no year column, empty year, rescaleVars = FALSE, norm.

Known limitation: with several ELFs, predict assigns each coarse pixel to an ELF by its centre, while the fit's table includes pixels that are only partly core, so the two yearly means can differ slightly at the ELF edges. A small constant offset of that kind is left in multi-ELF predictions.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh

… beta, norm, NA handling, more tests

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
@eliotmcintire eliotmcintire added the bug Something isn't working label Nov 20, 2026
eliotmcintire and others added 4 commits November 19, 2026 22:50
…out coreFraction

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
…reFraction, level helper, warnings

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
…nd after na.omit

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXhXsFis2pbqBTh2PPh
@eliotmcintire
eliotmcintire merged commit 91dc2c2 into development Nov 20, 2026
7 checks passed
@eliotmcintire
eliotmcintire deleted the ignitionYearClimate2 branch November 20, 2026 13:39
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant