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
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# fireSense_spreadPredict (development version)

- `lowerSpreadProb` and `maxFireSpread` default to `fireSenseUtils::spreadProbFloor` (0.13) and `fireSenseUtils::spreadProbCeiling` (0.276; `maxFireSpread` was 0.28), the one floor and ceiling `fireSense_spreadFit` and the objective use. `maxFireSpread` does not change a prediction. Needs the `fireSenseUtils` change in PredictiveEcology/fireSenseUtils (floor to be set once it has a version).

# fireSense_spreadPredict 1.1.3

- A ledger row from a fit with an intercept (a parameter named `fireSenseUtils::spreadInterceptTxt`, from `fireSense_dataPrepFit`'s `spreadIntercept`) is predicted with it: `spreadProbOneELF()` adds a column of 1s for it after rescaling and centring, and subtracts the row's stored covariate centres (`fireSenseUtils::spreadFitCovCentreTxt`, `ledgerCovCentre()`) from the rescaled covariates, as the fit did. With several ELFs each row uses its own. A row without them, such as every row written so far, predicts exactly as before. Needs fireSenseUtils >= 0.2.3.9083 (PredictiveEcology/fireSenseUtils#131).
Expand Down
10 changes: 6 additions & 4 deletions fireSense_spreadPredict.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ defineModule(sim, list(
"ggplot2", "viridis",
"PredictiveEcology/fireSenseUtils@development (>= 0.2.3.9083)"),
parameters = bindrows(
defineParameter(name = "lowerSpreadProb", class = "numeric", default = 0.13,
desc = "Lower asymptote of the 2- and 3-parameter logistic."),
defineParameter(name = "lowerSpreadProb", class = "numeric", default = fireSenseUtils::spreadProbFloor,
desc = paste("Lower asymptote of the 2- and 3-parameter logistic. Default",
"`fireSenseUtils::spreadProbFloor`, the same constant `fireSense_spreadFit` fits with.")),
defineParameter("ELFblendWidth", "numeric", default = 20000,
desc = paste("With several ELFs: each ELF's model also predicts this far (m) outside its own",
"pixels, and where predictions overlap they are averaged with weights that fall",
"linearly from 1 inside the ELF to 0 at this distance outside it. 50/50 at a",
"boundary. The default is the buffer fireSenseUtils::makeELFs() puts around ELFs.")),
defineParameter("maxFireSpread", "numeric", default = 0.28,
desc = paste("Upper limit on `spreadProb` used when fitting. Here it is only checked",
defineParameter("maxFireSpread", "numeric", default = fireSenseUtils::spreadProbCeiling,
desc = paste("Upper limit on `spreadProb` used when fitting (default",
"`fireSenseUtils::spreadProbCeiling`). Here it is only checked",
"to be the same in every module that defines it.")),
defineParameter(".rep", "integer", default = 1L, min = 1L, max = NA,
desc = paste("Which replicate this prediction is. It selects parameter set",
Expand Down
9 changes: 8 additions & 1 deletion tests/testthat/test-metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ test_that("parameters have the expected names, classes and defaults", {
expected <- data.frame(
class = c("integer", "numeric", "numeric", "numeric", "character", "logical", "numeric", "numeric", "numeric"),
## .runInitialTime defaults to start(sim), which is 0 when only metadata is parsed
default = c("1L", "0", "1", "NA", "NA", "FALSE", "20000", "0.13", "0.28"),
default = c("1L", "0", "1", "NA", "NA", "FALSE", "20000", "0.13", "0.276"),
row.names = c(".rep", ".runInitialTime", ".runInterval", ".saveInitialTime", ".studyAreaName", ".useCache",
"ELFblendWidth", "lowerSpreadProb", "maxFireSpread")
)
expect_identical(paramTable(md), expected)
})

test_that("lowerSpreadProb and maxFireSpread default to fireSenseUtils' one floor and one ceiling", {
md <- SpaDES.core::moduleMetadata(module = moduleName, path = modulePath)
dflt <- function(nm) md$parameters$default[[match(nm, md$parameters$paramName)]]
expect_identical(dflt("lowerSpreadProb"), fireSenseUtils::spreadProbFloor)
expect_identical(dflt("maxFireSpread"), fireSenseUtils::spreadProbCeiling)
})

test_that("fireSenseUtils is a declared dependency, so CI installs it", {
md <- SpaDES.core::moduleMetadata(module = moduleName, path = modulePath)
expect_true(any(grepl("^PredictiveEcology/fireSenseUtils@development", unlist(md$reqdPkgs))))
Expand Down
Loading