Repository navigation
Faster ignition placement; results identical - #30
Merged
Merged
Conversation
…xel full scans Same sample() calls in the same order; ignitions and random stream unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each year the module picks which small map cells ignite inside every coarse cell that has a fire. It did this by searching the whole landscape table once or twice per fire, which was slow on large maps; it now sorts the candidates once. The fires, escapes and random numbers are exactly the same.
Affects: speed only; results identical.
Technical details
Defect:
fireSense_ignitionPredict.R:196-206(development f11d27e) didigs[chunkyPixels == n]andig[pixelID %in% drawn]on the 1.26M-row fine-pixel table for every ignited coarse pixel (300+ a year). NewplaceIgnitions()(same file, afterfineCoarseTable()) does onesplit()of the candidate rows and a pixelID -> row lookup. Thesample()calls are the same, in the same order, on the same candidate vectors, so the random stream is unchanged. Thesample(x, size)behaviour for a single candidate (draws from1:x) is kept on purpose; it is a separate known issue, not fixed here. The module has noR/folder and its helpers live in the module file, so the function is there; the test istests/testthat/test-place-ignitions.R.Tests: the new test compares against a labelled copy of the old code for 6 seeds, a coarse pixel with exactly one candidate, and coarse pixels with zero ignitions (identical output and
.Random.seed).convertToPackage(buildDocuments = TRUE)+test_local: branch all pass (2 existing skips for the known single-candidate defect); base with only the new test file: 3 errors (noplaceIgnitions), the rest pass.Real 14.3 state (profile harness, 4 threads), seeds 11/2/3:
identical()TRUE forignitionsAndEscapes(335/344/328 ignitions), the probability rasters (seed 11) and.Random.seed.IgnitionPredictRun2.2-2.3 s -> 0.4-0.5 s.🤖 Generated with Claude Code
https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv