Let’s set up a 16 module model with 5 main groups: 1. Vegetation succession
# Load libraries library(SpaDES.core) #library(magrittr) #library(raster) main.dir <- "~/integratedExample" ## We'll create the necessary directories in a temporary location - feel free to change this if you wish to. setPaths(cachePath = file.path(main.dir,'cache'), inputPath = file.path(main.dir, 'inputs'), modulePath = file.path(main.dir, 'modules'), outputPath = file.path(main.dir, 'outputs')) downloadModule(name = "integratedSask", path = getPaths()$modulePath, repo = "PredictiveEcology/scfmModules", overwrite = TRUE) times <- list(start = 0, end = 15)
Steve Cumming, a fire specialist has a nice set of forest succession and a fire simulation models for a region in Saskatchewan. We will run his set of modules:
parameters <- list( stateVars = list(persistTimes = c(20, 10, 10)), ageModule = list(initialAge = 25, .plotInitialTime = 0), scfmSpread = list(.plotInitialTime = 0, pOverRide = 0.28) ) objects <- list(scfmPars = list(pSpread = 0.225, p0 = 0.115, naiveP0 = 0.15, pIgnition = 0.04, #0.00004, #0.0000112, maxBurnCells = NA ), numTypes = 8, landscapeAttr = list(cellSize = 6.25), nNbrs = 8, url.vegMap = paste0("ftp://ftp.ccrs.nrcan.gc.ca/ad/NLCCLandCover/", "LandcoverCanada2005_250m/LandCoverOfCanada2005_V1_4.zip"), url.studyArea = "http://sis.agr.gc.ca/cansis/nsdb/ecostrat/district/ecodistrict_shp.zip", areaInHa = pi, polyMatrix = matrix(c(-113.552320, 55.442529), ncol = 2), areaSize = 50000 ) # List the modules to use modulesFire <- list("scfmCrop", "scfmLandcoverInit", # Downloading and cropping rasters "scfmRegime", "scfmDisturbanceDriver", "scfmIgnition", "scfmEscape", "scfmSpread", # Fire module "ageModule", # Tree aging "mapBurns") # What burns (considers age) mySim <- simInit(times = times, params = parameters, modules = modulesFire, objects = objects, paths = getPaths(), loadOrder = unlist(modulesFire)) # SIMULATION mySimOut <- Cache(spades, mySim, debug = TRUE)
John, who has a forestry company wants to understand the forest dynamics to plan how he will harvest in the same region.
parameters <- list( stateVars = list(persistTimes = c(20, 10, 10)), ageModule = list(initialAge = 25, .plotInitialTime = 0), scfmSpread = list(.plotInitialTime = 0, pOverRide = 0.28) ) # List the modules to use modulesHarvest <- list("scfmCrop", "scfmLandcoverInit", "loadYieldTables", "Hanzlik", "strataMapFromVegMap", "scfmHarvest", "stateVars") mySim2 <- simInit(times = times, params = parameters, modules = modulesHarvest, objects = objects, paths = getPaths(), loadOrder = unlist(modulesHarvest)) # SIMULATION mySimOut2 <- Cache(spades, mySim2)
Tati, in the mean time, has been working with the boreal birds and developed a bird model to predict how probable it is to find two bird species based on forest cover in the same region. Eliot, on the other hand, has been working with the Caribou group and developed a model for its population that focuses mainly in the availability of high quality habitat also in this region in Saskatchewan.
SpaDES, we can relatively easily write all these models as SpaDES modules and integrate all in one analysis.