Re-generate new pixelGroups in partially disturbed pixels.

genPGsPostDisturbance(
  cohortData,
  pixelGroupMap,
  disturbedPixelTable,
  disturbedPixelCohortData,
  colsForPixelGroups = LandR::columnsForPixelGroups,
  doAssertion = getOption("LandR.assertions", TRUE)
)

Arguments

cohortData

data.table. The pre-disturbance cohortData table

pixelGroupMap

SpatRaster. The pre-disturbance pixelGroupMap.

disturbedPixelTable

data.table. A table with at least the pixelIndex of all disturbed pixels. Additional columns are ignored.

disturbedPixelCohortData

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.

colsForPixelGroups

character. cohortData columns used to find identical pixels in terms of cohort composition, and group them into pixelGroups.

doAssertion

A logical indicating whether some internal tests should be run to ensure the function is running correctly. Default: getOption("LandR.assertions", TRUE).

Value

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

Details

This function regenerates pixelGroups 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:

  1. 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;

  2. 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;

  3. 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.