Skip to content

Stop early when run times are not calendar years - #8

Closed
eliotmcintire wants to merge 2 commits into
developmentfrom
defaults-safe
Closed

eliotmcintire wants to merge 2 commits into
developmentfrom
defaults-safe

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

When a project is set up without times, the run is in model years 0 to 10 and this module quietly drew random climate years instead of matching the simulation years. It now stops at the start and says what to set. Separately, a multi-year run with no rasters supplied no longer errors in .inputObjects.

Affects: With supplied climate rasters and no samplingRange, a run whose start is not a year from 1901 to 2100 now stops at init; a run with samplingRange or calendar-year times is unchanged. Multi-year runs without supplied rasters now start.

Technical details

Depends-on: PredictiveEcology/climateData#32

sampleYear() (climateYear.R) falls back to sample(Range, 1) whenever the simulation year is not in the available years, so model-year times never matched and the draw was silent. Init() now calls climateData::checkCalendarYears() (replacing the copy in this module) when the user supplied climate rasters and samplingRange is unset; the message says to set times or samplingRange. The placeholder in .inputObjects used terra::rast(nlyrs = start(sim):end(sim)), which errors ("the condition has length > 1") for any run longer than one year; nlyrs is now length(Range). reqdPkgs gains climateData with floor 2.2.3.9009, today's development version; raise it after climateData#32 merges. Tests (test-calendarYears.R, including a multi-year run with no rasters) fail on development and pass here. Suite via convertToPackage + test_local: development 5 pass; branch 10 pass, 0 failures.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eliotmcintire eliotmcintire added enhancement New feature or request backwards compatible Existing code and results keep working unchanged labels Oct 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eliotmcintire added a commit that referenced this pull request Oct 16, 2026
Conflicts resolved by hand: reqdPkgs: union (sf + climateData floor); init keeps md5 line and calendar-year check. NEWS: both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@eliotmcintire

Copy link
Copy Markdown
Contributor Author

Closing: this change is carried on modsForFireSense and offered upstream together with our other FireSense fixes in #9. That PR lists it; the discussion here stays for reference.

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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant