Skip to content

skipUnusedFitPrep: predict-only jobs skip the spread and escape fit data - #103

Merged
eliotmcintire merged 3 commits into
developmentfrom
predictonly-skip-fitprep
Nov 15, 2026
Merged

eliotmcintire merged 3 commits into
developmentfrom
predictonly-skip-fitprep

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Every year of a hindcast prepares the data for fitting the fire models, although nothing is fitted. This adds a switch that skips the slowest of those steps (the covariates only a fit reads) in jobs that only predict, about 2.5 minutes per year-job. The switch is off by default.

Affects: Nothing changes unless skipUnusedFitPrep = TRUE is set. With it set, predict-only jobs skip the spread covariates; the fire data, ignitionFirePoints and the escape covariates are made as in a full run.

Technical details

Defect: fireSense_dataPrepFit.R (init, prepEventsToSchedule(P(sim)$whichModulesToPrepare)) schedules prepSpreadFitData and prepEscapeFitData in every job, also when doFit is FALSE and nothing reads their outputs.

Fix: new parameter skipUnusedFitPrep (default FALSE, cacheKey = FALSE). The fire half of prepare_SpreadFit() is now prepare_SpreadFitFires() (sets mod$allYears, calls the raster or vector builder), which prepare_SpreadFit() calls and which has its own event prepSpreadFitFireData (outputs declared for it). fitPrepNeeded(sim) is FALSE only with the parameter TRUE and fireSenseUtils::fitDataNeeded(doFit, heldOutFold, spreadFit mode) FALSE. Then only prepSpreadFitFireData runs, not prepSpreadFitData; prepIgnitionFitData and prepEscapeFitData run as before. So spreadFirePolys, escapeFireSet, ignitionFirePoints and fireSense_escapeCovariates come from the same code as a full run. The covariate half (vegetation tables, annual climate, formula, fuelClassRoles) is skipped. Init stops if this module and fireSense_spreadFit differ on skipUnusedFitPrep or doFit (paramCheckOtherMods()).

Evidence nothing downstream needs the skipped outputs: climateVariablesForFire (the skipped step only unions the own fit's variables into a set Init() already holds; from the code, not run on data); the spread formula, covariate tables and fuelClassRoles are read only by fireSense_spreadFit's fit/validate/profile events, and fireSense_dataPrepPredict takes fuel roles from the ledger row. No change needed in fireSense_ignitionFit (escape covariates exist). Not timed: the escape step alone needs the real data.

Reuses: prepare_SpreadFitFire_Raster/_Vector, prepEventsToSchedule() (extended), fireSenseUtils::fitDataNeeded() (new, PredictiveEcology/fireSenseUtils#234), SpaDES.core::paramCheckOtherMods(); new: prepare_SpreadFitFires() (a split of existing code, not a copy), fitPrepNeeded() (supplies the job's parameters to the shared rule), event prepSpreadFitFireData.

Depends-on: PredictiveEcology/fireSenseUtils#234

Tests: new test-skipUnusedFitPrep.R (what is scheduled, default and skip, for doFit FALSE/NA/TRUE, held-out fold, validate, profile); test-metadata.R parameter list updated; tests cover the fire-data event, the shared function and the agreement check (no real-data comparison of ignitionFirePoints). The module's Init() needs LandR and Drive, so the tests check the scheduling decision, not a full predict-only spades(). Full suite (convertToPackage() + test_local(), scratch library ~/GitHub/worktrees/scratch-lib-predictonly with fireSenseUtils built from the local PR branch as 0.2.3.9167): base 130 blocks / 478 expectations, 0 failed, 1 skipped (DPF_EQUIVALENCE_FIXTURE not set; also skipped on base); branch 137 / 497, 0 failed, the same 1 skip.

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

…a and prepEscapeFitData

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@eliotmcintire eliotmcintire added enhancement New feature or request backwards compatible Existing code and results keep working unchanged labels Nov 15, 2026
…heKey = FALSE; rule from fireSenseUtils::fitDataNeeded()

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@eliotmcintire
eliotmcintire merged commit d6b5fc9 into development Nov 15, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the predictonly-skip-fitprep branch November 15, 2026 20:59
eliotmcintire added a commit that referenced this pull request Nov 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
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