From 1369141d2cc45a74ccf509716088378d7db8f690 Mon Sep 17 00:00:00 2001 From: Eliot McIntire Date: Thu, 15 Oct 2026 14:22:34 -0700 Subject: [PATCH] fireYears default is plain defaultFireYears(); fireSenseUtils floor 0.2.3.9099 Co-Authored-By: Claude Opus 5.5 --- NEWS.md | 2 ++ fireSense_dataPrepFit.R | 6 +++--- fireSense_dataPrepFit.md | 2 +- tests/testthat/test-fireYearsDefault.R | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 023376a..0e9f0e5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # fireSense_dataPrepFit (development version) +- The `fireYears` default is plain `fireSenseUtils::defaultFireYears()`, which now starts in 1986 (before, this module dropped its first year with `[-1L]`). Floor `fireSenseUtils` raised to 0.2.3.9099, the first version whose `defaultFireYears()` starts in 1986 (PredictiveEcology/fireSenseUtils#158). The default fire years do not change; `fireSense_ELFs` shares them. + - Fixed: each fire year is fitted against vegetation from an earlier year. A year's satellite vegetation already shows part of that year's fires (ELF 6.6.2: pixels burned in 2010 have mean biomass 64 in the 2005 vegetation and 26 in the 2010 vegetation, while unburned pixels are near 79 in both), so the fits learned that fire burns where the vegetation already looks burned. A fire year now uses the latest data year strictly before it (1986-1990 use 1985, 1991-2000 use 1990, ...; `yearGroups()`, `lccShareForYear()`, `fitDecisionYear()`'s data year), the decision year of the structure of the model included, and every `fireYears` must be after the first of `dataYears`, with an error otherwise. The `fireYears` default therefore starts in 1986. Fits, ignition and escape alike, must be redone. Prediction is unchanged: it still uses the data year at or before the year. - `spreadFitGoogleDriveFolder` defaults to `fireSenseUtils::spreadFitLedgerFolder()`, which follows `options(fireSenseUtils.spreadFitLedgerFolder = )`. `fireSenseUtils` floor raised to 0.2.3.9097, the first version with `spreadFitLedgerFolder()`. diff --git a/fireSense_dataPrepFit.R b/fireSense_dataPrepFit.R index 37aae15..2c7a4ea 100644 --- a/fireSense_dataPrepFit.R +++ b/fireSense_dataPrepFit.R @@ -17,7 +17,7 @@ defineModule(sim, list( reqdPkgs = list("data.table", "fastDummies", "Require", "PredictiveEcology/reproducible@development (>= 3.2.1.9042)", # CacheGeo re-reads a changed local file "PredictiveEcology/climateData@development (>= 2.2.3.9006)", - "PredictiveEcology/fireSenseUtils@development (>= 0.2.3.9097)", # dataYearFor(), dataYearElement() + "PredictiveEcology/fireSenseUtils@development (>= 0.2.3.9099)", # defaultFireYears() from 1986; dataYearFor(), dataYearElement() "FOR-CAST/fireregimetools@main (>= 0.1.0.9008)", "ggplot2", "parallel", "purrr", "raster", "sf", "sp", "PredictiveEcology/LandR@development (>= 1.2.0.9015)", @@ -53,11 +53,11 @@ defineModule(sim, list( paste("Estimate fuel classes with `fireSenseUtils::assessFuelClasses`? Skipped if the user supplies", "`nonForestedLCCGroups`, `fuelClassTable` or a `FuelClass` column that differs from LandR's,", "or if a previous SpreadFit exists for the study area.")), - defineParameter("fireYears", "integer", fireSenseUtils::defaultFireYears()[-1L], NA, NA, + defineParameter("fireYears", "integer", fireSenseUtils::defaultFireYears(), NA, NA, paste("Years of fire records to use for fitting. All must be after the first of `dataYears`,", "and `historicalClimateRasters` must cover all of them. The default runs from 1986, the", "year after the first SCANFI V2 year, to the latest year with historical climate for every tile", - "(`fireSenseUtils::defaultFireYears()` without its first year); climate is the last of the inputs to reach a year.", + "(`fireSenseUtils::defaultFireYears()`); climate is the last of the inputs to reach a year.", "`fireSense_ELFs` takes its `fireYears` default from the same function.")), defineParameter("flammabilityThreshold", "numeric", fireSenseUtils::fireSenseFlammabilityThreshold, 0, 1, paste("Minimum proportion of flammable fine-resolution land cover for a `rasterToMatch`", diff --git a/fireSense_dataPrepFit.md b/fireSense_dataPrepFit.md index 42645bb..861f631 100644 --- a/fireSense_dataPrepFit.md +++ b/fireSense_dataPrepFit.md @@ -356,7 +356,7 @@ Parameters are in Table \@ref(tab:moduleParams-fireSense-dataPrepFit). 1985, 19.... NA NA - Years of fire records to use for fitting. All must be after the first of `dataYears`, and `historicalClimateRasters` must cover all of them. The default runs from 1986, the year after the first SCANFI V2 year, to the latest year with historical climate for every tile (`fireSenseUtils::defaultFireYears()` without its first year); climate is the last of the inputs to reach a year. `fireSense_ELFs` takes its `fireYears` default from the same function. + Years of fire records to use for fitting. All must be after the first of `dataYears`, and `historicalClimateRasters` must cover all of them. The default runs from 1986, the year after the first SCANFI V2 year, to the latest year with historical climate for every tile (`fireSenseUtils::defaultFireYears()`); climate is the last of the inputs to reach a year. `fireSense_ELFs` takes its `fireYears` default from the same function. flammabilityThreshold diff --git a/tests/testthat/test-fireYearsDefault.R b/tests/testthat/test-fireYearsDefault.R index d8916bc..74c37c9 100644 --- a/tests/testthat/test-fireYearsDefault.R +++ b/tests/testthat/test-fireYearsDefault.R @@ -18,7 +18,7 @@ test_that("the default fire years run from the year after the first data year to expect_no_error(yearGroups(dataYears, fireYears)) }) -test_that("the default is fireSenseUtils::defaultFireYears() less its first year, which fireSense_ELFs shares", { +test_that("the default is fireSenseUtils::defaultFireYears(), which fireSense_ELFs shares", { ## the default is defined once, in fireSenseUtils, so the ELF merging and the fit count the same years exprs <- parse(file.path(modulePath, moduleName, paste0(moduleName, ".R")), keep.source = FALSE) found <- list() @@ -31,5 +31,5 @@ test_that("the default is fireSenseUtils::defaultFireYears() less its first year } for (e in exprs) walk(e) expect_length(found, 1L) - expect_identical(found[[1]][[4]], quote(fireSenseUtils::defaultFireYears()[-1L])) + expect_identical(found[[1]][[4]], quote(fireSenseUtils::defaultFireYears())) })