Convert fire sizes in hectares to whole pixels, preserving the expectation

landmine_sizes_to_pixels(sizesHa, pixelAreaHa)

Arguments

sizesHa

numeric, fire sizes in hectares.

pixelAreaHa

numeric, the area of one pixel in hectares.

Value

A numeric vector of whole pixel counts, the same length as sizesHa.

Details

Truncating to whole pixels would systematically lose every fire smaller than one pixel – at a 6.25 ha pixel, a 3.25 ha fire is "not detectable". Rounding the fractional part probabilistically instead keeps E[pixels] == sizesHa/pixelAreaHa, so the fire-size distribution's mean survives the discretisation even though any individual small fire may round to zero. Fires that do round to zero are dropped by the caller.

Exact multiples of pixelAreaHa never round up, because the fractional part is 0 and 0 > runif(1) is FALSE.