Code Monkey home page Code Monkey logo

Comments (3)

CeresBarros avatar CeresBarros commented on August 11, 2024

Here's a reprex:

Require::Require("CeresBarros/SpaDES.core@test (HEAD)", 
                dependencies = FALSE, update = FALSE, force = TRUE)

#' # 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 = c("caribou", "habitatQuality"),
    .saveInitialTime = 1, .saveInterval = 1
  ),
  randomLandscapes = list(.plotInitialTime = NA, nx = 20, ny = 20))

modules <- list("randomLandscapes", "caribouMovement")
paths <- list(
  modulePath = system.file("sampleModules", package = "SpaDES.core"),
  outputPath = outputPath
)
opts <- options("spades.moduleCodeChecks" = FALSE,
                "spades.useRequire" = FALSE) # not necessary for example
mySim <- simInitAndSpades(times = times, params = parameters, modules = modules,
                          paths = paths)

## try with list()
parameters <- list(
  .globals = list(stackName = "landscape"),
  caribouMovement = list(
    .saveObjects = list("caribou", "habitatQuality"),
    .saveInitialTime = 1, .saveInterval = 1
  ),
  randomLandscapes = list(.plotInitialTime = NA, nx = 20, ny = 20))

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

## works with one object only
parameters <- list(
  .globals = list(stackName = "landscape"),
  caribouMovement = list(
    .saveObjects = "habitatQuality",
    .saveInitialTime = 1, .saveInterval = 1
  ),
  randomLandscapes = list(.plotInitialTime = NA, nx = 20, ny = 20))

mySim <- simInitAndSpades(times = times, params = parameters, modules = modules,
                          paths = paths)
list.files(paths$outputPath)

from spades.core.

CeresBarros avatar CeresBarros commented on August 11, 2024

@mbelkebrea, try installing CeresBarros/SpaDES.core@issue241_saveFilesBug and see if that helps while we wait for others to review the PR

from spades.core.

eliotmcintire avatar eliotmcintire commented on August 11, 2024

Pulled in the PR

from spades.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.