Parse and extract module metadata
moduleMetadata(
sim,
module,
path = getOption("spades.modulePath", NULL),
defineModuleListItems = c("name", "description", "keywords", "childModules", "authors",
"version", "spatialExtent", "timeframe", "timeunit", "citation", "documentation",
"reqdPkgs", "parameters", "inputObjects", "outputObjects")
)
# S4 method for missing,character,character
moduleMetadata(module, path, defineModuleListItems)
# S4 method for missing,character,missing
moduleMetadata(module, defineModuleListItems)
# S4 method for ANY,ANY,ANY
moduleMetadata(
sim,
module,
path = getOption("spades.modulePath", NULL),
defineModuleListItems = c("name", "description", "keywords", "childModules", "authors",
"version", "spatialExtent", "timeframe", "timeunit", "citation", "documentation",
"reqdPkgs", "parameters", "inputObjects", "outputObjects")
)
A simList
simulation object, generally produced by simInit
.
Character string. Your module's name.
Character string specifying the file path to modules directory.
Default is to use the spades.modulePath
option.
A vector of metadata entries to return values about.
A list of module metadata, matching the structure in
defineModule()
.
path <- system.file("sampleModules", package = "SpaDES.core")
sampleModules <- dir(path)
## turn off code checking -- don't need it here
opts <- options("spades.moduleCodeChecks" = FALSE,
"spades.useRequire" = FALSE)
x <- moduleMetadata(sampleModules[3], path = path)
#> Assuming sim is a module name
## using simList
if (require("SpaDES.tools", quietly = TRUE)) {
mySim <- simInit(
times = list(start = 2000.0, end = 2001.0, timeunit = "year"),
params = list(
.globals = list(stackName = "landscape")
),
modules = list("caribouMovement"),
paths = list(modulePath = system.file("sampleModules", package = "SpaDES.core"))
)
moduleMetadata(sim = mySim)
}
#> Setting:
#> options(
#> spades.modulePath = '/home/runner/work/_temp/Library/SpaDES.core/sampleModules'
#> )
#> Paths set to:
#> options(
#> rasterTmpDir = '/tmp/RtmppEYNhs/SpaDES/scratch/raster'
#> reproducible.cachePath = '/tmp/RtmppEYNhs/reproducible/cache'
#> spades.inputPath = '/tmp/RtmppEYNhs/SpaDES/inputs'
#> spades.outputPath = '/tmp/RtmppEYNhs/SpaDES/outputs'
#> spades.modulePath = '/home/runner/work/_temp/Library/SpaDES.core/sampleModules'
#> spades.scratchPath = '/tmp/RtmppEYNhs/SpaDES/scratch'
#> )
#> terra::terraOptions(tempdir = '/tmp/RtmppEYNhs/SpaDES/scratch/terra'
#> Loading required package: grid
#>
#> Attaching package: ‘grid’
#> The following object is masked from ‘package:quickPlot’:
#>
#> gpar
#> Loading required package: raster
#> Loading required package: sp
#> Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> The following .globals were used:
#> module global
#> 1: caribouMovement stackName
#> $name
#> [1] "caribouMovement"
#>
#> $description
#> [1] "Simulate caribou movement via correlated random walk."
#>
#> $keywords
#> [1] "caribou" "individual based movement model"
#> [3] "correlated random walk"
#>
#> $childModules
#> character(0)
#>
#> $authors
#> [1] "Eliot J B McIntire <eliot.mcintire@canada.ca> [aut, cre]"
#>
#> $version
#> [1] ‘1.6.0’
#>
#> $spatialExtent
#> class : Extent
#> xmin : NA
#> xmax : NA
#> ymin : NA
#> ymax : NA
#>
#> $timeframe
#> [1] NA NA
#>
#> $timeunit
#> [1] "month"
#>
#> $citation
#> list()
#>
#> $documentation
#> list()
#>
#> $reqdPkgs
#> $reqdPkgs[[1]]
#> [1] "grid"
#>
#> $reqdPkgs[[2]]
#> [1] "raster"
#>
#> $reqdPkgs[[3]]
#> [1] "sp"
#>
#> $reqdPkgs[[4]]
#> [1] "stats"
#>
#> $reqdPkgs[[5]]
#> [1] "SpaDES.tools"
#>
#>
#> $parameters
#> paramName paramClass default min max
#> 1 stackName character landscape NA NA
#> 2 moveInitialTime numeric 2001 2001 2001
#> 3 moveInterval numeric 1 1 1
#> 4 N numeric 100 10 1000
#> 5 torus logical FALSE FALSE TRUE
#> 6 .plotInitialTime numeric 2000 -Inf Inf
#> 7 .plotInterval numeric 1 -Inf Inf
#> 8 .saveInitialTime numeric NA -Inf Inf
#> 9 .saveInterval numeric NA -Inf Inf
#> 10 .seed list NA NA
#> paramDesc
#> 1 name of the RasterStack
#> 2 time to schedule first movement event
#> 3 time interval between movoment events
#> 4 initial number of caribou
#> 5 should the map wrap around like a torus?
#> 6 time to schedule first plot event
#> 7 time interval between plot events
#> 8 time to schedule first save event
#> 9 time interval between save events
#> 10 Named list of seeds to use for each event (names). E.g., `list('init' = 123)` will `set.seed(123)` for the `init` event only.
#>
#> $inputObjects
#> objectName objectClass desc sourceURL
#> 1 landscape RasterStack layername = "habitatQuality" <NA>
#> 2 caribou SpatialPointsDataFrame Object holding caribou locations <NA>
#>
#> $outputObjects
#> objectName objectClass desc
#> 1 caribou SpatialPointsDataFrame NA
#>
# turn code checking back on -- don't need it here
options(opts)