pixelGroup
s in partially disturbed pixels.R/disturbances.R
genPGsPostDisturbance.Rd
Re-generate new pixelGroup
s in partially disturbed pixels.
genPGsPostDisturbance(
cohortData,
pixelGroupMap,
disturbedPixelTable,
disturbedPixelCohortData,
colsForPixelGroups = LandR::columnsForPixelGroups,
doAssertion = getOption("LandR.assertions", TRUE)
)
data.table
. The pre-disturbance cohortData
table
SpatRaster
. The pre-disturbance pixelGroupMap
.
data.table
. A table with at least the pixelIndex
of all disturbed pixels. Additional columns are ignored.
a cohortData
-like table with information of dead,
and surviving, but NOT regenerating cohorts (cohorts for whom regeneration via, e.g., serotiny
or resprouting was successfully activated), in disturbed pixels only. Dead cohorts should
age B == 0, surviving cohorts B > 0.
character. cohortData
columns used to find identical pixels in terms of
cohort composition, and group them into pixelGroups
.
A logical indicating whether some internal tests should be run to
ensure the function is running correctly.
Default: getOption("LandR.assertions", TRUE)
.
a named list with:
a cohortData
table with the updated pixelGroups
, as well as
survivor cohorts, but not dead cohorts.
a pixelGroupMap
with the updated pixelGroups
in disturbed pixels
This function regenerates pixelGroup
s in situations where
disturbances are not stand-replacing and create survivor and dead
cohorts in some, but potentially not all, pixels of a pixelGroup
. This is
necessary to prevent reintroducing dead cohorts that were not affected
in the other pixels of the same, original, pixelGroup
.
ATTENTION This function alone will not generate final pixelGroups
,
and will likely need to be followed by an updateCohortData
run.
The function:
creates a table of undisturbed pixels, and disturbed pixels with dead and surviving cohorts
but not new cohorts (e.g. from serotiny/resprouting) -- these are added by updateCohortData
;
generates pixelGroups
considering these dead and surviving cohorts -- this ensures that
we account for cohorts that died in some but not all pixels of a given pixelGroup
;
then removes dead cohorts (as they should not be in tables for downstream
functions like updateCohortData
) and recalculates pixelGroups
-- this ensures that
pixels that became similar/dissimilar after the death of some cohorts can form new pixelGroups
.