The progress bar can be set in two ways in SpaDES. First, by setting values in the .progress list element in the params list element passed to simInit(). Second, at the spades() call itself, which can be simpler. See examples.

progressInterval(sim)

# S4 method for simList
progressInterval(sim)

progressInterval(sim) <- value

# S4 method for simList
progressInterval(sim) <- value

progressType(sim)

# S4 method for simList
progressType(sim)

progressType(sim) <- value

# S4 method for simList
progressType(sim) <- value

Arguments

sim

A simList object from which to extract element(s) or in which to replace element(s).

value

The parameter value to be set (in the corresponding module and param).

Value

for progressInterval, a numeric corresponding to the progress update interval; for progressInterval<-, an updated simList object.

Details

Progress Bar: Progress type can be one of "text", "graphical", or "shiny". Progress interval can be a numeric. These both can get set by passing a .progress = list(type = "graphical", interval = 1) into the simInit call. See examples.

See also

Other functions to access elements of a 'simList' object: .addDepends(), checkpointFile(), envir(), events(), globals(), inputs(), modules(), objs(), packages(), params(), paths(), times()

Examples

# \donttest{
if (requireNamespace("SpaDES.tools", quietly = TRUE) &&
requireNamespace("NLMR", quietly = TRUE)) {
opts <- options("spades.moduleCodeChecks" = FALSE) # not necessary for example
mySim <- simInit(
  times = list(start=0.0, end=100.0),
  params = list(.globals = list(stackName = "landscape"),
  .progress = list(type = "text", interval = 10),
  checkpoint = list(interval = 10, file = "chkpnt.RData")),
  modules = list("randomLandscapes"),
  paths = list(modulePath = getSampleModules(tempdir()))
)

# progress bar
progressType(mySim) # "text"
progressInterval(mySim) # 10

# parameters
params(mySim) # returns all parameters in all modules
              # including .global, .progress, checkpoint
globals(mySim) # returns only global parameters

# checkpoint
checkpointFile(mySim) # returns the name of the checkpoint file
                      # In this example, "chkpnt.RData"
checkpointInterval(mySim) # 10

options(opts) # reset
}# }
#> Setting:
#>   options(
#>     spades.modulePath = '/tmp/RtmpoLaiAE/sampleModules'
#>   )
#> Paths set to:
#>   options(
#>     rasterTmpDir = '/tmp/RtmpoLaiAE/SpaDES/scratch/raster'
#>     reproducible.cachePath = '/tmp/RtmpoLaiAE/myProject/cache'
#>     spades.inputPath = '/tmp/RtmpoLaiAE/myProject/inputs'
#>     spades.outputPath = '/tmp/RtmpoLaiAE/myProject/outputs'
#>     spades.modulePath = '/tmp/RtmpoLaiAE/sampleModules'
#>     spades.scratchPath = '/tmp/RtmpoLaiAE/SpaDES/scratch'
#>   )
#>   terra::terraOptions(tempdir = '/tmp/RtmpoLaiAE/SpaDES/scratch/terra'
#> Apr25 18:01:14 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Apr25 18:01:14 simInit The following .globals were used:
#> Apr25 18:01:14 simInit Key: <global, module>
#> Apr25 18:01:14 simInit              module    global
#> Apr25 18:01:14 simInit              <char>    <char>
#> Apr25 18:01:14 simInit 1: randomLandscapes stackName
#> Elpsed time for simInit: 0.04868937 secs