Skip to content

Biomass_borealDataPrep gets its own dataYear's stand ages and land cover - #120

Merged
eliotmcintire merged 2 commits into
developmentfrom
fix/borealDataPrep-vegYear
Dec 1, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
fix/borealDataPrep-vegYear

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

Simulations whose vegetation starts before 2020 were given 2020 stand ages, laid on top of the right year's biomass and species. In the 1985 attribution hindcasts, stands that burned just before 1985 started about 38 years old, and stands that burn later started about 11. Each run now gets the age and land-cover maps of the year it starts.

Affects: runs that start the vegetation before the last data year (the attribution hindcasts) get different, correct starting ages. Fits, hindcast validation and NRV runs are unchanged.

Technical details

dataPrepBuild set sim$rstLCC (fireSense_dataPrepFit.R:748) and sim$standAgeMap (:777) to tail(<per-year list>, 1), i.e. 2020. It runs before Biomass_borealDataPrep's init. This module declares standAgeMap as an output, so Biomass_borealDataPrep never builds its own map and builds cohortData with these ages.

Evidence, ELF 4.3 run with dataYear 1985, cohortData_year1985:

  • Cohort biomass correlates 0.994 with SCANFI 1985 biomass.
  • Oldest-cohort age correlates 0.994 with SCANFI 2020 age and 0.878 with SCANFI 1985 age.
  • Inside NFDB fires, age = 2020 − fire year in 72.5% of pixels.

Fix: Init records mod$vegStartYear <- params(sim)$Biomass_borealDataPrep$dataYear. It is read in Init, not in the cached dataPrepBuild, because that event's key covers mod$ but not other modules' parameters. dataPrepBuild then takes the element vegStartYearName() picks: the latest data year at or before that year (fireSenseUtils::dataYearElement()), or the last element when Biomass_borealDataPrep is absent, as before.

Not changed: propFlammable, rstLCC_RTM, flammableRTM and nonForest_timeSinceDisturbance still take the last element. They are prediction inputs, and fireSense_dataPrepPredict sets its own per-year values for hindcasts.

Tests: new test-vegStartYear.R, 12 passing (the year rule, plus checks that dataPrepBuild and Init use it). test-dataPrepBuild.R passes. test-metadata.R has the same 2 failures and 1 error as development.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXfVqAugcusGHygZGJ3

…ge and land cover

dataPrepBuild set sim$standAgeMap and sim$rstLCC to the last of dataYears (2020).
Biomass_borealDataPrep uses them as given, so a run that starts its vegetation in
1985 got 2020 stand ages on 1985 biomass and species. The year is read in Init
(mod$vegStartYear), because the cached dataPrepBuild's key covers mod$ but not
other modules' parameters. New test-vegStartYear.R.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXfVqAugcusGHygZGJ3
@eliotmcintire
eliotmcintire merged commit 62c1453 into development Dec 1, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the fix/borealDataPrep-vegYear branch December 1, 2026 04:35
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