Before predicting, every stored ignition and escape fit (each ELF’s, with several) is checked against the covariates to predict (fireSenseUtils::storedFitProblem()): a fit that is not Poisson or uses features the covariates lack stops the run, naming the ELF, process and features, and saying to refit or to choose another ledger (fitFileSuffix). Needs fireSenseUtils (>= 0.2.3.9177).
With a fit that has fitted year effects (modelList$yearEffects, from fireSense_ignitionFit), fireSense_IgAndEscapeProbRas has two more layers for the year floor(time(sim)), ignitionYearEffect and escapeYearEffect (NA in an ELF without one) and ignitionYearEffectShape and escapeYearEffectShape (the shape of their gamma posteriors), for fireSense_burn’s yearEffects = "fitted" in hindcasts. Without them the raster is as before. foldModels() and foldMeanPrediction() moved to fireSenseUtils (same predictions), so fireSense_ignitionFit predicts exactly as this module does; a fit without fold models stops with “no fold models”.
ignitionFitRTM, the coarse grid the probability rasters are made on, is declared as an input (it was read undeclared).
fireSense_IgAndEscapeProbRas has two more layers, ignitionYearSD and escapeYearSD: the sd of the year effect of each pixel’s ELF’s ignition and escape fit (modelList$yearSD, written by fireSense_ignitionFit; 0 for a fit stored without one, yearSDOf()). fireSense_burn draws one z per year, shared with spread, and multiplies both means by exp(sd * z - sd^2 / 2). The ignitionProb and escapeProb layers are unchanged.
The objective of a fitted model is read with fireSenseUtils::xgbObjective(), the one copy shared with fireSense_ignitionFit, instead of this module’s own lookup; same result. Needs fireSenseUtils (>= 0.2.3.9104).
Fix: the objective of the fitted models is read with xgboost::xgb.config() (falling back to attr(model, "params")), not model$params, which is NULL for xgboost >= 3 boosters, so every prediction run stopped at the ignition step. xgboost (>= 3.0.0) is now in reqdPkgs.
Breaking: the module now only predicts; it draws nothing and no longer makes ignitionsAndEscapes. fireSense_burn draws the ignitions and escapes from the new fireSense_IgAndEscapeDistribution and fireSense_IgAndEscapeProbRas, and places them (placeIgnitions(), coarseToFineMap() and fineCoarseTable() moved there). flammableRTM is no longer an input.
fireSense_IgAndEscapeProbRas layer escapeProb is the expected escapes per pixel and year for every pixel (it was NA where no ignition was drawn), no longer clamped to [0, 1]; ignitionProb is the expected ignitions.
New output fireSense_IgAndEscapeDistribution, list(ignition, escape), the objective read from the fitted models; stops if it cannot be read or folds or ELFs disagree.
Escapes now follow the fitted Poisson model (drawn in fireSense_burn as Poisson, capped at the ignitions), not rbinom(ignitions, min(mean, 1)); a seed no longer reproduces earlier runs.
A year with no ignitions now gives a 0-row ignitionsAndEscapes with the same columns and types (pixelID, igProb, ignitions, escapeProb, escapes, escaped) as any other year. Before, it had no columns, so code reading $pixelID got NULL (fireSenseUtils::hindcastSimulated() failed). Years with ignitions are unchanged.
SpaDES.core is now in reqdPkgs (scheduleEvent(), P(), Plots() are used).
Ignitions are placed on fine pixels with one split() of the candidate pixels and a pixelID-to-row lookup, instead of two scans of the whole fine-pixel table for every ignited coarse pixel (about 3 s a year at 1.3M flammable fine pixels). The same draws are made in the same order, so ignitions, escapes and the random number stream are unchanged.
This release fixes two errors that changed how many fires the module predicted. Weather and landscape conditions are now compared against the conditions the model was fitted on; before, each year was compared only with itself, so every year looked average to the model and hot or dry years did not stand out. And when several fires started in the same area, the module could count more escaped fires than actually escaped; each escape is now counted once. Results will differ from earlier versions, and should be more realistic.
The module also has a new name, fireSense_ignitionPredict (lower-case “i”), so projects need to update the name they use for it. It can now use a separate fitted model for each region (ELF) of a study area, runs faster on large maps, and has automated tests and a documentation website.
mod, then applied each year by indexing, instead of regridding the raster to flammableRTM with postProcess() every year (about 3 s a year at 6.7M fine cells). It is rebuilt if the extent, dimensions or crs of ignitionFitRTM or flammableRTM change. Ignitions and escapes are unchanged.data.table and reproducible, which the module calls (:=, copy, set, setnames, rbindlist, as.data.table, postProcess) but did not list. Version 1.1.1.Renamed from fireSense_IgnitionPredict to fireSense_ignitionPredict (module naming convention <model>_<camelCaseComponent>); projects must rename the module and its params key. The class fireSense_IgnitionFit and the objects fireSense_IgnitionFitted, fireSense_IgnitionFittedList and fireSense_IgnitionPredicted keep their names. Version 1.1.0.
ignitionsAndEscapes gains escaped: whether each ignition escaped, with exactly escapes of a coarse pixel’s ignitions TRUE. escapes is the coarse pixel’s count, repeated on each of its ignitions, and fireSense spread escapes fires from every one of them, so a coarse pixel with 4 ignitions and 2 escapes gave 8 escaped fires instead of 2. Version 1.0.0.9003.
New parameter .studyAreaName (default NA), the name PredictiveEcology modules use for the study area. This module does not use it yet.
Several fitted ELFs in one study area: with fireSense_IgnitionFittedList and fireSense_EscapeFittedList (one fit per ELF, named by ELFind) and rasterToMatchLargeELF, each ELF’s models predict the coarse pixels of that ELF, with its own scaleData. The Poisson and binomial draws are still made once over all pixels, so one ELF gives exactly the previous result.
fireSense_IgnitionFitted$scaleData, fireSense_EscapeFitted$scaleData). They were standardized with each year’s own mean and sd, so every year looked average to the models. With rescaleVars = TRUE, a fitted object without scaleData is now an error.First release from development since master was last updated (2021-03-11). Full history: https://github.com/PredictiveEcology/fireSense_IgnitionPredict/compare/5a242fa…v1.0.0
dataFireSense_IgnitionPredict (data.frame, RasterLayer, RasterStack).fireSense_IgnitionPredicted.data, mapping, modelObjName, rescaleFactor.