vignettes/v-finding-other-modules.Rmd
v-finding-other-modules.Rmd
if (!require("SpaDES.project")) {
{install.packages("SpaDES.project", repos = c("predictiveecology.r-universe.dev", getOption("repos")))
require("SpaDES.project")}
}
#> Loading required package: SpaDES.project
One powerful aspect of SpaDES
is the ability to connect
to other people’s modules. It can be challenging to know where other
modules are and what they do. Using the listModules
function.
The command sequence we will use is:
listModule
to identify which modules exist on cloud
storage systems,getModules
to bring them (or a subset) to your local
machine,moduleDependencies
to do the metadata analysis,moduleDependenciesToGraph
converts them to a
graph,moduleDependenciesToGraph
to visualize that graph.A user can use only some of these steps if they do not want to produce the visuals.
This will search the PredictiveEcology
github.com
repository for any SpaDES module whose name has
Biomass_species
, Biomass_core
,
Biomass_regen
in it. The search will find any module that
contains those keywords, i.e., Biomass_regen
will find
Biomass_regeneration
Account <- "PredictiveEcology"
grepListShort <- "Biomass_species|Biomass_core|Biomass_regen"
mods <- listModules(grepListShort, accounts = Account)
modPath <- normPath(tempdir2())
getModule(mods, modulePath = modPath)
#> $success
#> [1] "PredictiveEcology/Biomass_core"
#> [2] "PredictiveEcology/Biomass_regeneration"
#> [3] "PredictiveEcology/Biomass_regenerationPM"
#> [4] "PredictiveEcology/Biomass_speciesData"
#> [5] "PredictiveEcology/Biomass_speciesFactorial"
#> [6] "PredictiveEcology/Biomass_speciesParameters"
#>
#> $failed
#> character(0)
DT <- moduleDependencies(mods, modulePath = modPath)
graph <- moduleDependenciesToGraph(DT)
(vn <- PlotModuleGraph(graph))
Account <- "PredictiveEcology"
grepListShort <- "fireSense"
mods <- listModules(grepListShort, accounts = Account)
getModule(mods, modulePath = modPath)
#> $success
#> [1] "PredictiveEcology/fireSense"
#> [2] "PredictiveEcology/fireSense_dataPrepFit"
#> [3] "PredictiveEcology/fireSense_dataPrepPredict"
#> [4] "PredictiveEcology/fireSense_EscapeFit"
#> [5] "PredictiveEcology/fireSense_EscapePredict"
#> [6] "PredictiveEcology/fireSense_IgnitionFit"
#> [7] "PredictiveEcology/fireSense_IgnitionPredict"
#> [8] "PredictiveEcology/fireSense_SpreadFit"
#> [9] "PredictiveEcology/fireSense_SpreadPredict"
#> [10] "PredictiveEcology/fireSense_summary"
#>
#> $failed
#> character(0)
DT <- moduleDependencies(mods, modulePath = modPath)
graph <- moduleDependenciesToGraph(DT)
(vn <- PlotModuleGraph(graph))
Account <- "PredictiveEcology"
grepListShort <- "Biomass_|LandR"
mods <- listModules(grepListShort, accounts = Account)
getModule(mods, modulePath = modPath)
#> $success
#> [1] "PredictiveEcology/Biomass_borealDataPrep"
#> [2] "PredictiveEcology/Biomass_summary"
#> [3] "PredictiveEcology/Biomass_validationKNN"
#> [4] "PredictiveEcology/Biomass_yieldTables"
#> [5] "PredictiveEcology/LandRCBM_split3pools"
#> [6] "PredictiveEcology/Biomass_core"
#> [7] "PredictiveEcology/Biomass_regeneration"
#> [8] "PredictiveEcology/Biomass_regenerationPM"
#> [9] "PredictiveEcology/Biomass_speciesData"
#> [10] "PredictiveEcology/Biomass_speciesFactorial"
#> [11] "PredictiveEcology/Biomass_speciesParameters"
#>
#> $failed
#> character(0)
DT <- moduleDependencies(mods, modulePath = modPath)
graph <- moduleDependenciesToGraph(DT)
(vn <- PlotModuleGraph(graph))
# Can do same, but with long list -- not done here -- can try
accountsListLong <- c("PredictiveEcology", "ianmseddy", "achubaty",
"FOR-CAST", "eliotmcintire", "tati-micheletti", "CeresBarros")
grepListLong <- c("Biomass", "WBI", "LandR", "fireSense", "CBM",
"LandMine", "LandWeb", "NRV", #"scfm",
"priority", "fire",
"dataPrep", "DataPrep", "RoF", "Ontario", "ROF")
modsLong <- listModules(grepListLong, accounts = accountsListLong)
# pass to listModules for much larger figure
getModule(modsLong, modulePath = modPath)
#> $success
#> [1] "PredictiveEcology/Biomass_borealDataPrep"
#> [2] "PredictiveEcology/Biomass_core"
#> [3] "PredictiveEcology/Biomass_regeneration"
#> [4] "PredictiveEcology/Biomass_regenerationPM"
#> [5] "PredictiveEcology/Biomass_speciesData"
#> [6] "PredictiveEcology/Biomass_speciesFactorial"
#> [7] "PredictiveEcology/Biomass_speciesParameters"
#> [8] "PredictiveEcology/Biomass_summary"
#> [9] "PredictiveEcology/Biomass_validationKNN"
#> [10] "PredictiveEcology/Biomass_yieldTables"
#> [11] "PredictiveEcology/LandRCBM_split3pools"
#> [12] "PredictiveEcology/fireSense"
#> [13] "PredictiveEcology/fireSense_dataPrepFit"
#> [14] "PredictiveEcology/fireSense_dataPrepPredict"
#> [15] "PredictiveEcology/fireSense_EscapeFit"
#> [16] "PredictiveEcology/fireSense_EscapePredict"
#> [17] "PredictiveEcology/fireSense_IgnitionFit"
#> [18] "PredictiveEcology/fireSense_IgnitionPredict"
#> [19] "PredictiveEcology/fireSense_SpreadFit"
#> [20] "PredictiveEcology/fireSense_SpreadPredict"
#> [21] "PredictiveEcology/fireSense_summary"
#> [22] "PredictiveEcology/CBM_core"
#> [23] "PredictiveEcology/CBM_dataPrep_SK"
#> [24] "PredictiveEcology/CBM_defaults"
#> [25] "PredictiveEcology/CBM_vol2biomass"
#> [26] "PredictiveEcology/LandMine"
#> [27] "PredictiveEcology/LandWeb_summary"
#> [28] "PredictiveEcology/priorityPlaces"
#> [29] "ianmseddy/Quebec_fires_preamble"
#> [30] "ianmseddy/gmcsDataPrep"
#> [31] "achubaty/LandR_MPB_studyArea"
#> [32] "FOR-CAST/NRV_summary"
#> [33] "FOR-CAST/Ontario_preamble"
#> [34] "tati-micheletti/fitBirdBiomassModel"
#> [35] "tati-micheletti/anthroDisturbance_DataPrep"
#> [36] "tati-micheletti/potentialResourcesNT_DataPrep"
#>
#> $failed
#> character(0)
DT <- moduleDependencies(modsLong, modulePath = modPath)
graph <- moduleDependenciesToGraph(DT)
(vn <- PlotModuleGraph(graph))
This takes much longer to run as it scans all (open) repositories for
each element of accounts
. It will search for a relatively
“lightweight” indicator of a SpaDES module, namely, a file at the top
level that has the same name as the repository, but whose file extension
is .R
.
# Can do same, but with long list -- not done here -- can try
accountsListLong <- c("PredictiveEcology", "ianmseddy", "achubaty",
"FOR-CAST", "eliotmcintire", "tati-micheletti", "CeresBarros")
modsLong <- listModules(accounts = accountsListLong)
# pass to listModules for much larger figure
getModule(modsLong, modulePath = modPath)
#> $success
#> [1] "PredictiveEcology/BGC"
#> [2] "PredictiveEcology/burnSummaries"
#> [3] "PredictiveEcology/canClimateData"
#> [4] "PredictiveEcology/canFireRegimeZones"
#> [5] "achubaty/mpbClimateData"
#> [6] "achubaty/mpbPine"
#> [7] "achubaty/mpbRedTopSpread"
#> [8] "FOR-CAST/HSI_Caribou_MB"
#> [9] "tati-micheletti/anthroDisturbance_Generator"
#> [10] "tati-micheletti/birdsNWT"
#> [11] "tati-micheletti/caribouCIP"
#> [12] "tati-micheletti/caribouPopGrowthModel"
#> [13] "tati-micheletti/caribouRSF_NT"
#> [14] "tati-micheletti/disturbanceGenerator_NT"
#> [15] "CeresBarros/FavierFireSpread"
#> [16] "PredictiveEcology/Biomass_borealDataPrep"
#> [17] "PredictiveEcology/Biomass_core"
#> [18] "PredictiveEcology/Biomass_regeneration"
#> [19] "PredictiveEcology/Biomass_regenerationPM"
#> [20] "PredictiveEcology/Biomass_speciesData"
#> [21] "PredictiveEcology/Biomass_speciesFactorial"
#> [22] "PredictiveEcology/Biomass_speciesParameters"
#> [23] "PredictiveEcology/Biomass_summary"
#> [24] "PredictiveEcology/Biomass_validationKNN"
#> [25] "PredictiveEcology/Biomass_yieldTables"
#> [26] "PredictiveEcology/CBM_core"
#> [27] "PredictiveEcology/CBM_dataPrep_SK"
#> [28] "PredictiveEcology/CBM_defaults"
#> [29] "PredictiveEcology/CBM_vol2biomass"
#> [30] "PredictiveEcology/fireSense"
#> [31] "PredictiveEcology/fireSense_dataPrepFit"
#> [32] "PredictiveEcology/fireSense_dataPrepPredict"
#> [33] "PredictiveEcology/fireSense_EscapeFit"
#> [34] "PredictiveEcology/fireSense_EscapePredict"
#> [35] "PredictiveEcology/fireSense_IgnitionFit"
#> [36] "PredictiveEcology/fireSense_IgnitionPredict"
#> [37] "PredictiveEcology/fireSense_SpreadFit"
#> [38] "PredictiveEcology/fireSense_SpreadPredict"
#> [39] "PredictiveEcology/fireSense_summary"
#> [40] "PredictiveEcology/LandMine"
#> [41] "PredictiveEcology/LandRCBM_split3pools"
#> [42] "PredictiveEcology/LandWeb_summary"
#> [43] "PredictiveEcology/priorityPlaces"
#> [44] "ianmseddy/gmcsDataPrep"
#> [45] "ianmseddy/Quebec_fires_preamble"
#> [46] "achubaty/LandR_MPB_studyArea"
#> [47] "FOR-CAST/NRV_summary"
#> [48] "FOR-CAST/Ontario_preamble"
#> [49] "tati-micheletti/anthroDisturbance_DataPrep"
#> [50] "tati-micheletti/fitBirdBiomassModel"
#> [51] "tati-micheletti/potentialResourcesNT_DataPrep"
#>
#> $failed
#> [1] "ianmseddy/gmcsPredict"
DT <- moduleDependencies(modsLong, modulePath = modPath)
#> Error in h(simpleError(msg, call)) :
#> error in evaluating the argument 'x' in selecting a method for function 'defineModule': argument "max" is missing, with no default
#> Error in h(simpleError(msg, call)) :
#> error in evaluating the argument 'x' in selecting a method for function 'defineModule': argument "max" is missing, with no default
#> Error in .local(module = module, path = path, defineModuleListItems = defineModuleListItems) :
#> C:/Users/emcintir/AppData/Local/Temp/RtmpMZzbJB/reproducible/KXkLY6kJ/gmcsPredict/gmcsPredict.R does not exist. This was created by putting modulePath with the module name as a folder and filename. Please correct the modulePath or module name in the simInit() call.
#> Error in .local(module = module, path = path, defineModuleListItems = defineModuleListItems) :
#> C:/Users/emcintir/AppData/Local/Temp/RtmpMZzbJB/reproducible/KXkLY6kJ/gmcsPredict/gmcsPredict.R does not exist. This was created by putting modulePath with the module name as a folder and filename. Please correct the modulePath or module name in the simInit() call.
graph <- moduleDependenciesToGraph(DT)
(vn <- PlotModuleGraph(graph))