Skip to content

Commit

Permalink
speciesTable: longer dispersal for white spruce
Browse files Browse the repository at this point in the history
  • Loading branch information
achubaty committed Nov 14, 2018
1 parent e58e8da commit 0fad6e6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Boreal_LBMRDataPrep.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,20 +326,24 @@ estimateParameters <- function(sim) {
## filter table to existing species layers
speciesTable <- speciesTable[species %in% names(sim$specieslayers)]

## adjust some species-specific values
speciesTable[species == "Pice_gla", seeddistance_max := 2000] ## (see LandWeb#96)

message("10: ", Sys.time())

# Take the smallest values of every column, within species, because it is northern boreal forest
speciesTable <- speciesTable[species %in% names(sim$specieslayers), ][
, ':='(species1 = NULL, species2 = NULL)] %>%
.[, lapply(.SD, function(x) if (is.numeric(x)) min(x, na.rm = TRUE) else x[1]), by = "species"]
sim$species <- speciesTable

initialCommunities <- simulationMaps$initialCommunity[, .(mapcode, description = NA, species)]
set(initialCommunities, NULL, paste("age", 1:15, sep = ""), NA)
initialCommunities <- data.frame(initialCommunities)
message("11: ", Sys.time())

## filter communities to species that have traits
initialCommunities <- initialCommunities[initialCommunities$species %in% speciesTable$species,]
initialCommunities <- initialCommunities[initialCommunities$species %in% sim$species$species,]

initialCommunitiesFn <- function(initialCommunities, speciesTable) {
for (i in 1:nrow(initialCommunities)) {
Expand All @@ -352,10 +356,9 @@ estimateParameters <- function(sim) {
}
message("12: ", Sys.time())

sim$initialCommunities <- Cache(initialCommunitiesFn, initialCommunities, speciesTable,
sim$initialCommunities <- Cache(initialCommunitiesFn, initialCommunities, sim$species,
userTags = "stable")

sim$species <- speciesTable
sim$minRelativeB <- data.frame(ecoregion = sim$ecoregion[active == "yes",]$ecoregion,
X1 = 0.2, X2 = 0.4, X3 = 0.5,
X4 = 0.7, X5 = 0.9)
Expand Down

0 comments on commit 0fad6e6

Please sign in to comment.