Takes a pixelCohortData table (see makeAndCleanInitialCohortData), the speciesEcoregion list and returns a modified pixelCohortData and the cohortData tables to be used in the simulation. This function mainly removes unnecessary columns from pixelCohortData, subsets pixels with biomass > 0, generates pixelGroups, and adds ecoregionGroup and totalBiomass columns to pixelCohortData. cohortData is then created by subsetting unique combinations of pixelGroup and whatever columns are listed in columnsForPixelGroups. The resulting cohortData table has the following columns:

  • speciesCode (factor)

  • ecoregionGroup (factor)

  • pixelGroup (integer)

  • age (integer)

  • B (integer)

makeCohortDataFiles(
  pixelCohortData,
  columnsForPixelGroups,
  speciesEcoregion,
  pixelGroupBiomassClass,
  pixelGroupAgeClass,
  minAgeForGrouping = 0,
  rmImputedPix = FALSE,
  imputedPixID,
  pixelFateDT
)

Arguments

pixelCohortData

The full cohortData data.table

columnsForPixelGroups

Default columns that define pixel groups

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

pixelGroupBiomassClass

Integer. When assigning pixelGroup membership, this defines the resolution of biomass that will be considered 'the same pixelGroup', e.g., if it is 100, then 5160 and 5240 will be the same

pixelGroupAgeClass

Integer. When assigning pixelGroup membership, this defines the resolution of ages that will be considered 'the same pixelGroup', e.g., if it is 10, then 6 and 14 will be the same.

minAgeForGrouping

Minimum age for regrouping. This may be because there is a source of ages for young stands/trees that is very reliable, such as a fire database. Ages below this will not be grouped together. Defaults to -1, meaning treat all ages equally. If this is related to known ages from a high quality database, then use age of the oldest trees in that database.

rmImputedPix

Should imputed pixels be removed

imputedPixID

a vector of IDs of pixels that suffered data imputation.

pixelFateDT

A data.table of pixelFateDT; if none provided, will make an empty one.

Value

A list with a modified pixelCohortData, cohortData, and pixelFateDT

data.tables.