# NOT RUN {
# This will save the "caribou" object at the save interval of 1 unit of time
# in the outputPath location
outputPath <- file.path(tempdir(), "test_save")
times <- list(start = 0, end = 6, "month")
parameters <- list(
.globals = list(stackName = "landscape"),
caribouMovement = list(
.saveObjects = "caribou",
.saveInitialTime = 1, .saveInterval = 1
),
randomLandscapes = list(.plotInitialTime = NA, nx = 20, ny = 20))
modules <- list("randomLandscapes", "caribouMovement")
paths <- list(
modulePath = system.file("sampleModules", package = "SpaDES"),
outputPath = savePath
)
mySim <- simInit(times = times, params = parameters, modules = modules,
paths = paths)
# The caribou module has a saveFiles(sim) call, so it will save caribou
spades(mySim)
dir(outputPath)
# remove the files
file.remove(dir(savePath, full.names = T))
# }
Run the code above in your browser using DataLab