This is a wrapper for generatePixelGroups, initiateNewCohort and updates to pixelGroupMap via assignment to new pixelIndex values in newPixelCohortData. By running these all together, there is less chance that they will diverge. There are some checks internally for consistency.

updateCohortDataPostHarvest(
newPixelCohortData,
cohortData,
pixelGroupMap,
currentTime,
speciesEcoregion,
treedHarvestPixelTable = NULL,
successionTimestep,
provenanceTable,
cohortDefinitionCols = c("pixelGroup", "age", "speciesCode"),
verbose = getOption("LandR.verbose", TRUE),
doAssertion = getOption("LandR.assertions", TRUE)
)

## Arguments

newPixelCohortData must be a complete cohortData object with newly created cohorts. They do not have to have pixelGroup values yet; they can be overlapping with cohortData, (i.e., they can be regenerated on empty pixels or on already occupied pixels). Must contain the columns: pixelIndex, speciesCode, ecoregionGroup. The remaining 4 (see cohortData) will be created with 0s. A data.table with columns: pixelGroup, ecoregionGroup, speciesCode, and optionally age, B, mortality, aNPPAct, and sumB. A RasterLayer with pixel values equal to a pixel group number that corresponds exactly to pixelGroup column in cohortData. The current simulation time e.g., time(sim). A data.table with speciesEcoregion values. A data.table with at least 2 columns, pixelIndex and pixelGroup. This will be used in conjunction with cohortData and pixelGroupMap to ensure that everything matches correctly. The time between successive seed dispersal events. In LANDIS-II, this is called "Succession Timestep". This is used here A data.table with three columns: New cohorts are initiated at the ecoregionGroup speciesEcoregion from the corresponding speciesEcoregion listed in the Provenance column the columns in cohortData that define unique cohorts Integer, where increasing number is increasing verbosity. Currently, only level 1 exists; but this may change. A logical indicating whether some internal tests should be run to ensure the function is running correctly. Default: getOption("LandR.assertions", TRUE).

## Value

A list of length 2, cohortData and pixelGroupMap, with newPixelCohortData inserted.

## Details

Does the following:

1. add new cohort data into cohortData;

2. assign initial B and age for new cohort;

3. assign the new pixelGroup to the pixels that have new cohort;

4. update the pixelGroup map.