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.

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

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

.initiateNewCohorts(
  newPixelCohortData,
  cohortData,
  pixelGroupMap,
  currentTime,
  cohortDefinitionCols = c("pixelGroup", "speciesCode", "age"),
  speciesEcoregion,
  successionTimestep
)

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.

cohortData

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

pixelGroupMap

A RasterLayer with pixel values equal to a pixel group number that corresponds exactly to pixelGroup column in cohortData.

currentTime

The current simulation time e.g., time(sim).

speciesEcoregion

A data.table with speciesEcoregion values.

treedFirePixelTableSinceLastDisp

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.

successionTimestep

The time between successive seed dispersal events. In LANDIS-II, this is called "Succession Timestep". This is used here

cohortDefinitionCols

the columns in cohortData that define unique cohorts

verbose

Integer, where increasing number is increasing verbosity. Currently, only level 1 exists; but this may change.

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 list of length 2, cohortData and pixelGroupMap, with newPixelCohortData inserted.

A data.table with a new rbindlisted cohortData

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.