Repository navigation
prepInputsFireYear(latestYear): stand age in reburned perimeters for earlier data years - #275
Merged
Merged
Conversation
…at or before the data year Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
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.
Stand ages inside old burns were wrong where a pixel burned twice: the later fire hid the earlier one, so for an earlier vegetation year the pixel kept its satellite age. The fire map used for a vegetation year now ignores fires after that year.
Affects: stand age (and biomass re-estimated from it) inside reburned fire perimeters, for vegetation years earlier than the latest fire.
Technical details
Defect:
prepInputsFireYear()(R/prepInputObjects.R, theterra::rasterize(..., fun = max)call) keeps only the most recent fire of any year per pixel, andreplaceAgeInFires()only changes pixels with fire year <=startTime. A pixel burned in 1980 and 2015 holds 2015, so forstartTime1990 it was skipped.Fix: new argument
latestYear(defaultInf, so other callers are unchanged) drops fires after that year before rasterizing;prepInputsStandAgeMap()passesdataYearwhen it builds the raster itself (afirePerimeterssupplied by the caller is used as given).Tests (offline, file:// sources):
prepInputsFireYear(latestYear = 1990)gives 1980 for a 1980/2015 pixel and 2015 with no limit;replaceAgeInFires(startTime = 1990)then gives age 10; no fires before the limit gives an empty raster;prepInputsStandAgeMap(dataYear = 2011)gives 31 at that pixel. These fail on development (4 and 1 failures) and pass on the branch. Fulltestthatrun: development 0 failures, 1380 passed, 21 skipped; branch 0 failures, 1387 passed, 21 skipped.R CMD check --no-manual(scratch libraryphase4/lib,_R_CHECK_FORCE_SUGGESTS_=falsebecause BioSIM is not installed): 0 errors, 0 warnings, 1 note (existing undefined-global notes in.adjustNewCohortsERGanddropUnsupportedSpecies).🤖 Generated with Claude Code