Skip to content

Commit

Permalink
cohortDefinitionCols -- rm ad hoc addition; must be in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotmcintire committed Jan 22, 2024
1 parent 1225cfa commit 1bc62f3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Biomass_core.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ defineModule(sim, list(
"If NULL, then will skip all summaryBGM related events")),
defineParameter("calibrate", "logical", FALSE,
desc = "Do calibration? Defaults to `FALSE`"),
defineParameter("cohortDefinitionCols", "character", c("pixelGroup", "speciesCode", "age"), NA, NA,
defineParameter("cohortDefinitionCols", "character", c("pixelGroup", "speciesCode", "age", "ecoregionGroup", "B"), NA, NA,
desc = paste("`cohortData` columns that determine what constitutes a cohort",
"This parameter should only be modified if additional modules are adding columns to cohortData")),
defineParameter("cutpoint", "numeric", 1e10, NA, NA,
Expand Down Expand Up @@ -944,7 +944,11 @@ Init <- function(sim, verbose = getOption("LandR.verbose", TRUE)) {
sim$simulatedBiomassMap <- rasterizeReduced(pixelAll, pixelGroupMap, "uniqueSumB")
}

colsToKeep <- unique(c(P(sim)$cohortDefinitionCols, "ecoregionGroup", "B"))
# can't add ecoregionGroup and B here in an adhoc way Eliot: Jan 19, 2024 ... the other modules
# don't add them in adhoc ways, so they will not match ... the parameters must be the same in
# all modules that use cohortDefinitionCols
# colsToKeep <- unique(c(P(sim)$cohortDefinitionCols, "ecoregionGroup", "B"))
colsToKeep <- unique(c(P(sim)$cohortDefinitionCols))
sim$cohortData <- cohortData[, .SD, .SDcol = colsToKeep]
sim$cohortData[, c("mortality", "aNPPAct") := 0L]
# sim$cohortData <- cohortData[, .(pixelGroup, ecoregionGroup, speciesCode, age, B, mortality = 0L, aNPPAct = 0L)]
Expand Down

0 comments on commit 1bc62f3

Please sign in to comment.