Joins fireID/attempt/targetSize onto the cluster table spread2() returns, keyed on the fire's start cell.

landmine_attach_identity(fa, idDT)

Arguments

fa

the clusterDT from a burn – needs initialPixels.

idDT

a data.table with initialPixels, fireID, attempt and targetSize, one row per fire ignited this round.

Value

fa with fireID, attempt and targetSize added.

Details

spread2() returns clusters in its own order, which is not the order start cells were handed to it, so identity must be joined rather than assigned by position. Row order of fa is preserved.

Every burned cluster must match an ignited fire. An unmatched one would carry NA identity into fireSizes, silently corrupting per-fire attainment while leaving sum(size) == sum(maxSize) intact – so nothing downstream would catch it. It is an error.

Examples

fa <- data.table::data.table(initialPixels = c(12L, 11L), size = c(10, 500))
idDT <- data.table::data.table(
  initialPixels = c(11L, 12L), fireID = c(7L, 3L),
  attempt = c(1L, 2L), targetSize = c(500, 40)
)
landmine_attach_identity(fa, idDT)
#>    initialPixels  size fireID attempt targetSize
#>            <int> <num>  <int>   <int>      <num>
#> 1:            12    10      3       2         40
#> 2:            11   500      7       1        500