Skip to content

getClimate: handle an empty projectedClimateRasters list - #6

Closed
eliotmcintire wants to merge 2 commits into
developmentfrom
fix-empty-projected
Closed

eliotmcintire wants to merge 2 commits into
developmentfrom
fix-empty-projected

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

Runs that sample only past climate (NRV) now ask for no future climate, and the climate-year step stopped every one of them because it assumed at least one future layer. It now treats an empty list like a missing one.

Affects: NRV runs (no projected climate) no longer stop at the start; runs with projected climate are unchanged.

Technical details
  • climateYear.R getClimate: if (!is.null(sim$projectedClimateRasters)) names(sim$projectedClimateRasters[[1]]) fails with subscript out of bounds on list(). FireSense NRV runs now set canClimateData projectedClimateYears = integer(0) (fireSense_dataPrepFit#65), which yields an empty list.
  • New availableClimateYears(projected, historical) checks length() for both lists; getClimate uses it.
  • Test tests/testthat/test-availableClimateYears.R: empty/NULL projected list, combined/sorted/unique years. Module suite: 6 tests, 0 failures (convertToPackage + test_local).

🤖 Generated with Claude Code

NRV runs ask canClimateData for no projected years and get an empty list, which
is not NULL, so names(sim$projectedClimateRasters[[1]]) stopped every job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eliotmcintire eliotmcintire added the bug Something isn't working label Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eliotmcintire added a commit that referenced this pull request Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant