Skip to content

Zero-ignition year keeps the ignitionsAndEscapes columns - #31

Merged
eliotmcintire merged 2 commits into
developmentfrom
fix-zero-ignition-schema
Oct 15, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
fix-zero-ignition-schema

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

A year in which no fires start now gives an empty but correctly shaped list of ignitions, instead of a table with no columns. This stops hindcast runs from failing in such years.

Affects: Only years with zero ignitions; years with ignitions give identical results and use the same random numbers.

Technical details

Defect: placeIgnitions() (fireSense_ignitionPredict.R, last line) ends with rbindlist(out); with no ignited coarse pixels out is list(), giving a 0-row, 0-column table. The if (NROW(pixelID_igs)) guard in the ignition event then skipped adding escaped, so sim$ignitionsAndEscapes$pixelID was NULL and fireSenseUtils::hindcastSimulated() failed in terra::xyFromCell(burnID, NULL).

Fix: placeIgnitions() returns igs[integer(0), ..cols] when nothing is drawn; the guard gets an else that adds escaped = logical(0); chunkyPixels is dropped in both cases. sample(1:nrow(x)) became sample.int(nrow(x)): same stream for n >= 1, and sample(1:0) would otherwise return two rows for an empty table.

Verified: new test in test-escaped.R fails on the base (5 expectations) and passes on the branch. Module tests via convertToPackage() + test_local(): base with the new test 45 tests, 1 failing; branch 45 tests, 0 failing (2 skipped in both).

🤖 Generated with Claude Code

https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv

placeIgnitions() returned rbindlist(list()), a table with no columns, so a year
with no ignitions had no pixelID/escaped and hindcastSimulated() failed.

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 0a17ab1 into development Oct 15, 2026
7 checks passed
@eliotmcintire
eliotmcintire deleted the fix-zero-ignition-schema branch October 15, 2026 14:04
eliotmcintire added a commit that referenced this pull request Oct 16, 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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant