Here, we implement a simulation in a more modular fashion so it's easier to add submodules to the simulation. We use S4 classes and methods, and use data.table instead of data.frame to implement the event queue (because it is much faster).

spades(
  sim,
  debug = getOption("spades.debug"),
  progress = NA,
  cache,
  .plotInitialTime = NULL,
  .saveInitialTime = NULL,
  notOlderThan = NULL,
  events = NULL,
  .plots = getOption("spades.plots", NULL),
  ...
)

# S4 method for simList,ANY,ANY,missing
spades(
  sim,
  debug = getOption("spades.debug"),
  progress = NA,
  cache,
  .plotInitialTime = NULL,
  .saveInitialTime = NULL,
  notOlderThan = NULL,
  events = NULL,
  .plots = getOption("spades.plots", NULL),
  ...
)

# S4 method for ANY,ANY,ANY,logical
spades(
  sim,
  debug = getOption("spades.debug"),
  progress = NA,
  cache,
  .plotInitialTime = NULL,
  .saveInitialTime = NULL,
  notOlderThan = NULL,
  events = NULL,
  .plots = getOption("spades.plots", NULL),
  ...
)

Arguments

sim

A simList simulation object, generally produced by simInit.

debug

Optional tools for invoking debugging. Supplying a list will invoke the more powerful logging package. See details. Default is to use the value in getOption("spades.debug").

progress

Logical (TRUE or FALSE show a graphical progress bar), character ("graphical", "text") or numeric indicating the number of update intervals to show in a graphical progress bar.

cache

Logical. If TRUE, then the spades call will be cached. This means that if the call is made again with the same simList, then spades will return the return value from the previous run of that exact same simList. Default FALSE. See Details. See also the vignette on caching for examples.

.plotInitialTime

Numeric. Temporarily override the .plotInitialTime parameter for all modules. See Details.

.saveInitialTime

Numeric. Temporarily override the .plotInitialTime parameter for all modules. See Details.

notOlderThan

Date or time. Passed to reproducible::Cache to update the cache. Default is NULL, meaning don't update the cache. If Sys.time() is provided, then it will force a recache, i.e., remove old value and replace with new value. Ignored if cache is FALSE.

events

A character vector or a named list of character vectors. If specified, the simulations will only do the events indicated here. If a named list, the names must correspond to the modules and the character vectors can be specific events within each of the named modules. With the list form, all unspecified modules will run all their events, including internal spades modules, e.g., save, that get invoked with the outputs argument in simInit. See example.

.plots

Character. Sets the parameter of this name in all modules. See Plots() for possible values. The parameter is intended to slowly take over from .plotInitialTime as a mechanism to turn on or off plotting. For backwards compatibility, if .plotInitialTime is not set in this spades call, but this .plots is used, two things will happen: setting this without "screen" will turn off all plotting; setting this with "screen" will trigger plotting for any modules that use this parameter but will have no effect on other modules. To get plotting, therefore, it may be necessary to also set .plotInitialTime = start(sim).

...

Any. Can be used to make a unique cache identity, such as "replicate = 1". This will be included in the Cache call, so will be unique and thus spades will not use a cached copy as long as anything passed in ... is unique, i.e., not cached previously.

Value

Invisibly returns the modified simList object.

Details

The is the workhorse function in the SpaDES package. It runs simulations by implementing the rules outlined in the simList.

This function gives simple access to two sets of module parameters: .plotInitialTime and with .plotInitialTime. The primary use of these arguments is to temporarily turn off plotting and saving. "Temporary" means that the simList is not changed, so it can be used again with the simList values reinstated. To turn off plotting and saving, use .plotInitialTime = NA or .saveInitialTime = NA. NOTE: if a module did not use .plotInitialTime or .saveInitialTime, then these arguments will not do anything.

Note

The debug option is primarily intended to facilitate building simulation models by the user. Will print additional outputs informing the user of updates to the values of various simList slot components. See https://github.com/PredictiveEcology/SpaDES/wiki/Debugging for details.

Caching with SpaDES

