Collapses the per-burn rows to one row per fire and reports whether that fire ever reached the target it was ignited for.

landmine_fire_attainment(fireSizes, by = "fireID")

Arguments

fireSizes

a data.table (or coercible) with fireID, attempt, targetSize, size and maxSize – i.e. sim$fireSizes from LandMine, row-bound across years.

by

character; the columns that identify one fire. fireID is issued per burn YEAR, so it is unique only within a year: a table spanning years needs c("year", "fireID"), and one spanning replicates c("rep", "year", "fireID"). Grouping too coarsely merges unrelated fires and reports a target no single fire ever had.

Value

A data.table keyed by fireID with burned (pixels), target (pixels), attempts and reached.

Details

size == maxSize holds for every row by construction, because a fire that stalls is either discarded and retried at full target, or has its maxSize rewritten to the area that did burn while the shortfall is re-issued as new fires. So maxSize cannot express a shortfall, and attainment is only meaningful per fireID against targetSize: a fire is short only when it exhausted maxReburns[2] and was abandoned.

attempts is the highest attempt index reached, so it answers "did this fire reach its target on the first try, or the fourth?".

Examples

fs <- data.table::data.table(
  fireID = c(1L, 2L, 2L), attempt = c(1L, 3L, 4L),
  targetSize = c(100, 200, 200), size = c(100, 60, 90), maxSize = c(100, 60, 90)
)
landmine_fire_attainment(fs)
#>    fireID burned target attempts reached
#>     <int>  <num>  <num>    <int>  <lgcl>
#> 1:      1    100    100        1    TRUE
#> 2:      2    150    200        4   FALSE