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

Calculate new values for B, add age, then rbindlist this with cohortData.

addCohorts(newCohortData, cohortData, pixelGroupMap, time,

initiateNewCohort(newCohortData, cohortData, pixelGroupMap, time,



must be a complete cohortData object with entirely new pixelGroup values (i.e., already non-overlapping with cohortData. Columns it must have: pixelGroup, speciesCode, ecoregionGroup


a data.table with columns: pixelGroup, ecoregionGroup, speciesCode, age, B, mortality, aNPPAct, and sumB.


Raster layer with pixel values equal to a pixel group number that correspondsd exactly to pixelGroup column in cohortData


Current time e.g., time(sim). This is used to extract the correct parameters in speciesEcoregion table if there are different values over time


A speciesEcoregion table.


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

initiateNewCohort returns A data.table with a new, rbindlisted cohortData


Does the following:

  1. add new cohort data into cohortdata;

  2. assign initial biomass and age for new cohort;

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

  4. update the pixelgroup map.