There are numerous ways in which Caching can be used within SpaDES. Please see the vignette https://spades-core.predictiveecology.org/articles/iii-cache.html for many examples. Briefly, functions, events, modules, entire spades calls or experiment calls (see https://github.com/PredictiveEcology/SpaDES.experiment) can be cached and mixtures of all of these will work. For functions, simply wrap the call with Cache, moving the original function name into the first argument of Cache. For events or modules, set the module parameters, .useCache, e.g., simInit(..., parameters = list(myModule = list(.useCache = "init"))). This can be set to an event name, which will cache that event, or a logical, which will cache every event in that module. Event and module caching makes most sense when the event or module only runs once, such as an initialization or data preparation event/module. Caching an entire simulation is actually just a function call to simInitAndSpades, for example. So, simply writing Cache(simInitAndSpades, modules = ...) will effectively cache a whole simulation. Finally for experiments, it is just like a function call: Cache(simInitandExperiment, ...). The final way Caching can be done is in experiment or spades, by setting the cache argument.

If cache is TRUE, this allows for a seamless way to "save" results of a simulation. The user does not have to intentionally do any saving manually. Instead, upon a call to spades in which the simList is identical, the function will simply return the result that would have come if it had been rerun. Use this with caution, as it will return exactly the result from a previous run, even if there is stochasticity internally. Caching is only based on the input simList. See also the vignette on caching for examples.

debug

The most powerful way to use debug is to invoke the logging R package. To invoke this, debug must be a list with up to 3 named elements: console, file, and debug. Each of these list elements must be a list (including empty list() for defaults) with the sub-list elements here:

consolelevelThe level, see below, of information shown
fileappendLogical. If TRUE, the default, then log entries are appended to file, if it exists
fileA filename. Defaults to log.txt
levelThe level, see below, of information shown
debugSee possible values below

level can be a number from 0 to 100 or a character string matching one of the values in logging::loglevels. These are hierarchical levels of information passed to the console. Set a lower number for more information and a higher number for less information. Errors in code will be shown if level is set to "ERROR" or 40 or above; warnings in code will be shown if level is set to "WARN" or 30 or above; normal messages in code will be shown if level is set to "INFO" or 20 or above. For consistency with base R messaging, if default level is used, then normal messaging via message will be shown; this means that suppressMessages will work to suppress messaging only when level is set to "INFO" or 20. Some functions in the SpaDES ecosystem may have information at the lower levels, but currently, there are few to none.

debug is specified as a non-list argument to spades or as list(debug = ...), then it can be a logical, a quoted call, a character vector or a numeric scalar (currently 1 or 2) or a list of any of these to get multiple outputs. This will be run at the start of every event. The following options for debug are available. Each of these can also be in a list to get multiple outputs:

TRUEcurrent(sim) will be printed at the start of each event as it runs
a function name (as character string)If a function, then it will be run on the simList, e.g., "time" will run time(sim) at each event.
moduleName (as character string)All calls to that module will be entered interactively
eventName (as character string)All calls that have that event name (in any module) will be entered interactively
c(<moduleName>, <eventName>)Only the event in that specified module will be entered into.
Any other R expression expressed as a character string or quoted callWill be evaluated with access to the simList as sim. If this is more than one character string, then all will be printed to the screen in their sequence.
A numeric scalar, currently 1 or 2 (maybe others)This will print out alternative forms of event information that users may find useful

If not specified in the function call, the package option spades.debug is used.

If options("spades.browserOnError" = TRUE) (experimental still) if there is an error, it will attempt to open a browser in the event where the error occurred. You can edit, and then press c to continue or Q to quit, plus all other normal interactive browser tools. c will trigger a reparse and events will continue as scheduled, starting with the one just edited. There may be some unexpected consequences if the simList objects had already been changed before the error occurred.

References

Matloff, N. (2011). The Art of R Programming (ch. 7.8.3). San Francisco, CA: No Starch Press, Inc.. Retrieved from https://nostarch.com/artofr.htm

See also

SpaDES.core-package(), simInit(), and the caching vignette (very important for reproducibility): https://spades-core.predictiveecology.org/articles/iii-cache.html which uses reproducible::Cache().

