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,
  trackPlanting = FALSE,
  initialB = 10,
  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.

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 species-ecoregion-specific species trait values. Ecoregion refers to "ecolocation", a categorical variable grouping sites with similar biophysical characteristics. The table should have at least the following columns: speciesCode and ecoregionGroup, character representation of species and ecoregion groups respectively, maxB the maximum biomass for the species in a given 'ecoregion', maxANPP the maximum aboveground net primary productivity and SEP the species establishment probability. May contain columns inflationFactor (used to adjust maxB) and mANPPproportion (used to calculate maxANPP).

treedHarvestPixelTable

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

provenanceTable

A data.table with three columns: New cohorts are initiated at the ecoregionGroup speciesEcoregion from the corresponding speciesEcoregion listed in the Provenance column

trackPlanting

if true, planted cohorts in cohortData are tracked with TRUE in column 'planted'

initialB

the initial biomass of new cohorts. Defaults to ten, even if NA/NULL is passed.

cohortDefinitionCols

the columns in cohortData that define unique cohorts

verbose

Controls message output. Defaults to getOption("LandR.verbose")

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.

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.