Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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()`.
Expand Down
6 changes: 3 additions & 3 deletions fireSense_dataPrepFit.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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`",
Expand Down
2 changes: 1 addition & 1 deletion fireSense_dataPrepFit.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Parameters are in Table \@ref(tab:moduleParams-fireSense-dataPrepFit).
<td style="text-align:left;"> 1985, 19.... </td>
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> NA </td>
<td style="text-align:left;"> 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. </td>
<td style="text-align:left;"> 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. </td>
</tr>
<tr>
<td style="text-align:left;"> flammabilityThreshold </td>
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-fireYearsDefault.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()))
})
Loading