Repository navigation
New parameter seedVegInit: repeatable vegetation in the fit - #105
Merged
Merged
Conversation
…s_borealDataPrep Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
…phabetically among the parameters Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
…eeping both bullets Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
eliotmcintire
added a commit
that referenced
this pull request
Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
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.
The vegetation the fit rebuilds from satellite data involves random in-filling of missing values, so the same area gave different vegetation on different machines. This adds a seed (default fixed) so results are repeatable, and it can be switched off or changed to see how much the in-filling matters.
Affects: the vegetation of every fit is drawn once with the new default seed, so the nested run re-runs once and results can differ from earlier runs; after that they are the same on every machine.
seedVegInit = NAgives the old unseeded behaviour.Depends-on: PredictiveEcology/Biomass_borealDataPrep#156
Technical details
Defect: the nested
simInitAndSpades()inrunBorealDP_forCohortData()(fireSense_dataPrepFit.R:~1724) passes no seed.LandR::subsetDT(cohorts.R:1638) draws the age-model subset (cohorts.R:1495, fromBiomass_borealDataPrep.R:834) and the biomass-model subset (Biomass_borealDataPrep.R:1147), andconvertUnwantedLCCdraws too.Fix: new parameter
seedVegInit(numeric, default 1,NA= none) passed as the nested module's.seed = list(init = seedVegInit). All the draws run in theinitevent (.inputObjectshas onlyrandomStudyArea(seed = 1234)), and SpaDES.core reads.seedatsimulation-spades.R:255, and at:277-284saves.Random.seed, callsset.seed()for the event and restores the session stream inon.exit. The outerCache()of the nestedsimInitAndSpades()(fireSense_dataPrepFit.R:~1738) digests its call arguments, includingparams = parms, and omits onlypaths; so.seedis in its key (checked by a toy test that uses the same call shape: a second seed adds a cache entry, a repeat adds none). It is also in the key of the init event. The innerCache()calls of the nested module (age-model subset, replacement land cover, biomass model) did not key on it, which is fixed in Biomass_borealDataPrep#156. Users' own.seedentries for other events are kept;NAleaves the module's.seeduntouched.Reuses: SpaDES.core's
.seedparameter,utils::modifyList, the existingparmslist of the nested call; new:nestedVegSeed()(builds the.seedlist; nothing existing does that, and as a function it can be tested). The tests'moduleParams()(copied in two test files) moved tohelper-moduleCode.RasmoduleParamTable()(the old name was shadowed bySpaDES.core::moduleParams).Tests:
test-seedVegInit.R(nestedVegSeed()cases; the parameter default; a toy module whoseinitcallsLandR::subsetDTwith.seed: same seed gives the same subset, even in a fresh cache; another seed gives another; no seed varies). On base it fails (4 failures/errors, nonestedVegSeed). The full nested Biomass_borealDataPrep run was too heavy, so cohortData identity is covered by the toy plus the module-side test in #156. Full suite (convertToPackage()+test_local(), SpaDES.core 3.2.1.9069, fireSenseUtils 0.2.3.9172): branch 145 blocks, 526 passed, 0 failed, 0 errors, 1 skip; base (development) 141 blocks, 514 passed, 0 failed, 0 errors, same 1 skip (DPF_EQUIVALENCE_FIXTUREnot set).🤖 Generated with Claude Code
https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6