From 16c2cba33e942c2a64363edd8bbc5593f1f6fdb0 Mon Sep 17 00:00:00 2001 From: Eliot McIntire Date: Mon, 16 Nov 2026 17:36:14 -0700 Subject: [PATCH] ELFlabels() reads the cell labels with fireSenseUtils::elfCellLabels() Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6 --- NEWS.md | 2 ++ fireSense_dataPrepPredict.R | 9 ++++----- tests/testthat/test-ELFlabels.R | 10 ++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 tests/testthat/test-ELFlabels.R diff --git a/NEWS.md b/NEWS.md index 9b21cd3..ae13152 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # fireSense_dataPrepPredict (development version) +* `ELFlabels()` reads the ELF of each cell with `fireSenseUtils::elfCellLabels()`, the lookup `fireSense_spreadPredict` uses too, instead of its own copy. The set it returns is now the labels of the cells (`unique()`, without `NA`): a category no cell has is no longer in it. Needs fireSenseUtils with `elfCellLabels()` (Depends-on PredictiveEcology/fireSenseUtils#244); the `reqdPkgs` floor is set after that merges. + * A hindcast of year Y built `youngAge` differently from the fit, for the spread and the ignition covariates: it used the cohort ages and the data year's time since disturbance as they were, and did not see a fire between the data year and Y (youngAge was 2.8% of burned pixels in ELF 6.6.2 in 2010, 1.5% in the fit). It now resolves it as `fireSense_dataPrepFit` does: the data year's time since disturbance aged to Y and every fire after it, from `fireSenseUtils::youngAgeAtYear()` (spread) and `fireSenseUtils::prepare_FuelCovsCoarseByYear()` (ignition), with the fires from `historicalFireRaster`, else `firePolysForAge` (`fireSenseUtils::firePixelsByYear()`, as the fit chooses). Fuel, non-forest land cover and treed wetland are cleared where `youngAge` is 1 in the covariate table itself (`fireSenseUtils::clearYoungAge()`, which the ignition fit uses), so a fit on log-scale fuel, for which `fireSense_spreadPredict` clears only the indicators, is right too. A hindcast with `nonForestCanBeYoungAge = FALSE` stops, as the fit does (`fireSenseUtils::stopIfNonForestCannotBeYoung()`). New inputs `firePolysForAge` and `historicalFireRaster` (from `fireSense_dataPrepFit`); a hindcast with neither stops. Hindcast covariates, and so their cache keys, change. Forecasts (a module simulates `cohortData`) are unchanged. Needs the fireSenseUtils version after PredictiveEcology/fireSenseUtils#239 merges; the `reqdPkgs` floor is set after that merge's version bump. * New parameters `replaySave` (default `FALSE`) and `replayFrom` (default `NA`): no change unless set. `replaySave = TRUE` writes, once after the first covariate build, the spread-prediction inputs that do not depend on the spread parameters to `outputPath(sim)` through SpaDES.core's `outputs()` (its `save` event): `fireSense_SpreadCovariates`, `flammableRTM`, `rasterToMatch`, `rasterToMatchELF`, `rasterToMatchLargeELF`, `studyAreaWithSpreadParams`, `nonEscapedFireSizesHa`, `ignitionFirePoints` and `firePolys` (those present), as `replay__year