`SpaDES` sample modules

This is an example of a 'module group' (parent module) containing several child modules:

Module groups make loading multiple modules easier: only the name of the module group needs to be specified in the simInit call, which will then initialize the simulation with the child modules.

library(SpaDES.core)

outputDir <- file.path(tempdir(), "simOutputs")
times <- list(start = 0.0, end = 20.0)
parameters <- list(
  .globals = list(stackName = "landscape", burnStats = "nPixelsBurned"),
  .progress = list(NA),
  caribouMovement = list(N = 100L, moveInterval = 1, torus = TRUE,
                         .plotInitialTime = 1.01, .plotInterval = 1),
  fireSpread = list(nFires = 10L, spreadprob = 0.225, its = 1e6,
                    persistprob = 0, returnInterval = 10, startTime = 0,
                    .plotInitialTime = 0.1, .plotInterval = 10),
  randomLandscapes = list(nx = 100L, ny = 100L, inRAM = TRUE)
)
modules <- list("SpaDES_sampleModules")
objects <- list()
paths <- list(modulePath = getSampleModules(tempdir()),
              outputPath = outputDir)

mySim <- simInit(times = times, params = parameters, modules = modules,
                 objects = objects, paths = paths)

modules(mySim) # note the child modules are initialized

times(mySim) # See timeunits for each module and overall model timeunit

## Run model
dev() # to open a new plot device for faster plotting
spades(mySim)


Try the SpaDES.core package in your browser

Any scripts or data that you put into this service are public.

SpaDES.core documentation built on Nov. 10, 2023, 5:08 p.m.