Author

Alex Chubaty and Eliot McIntire

Examples

# \donttest{
if (requireNamespace("SpaDES.tools", quietly = TRUE) &&
    requireNamespace("NLMR", quietly = TRUE)) {
  # some options are not necessary when not interactive
  opts <- options("spades.moduleCodeChecks" = FALSE, "spades.useRequire" = FALSE)
  if (!interactive()) opts <- append(opts, options("spades.plots" = NA,
                                                   "spades.debug" = FALSE))
  mySim <- simInit(
   times = list(start = 0.0, end = 1.0, timeunit = "year"),
   params = list(
     randomLandscapes = list(nx = 10, ny = 10),
     .globals = list(stackName = "landscape", burnStats = "nPixelsBurned",
                     .plots = NA) # plotting off --> not relevant for example
   ),
   modules = list("randomLandscapes", "fireSpread", "caribouMovement"),
   paths = list(modulePath = getSampleModules(tempdir()))
  )
  spades(mySim)

  # Different debug options (overrides the package option 'spades.debug')
  spades(mySim, debug = TRUE) # Fastest
  spades(mySim, debug = "print(table(sim$landscape$Fires[]))")
  # To get a combination -- use list(debug = list(..., ...))
  spades(mySim, debug = list(debug = list(1, quote(as.data.frame(table(sim$landscape$Fires[]))))))

  # Can turn off plotting at spades call, and inspect the output simList instead
  out <- spades(mySim, .plots = NA)
  completed(out) # shows completed events

  # use cache -- simInit should generally be rerun each time a spades call is made
  #   to guarantee that it is identical. Here, run spades call twice, first
  #   time to establish cache, second time to return cached result
  for (i in 1:2) {
   mySim <- simInit(
     times = list(start = 0.0, end = 1.0, timeunit = "year"),
     params = list(
       randomLandscapes = list(nx = 10, ny = 10),
       .globals = list(stackName = "landscape", burnStats = "nPixelsBurned")
     ),
     modules = list("randomLandscapes", "fireSpread", "caribouMovement"),
     paths = list(modulePath = getSampleModules(tempdir()))
   )
   print(system.time(out <- spades(mySim, cache = TRUE, .plots = NA)))
  }

  # E.g., with only the init events
  outInitsOnly <- spades(mySim, events = "init")

  # or more fine grained control
  outSomeEvents <- spades(mySim, .plots = NA,
          events = list(randomLandscapes = c("init"),
                        fireSpread = c("init", "burn")))

  # with outputs, the save module gets invoked and must be explicitly limited to "init"
  mySim <- simInit(
   times = list(start = 0.0, end = 1.0, timeunit = "year"),
   params = list(
     randomLandscapes = list(nx = 10, ny = 10),
     .globals = list(stackName = "landscape", burnStats = "nPixelsBurned")
   ),
   modules = list("randomLandscapes", "fireSpread", "caribouMovement"),
   outputs = data.frame(objectName = "landscape", saveTime = 0:2),
   paths = list(modulePath = getSampleModules(tempdir()))
  )
  # This will print a message saying that caribouMovement will run its events
  outSomeEvents <- spades(mySim, .plots = NA,
          events = list(randomLandscapes = c("init"),
                        fireSpread = c("init", "burn"),
                        save = "init"))

  options(opts) # reset options
}
#> Setting:
#>   options(
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>   )
#> Paths set to:
#>   options(
#>     rasterTmpDir = '/tmp/RtmpNobduY/scratch/raster'
#>     reproducible.cachePath = '/tmp/RtmpNobduY/cache'
#>     spades.inputPath = '/tmp/RtmpNobduY/inputs'
#>     spades.outputPath = '/tmp/RtmpNobduY'
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>     spades.scratchPath = '/tmp/RtmpNobduY/scratch'
#>   )
#>   terra::terraOptions(tempdir = '/tmp/RtmpNobduY/scratch/terra'
#> Apr16 20:31:06 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr16 20:31:06 simInit The following .globals were used:
#> Apr16 20:31:06 simInit Key: <global, module>
#> Apr16 20:31:06 simInit              module    global
#> Apr16 20:31:06 simInit              <char>    <char>
#> Apr16 20:31:06 simInit 1:  caribouMovement    .plots
#> Apr16 20:31:06 simInit 2:       fireSpread    .plots
#> Apr16 20:31:06 simInit 3: randomLandscapes    .plots
#> Apr16 20:31:06 simInit 4:  caribouMovement stackName
#> Apr16 20:31:06 simInit 5:       fireSpread stackName
#> Apr16 20:31:06 simInit 6: randomLandscapes stackName
#> Elpsed time for simInit: 0.09817958 secs
#> Apr16 20:31:06 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Apr16 20:31:06 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr16 20:31:06 chckpn:init eventTime moduleName eventType eventPriority
#> Apr16 20:31:06 chckpn:init 0         checkpoint init      0            
#> Apr16 20:31:06 save  :init 0         save       init      0            
#> Apr16 20:31:06 prgrss:init 0         progress   init      0            
#> Apr16 20:31:06 load  :init 0         load       init      0            
#> Apr16 20:31:06 rndmLn:init 0         randomLandscapes init      1            
#> Apr16 20:31:06 frSprd:init 0         fireSpread       init      1            
#> Apr16 20:31:06 crbMvm:init 0         caribouMovement  init      1            
#> Apr16 20:31:06 frSprd:burn 1         fireSpread       burn      5            
#> Apr16 20:31:06 crbMvm:move 1         caribouMovement  move      5            
#> Apr16 20:31:06 frSprd:stats 1         fireSpread       stats     5            
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Apr16 20:31:06 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr16 20:31:06 chckpn:init total elpsd: 0.51 secs | 0 checkpoint init 0
#> 
#>  0  1  2  3  4  5  6  7  8  9 10 
#> 48  5  1  5  1  3 10 10  5  1 11 
#> Apr16 20:31:06 chckpn:init 48
#> Apr16 20:31:06 chckpn:init 5
#> Apr16 20:31:06 chckpn:init 1
#> Apr16 20:31:06 chckpn:init 5
#> Apr16 20:31:06 chckpn:init 1
#> Apr16 20:31:06 chckpn:init 3
#> Apr16 20:31:06 chckpn:init 10
#> Apr16 20:31:06 chckpn:init 10
#> Apr16 20:31:06 chckpn:init 5
#> Apr16 20:31:06 chckpn:init 1
#> Apr16 20:31:06 chckpn:init 11
#> Apr16 20:31:06 save  :init total elpsd: 0.52 secs | 0 save init 0
#> 
#>  0  1  2  3  4  5  6  7  8  9 10 
#> 48  5  1  5  1  3 10 10  5  1 11 
#> Apr16 20:31:06 save  :init 48
#> Apr16 20:31:06 save  :init 5
#> Apr16 20:31:06 save  :init 1
#> Apr16 20:31:06 save  :init 5
#> Apr16 20:31:06 save  :init 1
#> Apr16 20:31:06 save  :init 3
#> Apr16 20:31:06 save  :init 10
#> Apr16 20:31:06 save  :init 10
#> Apr16 20:31:06 save  :init 5
#> Apr16 20:31:06 save  :init 1
#> Apr16 20:31:06 save  :init 11
#> Apr16 20:31:06 prgrss:init total elpsd: 0.53 secs | 0 progress init 0
#> 
#>  0  1  2  3  4  5  6  7  8  9 10 
#> 48  5  1  5  1  3 10 10  5  1 11 
#> Apr16 20:31:06 prgrss:init 48
#> Apr16 20:31:06 prgrss:init 5
#> Apr16 20:31:06 prgrss:init 1
#> Apr16 20:31:06 prgrss:init 5
#> Apr16 20:31:06 prgrss:init 1
#> Apr16 20:31:06 prgrss:init 3
#> Apr16 20:31:06 prgrss:init 10
#> Apr16 20:31:06 prgrss:init 10
#> Apr16 20:31:06 prgrss:init 5
#> Apr16 20:31:06 prgrss:init 1
#> Apr16 20:31:06 prgrss:init 11
#> Apr16 20:31:06 load  :init total elpsd: 0.54 secs | 0 load init 0
#> 
#>  0  1  2  3  4  5  6  7  8  9 10 
#> 48  5  1  5  1  3 10 10  5  1 11 
#> Apr16 20:31:06 load  :init 48
#> Apr16 20:31:06 load  :init 5
#> Apr16 20:31:06 load  :init 1
#> Apr16 20:31:06 load  :init 5
#> Apr16 20:31:06 load  :init 1
#> Apr16 20:31:06 load  :init 3
#> Apr16 20:31:06 load  :init 10
#> Apr16 20:31:06 load  :init 10
#> Apr16 20:31:06 load  :init 5
#> Apr16 20:31:06 load  :init 1
#> Apr16 20:31:06 load  :init 11
#> Apr16 20:31:06 rndmLn:init total elpsd: 0.55 secs | 0 randomLandscapes init 1
#> 
#>  0  1  2  3  4  5  6  7  8  9 10 
#> 48  5  1  5  1  3 10 10  5  1 11 
#> Apr16 20:31:06 rndmLn:init 48
#> Apr16 20:31:06 rndmLn:init 5
#> Apr16 20:31:06 rndmLn:init 1
#> Apr16 20:31:06 rndmLn:init 5
#> Apr16 20:31:06 rndmLn:init 1
#> Apr16 20:31:06 rndmLn:init 3
#> Apr16 20:31:06 rndmLn:init 10
#> Apr16 20:31:06 rndmLn:init 10
#> Apr16 20:31:06 rndmLn:init 5
#> Apr16 20:31:06 rndmLn:init 1
#> Apr16 20:31:06 rndmLn:init 11
#> Apr16 20:31:07 frSprd:init total elpsd: 0.66 secs | 0 fireSpread init 1
#> Error : [subset] invalid name(s)
#> Apr16 20:31:07 frSprd:init Error : [subset] invalid name(s)
#> Apr16 20:31:07 frSprd:init 
#> Apr16 20:31:07 crbMvm:init total elpsd: 0.68 secs | 0 caribouMovement init 1
#> 
#>   0 
#> 100 
#> Apr16 20:31:07 crbMvm:init 100
#> Apr16 20:31:07 frSprd:burn total elpsd: 0.69 secs | 1 fireSpread burn 5
#> 
#>   0 
#> 100 
#> Apr16 20:31:07 frSprd:burn 100
#> Apr16 20:31:07 crbMvm:move total elpsd: 0.71 secs | 1 caribouMovement move 5
#> 
#>  0  1  2  3  4  5  6  7  8  9 10 
#> 22  6 16 28 12  2  7  1  1  3  2 
#> Apr16 20:31:07 crbMvm:move 22
#> Apr16 20:31:07 crbMvm:move 6
#> Apr16 20:31:07 crbMvm:move 16
#> Apr16 20:31:07 crbMvm:move 28
#> Apr16 20:31:07 crbMvm:move 12
#> Apr16 20:31:07 crbMvm:move 2
#> Apr16 20:31:07 crbMvm:move 7
#> Apr16 20:31:07 crbMvm:move 1
#> Apr16 20:31:07 crbMvm:move 1
#> Apr16 20:31:07 crbMvm:move 3
#> Apr16 20:31:07 crbMvm:move 2
#> Apr16 20:31:07 frSprd:stats total elpsd: 0.74 secs | 1 fireSpread stats 5
#> 
#>  0  1  2  3  4  5  6  7  8  9 10 
#> 22  6 16 28 12  2  7  1  1  3  2 
#> Apr16 20:31:07 frSprd:stats 22
#> Apr16 20:31:07 frSprd:stats 6
#> Apr16 20:31:07 frSprd:stats 16
#> Apr16 20:31:07 frSprd:stats 28
#> Apr16 20:31:07 frSprd:stats 12
#> Apr16 20:31:07 frSprd:stats 2
#> Apr16 20:31:07 frSprd:stats 7
#> Apr16 20:31:07 frSprd:stats 1
#> Apr16 20:31:07 frSprd:stats 1
#> Apr16 20:31:07 frSprd:stats 3
#> Apr16 20:31:07 frSprd:stats 2
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Apr16 20:31:07 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr16 20:31:07 chckpn:init total elpsd: 0.78 secs | 0 checkpoint init 0
#> Apr16 20:31:07 chckpn:init     <fctr> <int>
#> Apr16 20:31:07 chckpn:init  1:      0    22
#> Apr16 20:31:07 chckpn:init  2:      1     6
#> Apr16 20:31:07 chckpn:init  3:      2    16
#> Apr16 20:31:07 chckpn:init  4:      3    28
#> Apr16 20:31:07 chckpn:init  5:      4    12
#> Apr16 20:31:07 chckpn:init  6:      5     2
#> Apr16 20:31:07 chckpn:init  7:      6     7
#> Apr16 20:31:07 chckpn:init  8:      7     1
#> Apr16 20:31:07 chckpn:init  9:      8     1
#> Apr16 20:31:07 chckpn:init 10:      9     3
#> Apr16 20:31:07 chckpn:init 11:     10     2
#> Apr16 20:31:07 save  :init total elpsd: 0.8 secs | 0 save init 0
#> Apr16 20:31:07 save  :init     <fctr> <int>
#> Apr16 20:31:07 save  :init  1:      0    22
#> Apr16 20:31:07 save  :init  2:      1     6
#> Apr16 20:31:07 save  :init  3:      2    16
#> Apr16 20:31:07 save  :init  4:      3    28
#> Apr16 20:31:07 save  :init  5:      4    12
#> Apr16 20:31:07 save  :init  6:      5     2
#> Apr16 20:31:07 save  :init  7:      6     7
#> Apr16 20:31:07 save  :init  8:      7     1
#> Apr16 20:31:07 save  :init  9:      8     1
#> Apr16 20:31:07 save  :init 10:      9     3
#> Apr16 20:31:07 save  :init 11:     10     2
#> Apr16 20:31:07 prgrss:init total elpsd: 0.82 secs | 0 progress init 0
#> Apr16 20:31:07 prgrss:init     <fctr> <int>
#> Apr16 20:31:07 prgrss:init  1:      0    22
#> Apr16 20:31:07 prgrss:init  2:      1     6
#> Apr16 20:31:07 prgrss:init  3:      2    16
#> Apr16 20:31:07 prgrss:init  4:      3    28
#> Apr16 20:31:07 prgrss:init  5:      4    12
#> Apr16 20:31:07 prgrss:init  6:      5     2
#> Apr16 20:31:07 prgrss:init  7:      6     7
#> Apr16 20:31:07 prgrss:init  8:      7     1
#> Apr16 20:31:07 prgrss:init  9:      8     1
#> Apr16 20:31:07 prgrss:init 10:      9     3
#> Apr16 20:31:07 prgrss:init 11:     10     2
#> Apr16 20:31:07 load  :init total elpsd: 0.83 secs | 0 load init 0
#> Apr16 20:31:07 load  :init     <fctr> <int>
#> Apr16 20:31:07 load  :init  1:      0    22
#> Apr16 20:31:07 load  :init  2:      1     6
#> Apr16 20:31:07 load  :init  3:      2    16
#> Apr16 20:31:07 load  :init  4:      3    28
#> Apr16 20:31:07 load  :init  5:      4    12
#> Apr16 20:31:07 load  :init  6:      5     2
#> Apr16 20:31:07 load  :init  7:      6     7
#> Apr16 20:31:07 load  :init  8:      7     1
#> Apr16 20:31:07 load  :init  9:      8     1
#> Apr16 20:31:07 load  :init 10:      9     3
#> Apr16 20:31:07 load  :init 11:     10     2
#> Apr16 20:31:07 rndmLn:init total elpsd: 0.84 secs | 0 randomLandscapes init 1
#> Apr16 20:31:07 rndmLn:init     <fctr> <int>
#> Apr16 20:31:07 rndmLn:init  1:      0    22
#> Apr16 20:31:07 rndmLn:init  2:      1     6
#> Apr16 20:31:07 rndmLn:init  3:      2    16
#> Apr16 20:31:07 rndmLn:init  4:      3    28
#> Apr16 20:31:07 rndmLn:init  5:      4    12
#> Apr16 20:31:07 rndmLn:init  6:      5     2
#> Apr16 20:31:07 rndmLn:init  7:      6     7
#> Apr16 20:31:07 rndmLn:init  8:      7     1
#> Apr16 20:31:07 rndmLn:init  9:      8     1
#> Apr16 20:31:07 rndmLn:init 10:      9     3
#> Apr16 20:31:07 rndmLn:init 11:     10     2
#> Apr16 20:31:07 frSprd:init total elpsd: 0.96 secs | 0 fireSpread init 1
#> Error : [subset] invalid name(s)
#> Apr16 20:31:07 frSprd:init Error : [subset] invalid name(s)
#> Apr16 20:31:07 frSprd:init 
#> Apr16 20:31:07 crbMvm:init total elpsd: 0.97 secs | 0 caribouMovement init 1
#> Apr16 20:31:07 crbMvm:init    <fctr> <int>
#> Apr16 20:31:07 crbMvm:init 1:      0   100
#> Apr16 20:31:07 frSprd:burn total elpsd: 0.99 secs | 1 fireSpread burn 5
#> Apr16 20:31:07 frSprd:burn    <fctr> <int>
#> Apr16 20:31:07 frSprd:burn 1:      0   100
#> Apr16 20:31:07 crbMvm:move total elpsd: 1 secs | 1 caribouMovement move 5
#> Apr16 20:31:07 crbMvm:move     <fctr> <int>
#> Apr16 20:31:07 crbMvm:move  1:      0    32
#> Apr16 20:31:07 crbMvm:move  2:      1     3
#> Apr16 20:31:07 crbMvm:move  3:      2     8
#> Apr16 20:31:07 crbMvm:move  4:      3     1
#> Apr16 20:31:07 crbMvm:move  5:      4    11
#> Apr16 20:31:07 crbMvm:move  6:      5     4
#> Apr16 20:31:07 crbMvm:move  7:      6     7
#> Apr16 20:31:07 crbMvm:move  8:      7    23
#> Apr16 20:31:07 crbMvm:move  9:      8     2
#> Apr16 20:31:07 crbMvm:move 10:      9     8
#> Apr16 20:31:07 crbMvm:move 11:     10     1
#> Apr16 20:31:07 frSprd:stats total elpsd: 1.1 secs | 1 fireSpread stats 5
#> Apr16 20:31:07 frSprd:stats     <fctr> <int>
#> Apr16 20:31:07 frSprd:stats  1:      0    32
#> Apr16 20:31:07 frSprd:stats  2:      1     3
#> Apr16 20:31:07 frSprd:stats  3:      2     8
#> Apr16 20:31:07 frSprd:stats  4:      3     1
#> Apr16 20:31:07 frSprd:stats  5:      4    11
#> Apr16 20:31:07 frSprd:stats  6:      5     4
#> Apr16 20:31:07 frSprd:stats  7:      6     7
#> Apr16 20:31:07 frSprd:stats  8:      7    23
#> Apr16 20:31:07 frSprd:stats  9:      8     2
#> Apr16 20:31:07 frSprd:stats 10:      9     8
#> Apr16 20:31:07 frSprd:stats 11:     10     1
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Apr16 20:31:07 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Setting:
#>   options(
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>   )
#> Paths set to:
#>   options(
#>     rasterTmpDir = '/tmp/RtmpNobduY/scratch/raster'
#>     reproducible.cachePath = '/tmp/RtmpNobduY/cache'
#>     spades.inputPath = '/tmp/RtmpNobduY/inputs'
#>     spades.outputPath = '/tmp/RtmpNobduY'
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>     spades.scratchPath = '/tmp/RtmpNobduY/scratch'
#>   )
#>   terra::terraOptions(tempdir = '/tmp/RtmpNobduY/scratch/terra'
#> Apr16 20:31:07 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr16 20:31:07 simInit The following .globals were used:
#> Apr16 20:31:07 simInit Key: <global, module>
#> Apr16 20:31:07 simInit              module    global
#> Apr16 20:31:07 simInit              <char>    <char>
#> Apr16 20:31:07 simInit 1:  caribouMovement stackName
#> Apr16 20:31:07 simInit 2:       fireSpread stackName
#> Apr16 20:31:07 simInit 3: randomLandscapes stackName
#> Elpsed time for simInit: 0.09721804 secs
#> Apr16 20:31:08 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Saving large object (fn: spades, cacheId: 2231c262e8865ef6) to Cache: 83.5 Mb
#>  Done!
#>    user  system elapsed 
#>   2.511   0.069   2.617 
#> Setting:
#>   options(
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>   )
#> Paths set to:
#>   options(
#>     rasterTmpDir = '/tmp/RtmpNobduY/scratch/raster'
#>     reproducible.cachePath = '/tmp/RtmpNobduY/cache'
#>     spades.inputPath = '/tmp/RtmpNobduY/inputs'
#>     spades.outputPath = '/tmp/RtmpNobduY'
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>     spades.scratchPath = '/tmp/RtmpNobduY/scratch'
#>   )
#>   terra::terraOptions(tempdir = '/tmp/RtmpNobduY/scratch/terra'
#> Apr16 20:31:10 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr16 20:31:10 simInit The following .globals were used:
#> Apr16 20:31:10 simInit Key: <global, module>
#> Apr16 20:31:10 simInit              module    global
#> Apr16 20:31:10 simInit              <char>    <char>
#> Apr16 20:31:10 simInit 1:  caribouMovement stackName
#> Apr16 20:31:10 simInit 2:       fireSpread stackName
#> Apr16 20:31:10 simInit 3: randomLandscapes stackName
#> Elpsed time for simInit: 0.09729433 secs
#>   ...(Object to retrieve (fn: spades, 2231c262e8865ef6.rds))
#>      loaded cached result from previous spades call
#>    user  system elapsed 
#>   0.433   0.000   0.435 
#> Apr16 20:31:11 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Apr16 20:31:11 simInit NOTE: caribouMovement not specified in events argument. 
#> Apr16 20:31:11 simInit This means all events in the module(s) will run. You may have intended to add e.g.,
#> Apr16 20:31:11 simInit  list(caribouMovement= 'init')
#> Apr16 20:31:11 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
#> Setting:
#>   options(
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>   )
#> Paths set to:
#>   options(
#>     rasterTmpDir = '/tmp/RtmpNobduY/scratch/raster'
#>     reproducible.cachePath = '/tmp/RtmpNobduY/cache'
#>     spades.inputPath = '/tmp/RtmpNobduY/inputs'
#>     spades.outputPath = '/tmp/RtmpNobduY'
#>     spades.modulePath = '/tmp/RtmpNobduY/sampleModules'
#>     spades.scratchPath = '/tmp/RtmpNobduY/scratch'
#>   )
#>   terra::terraOptions(tempdir = '/tmp/RtmpNobduY/scratch/terra'
#> Apr16 20:31:12 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr16 20:31:12 simInit The following .globals were used:
#> Apr16 20:31:12 simInit Key: <global, module>
#> Apr16 20:31:12 simInit              module    global
#> Apr16 20:31:12 simInit              <char>    <char>
#> Apr16 20:31:12 simInit 1:  caribouMovement stackName
#> Apr16 20:31:12 simInit 2:       fireSpread stackName
#> Apr16 20:31:12 simInit 3: randomLandscapes stackName
#> Elpsed time for simInit: 0.1289411 secs
#> Apr16 20:31:12 simInit NOTE: caribouMovement not specified in events argument. 
#> Apr16 20:31:12 simInit This means all events in the module(s) will run. You may have intended to add e.g.,
#> Apr16 20:31:12 simInit  list(caribouMovement= 'init')
#> Apr16 20:31:12 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> simList saved in
#> SpaDES.core:::.pkgEnv$.sim
#> It will be deleted at next spades() call.
# }