if (FALSE) {
# Specify file path and name of new SsimLibrary
myLibraryName <- file.path(tempdir(), "testlib")
# Set the SyncroSim Session, SsimLibrary, Project, and Scenario
mySession <- session()
myLibrary <- ssimLibrary(name = myLibraryName,
session = mySession,
packages = "helloworldSpatial")
myProject <- project(myLibrary, project = "Definitions")
myScenario <- scenario(myProject, scenario = "My Scenario")
# Get all Datasheet info
myDatasheets <- datasheet(myScenario)
# Get a specific Datasheet
myDatasheet <- datasheet(myScenario, name = "helloworldSpatial_RunControl")
# Modify Datasheet
myDatasheet$MaximumTimestep <- 10
# Save Datasheet
saveDatasheet(ssimObject = myScenario,
data = myDatasheet,
name = "helloworldSpatial_RunControl")
# Import data after saving
saveDatasheet(ssimObject = myScenario,
data = myDatasheet,
name = "helloworldSpatial_RunControl",
import = TRUE)
# Save the new Datasheet to a specified output path
saveDatasheet(ssimObject = myScenario,
data = myDatasheet,
name = "helloworldSpatial_RunControl",
path = tempdir())
# Save a raster stack using fileData
# Create a raster stack - add as many raster files as you want here
map1 <- datasheetSpatRaster(myScenario,
datasheet = "helloworldSpatial_InputDatasheet",
column = "InterceptRasterFile")
inRasters <- terra::rast(map1)
# Change the name of the rasters in the input Datasheets to match the stack
inSheet <- datasheet(myScenario, name = "helloworldSpatial_InputDatasheet")
inSheet[1,"InterceptRasterFile"] <- names(inRasters)[1]
# Save the raster stack to the input Datasheet
saveDatasheet(myScenario, data = inSheet,
name = "helloworldSpatial_InputDatasheet",
fileData = inRasters)
}
Run the code above in your browser using DataLab