2 Running LandWeb
- Launch Rstudio and open the LandWeb Rstudio project (
LandWeb.Rproj
); - Open the file
00-global.R
and run each line in sequence, responding to any prompts as required.
Before you can run the model, you first need to install the packages required for the project by restoring from the project’s snapshot file.
2.1 Model setup and configuration
The default settings for study area, model version, and scenario are defined in 01a-globalvars.R
.
These defaults are defined as ‘dot-variables’ (e.g., .studyAreaName
) and can be set externally to the main script
(e.g., if .studyAreaName
is defined before running 01a-globalvars.R
, then the user-set value will be used, rather than the default defined in that script).
Advanced setup and model run customization is described in Advanced setup.
2.1.1 Select a study area
The model can be run over the entire study area, for certain individual provinces (currently only AB, SK, MB, NWT), or groups of predefined FMAs (see Fig. 1 and Table 1).
2.1.1.1 FMA boundaries
Currently, only a subset of the FMAs within the LandWeb study area are predefined to be run on their own (i.e., without needing to run the model over the entire study area; see Table 2).
2.1.1.2 Choosing a study area
The model can be run on any of several pre-defined study areas summarized in the table below.
To select one of these predefined study areas, set .studyAreaName
to use one of the following, corresponding to the polygon IDs in the map above.
To run LandWeb over an entire province use one of provAB
, provMB
, provNWT
, or provSK
.
To run the entire LandWeb study area, use LandWeb
.
2.1.2 Select a scenario
In version 2.0.0 of the LandWeb model, seed dispersal distances needed to be adjusted to ensure sufficient regeneration following fire. These adjustments cause the model to behave more like a state-transition model, rather than a process-based one.
Version 3.0.0 relaxes these parameter forcings to behave like the standard LANDIS-II model.
The dispersal scenario is principally set via .version
but can be overridden is set via .dispersalType
:
Dispersal Scenario | Description |
---|---|
default (v3) |
default LANDIS-II dispersal |
aspen |
limit seed dispersal to deciduous only |
high (v2) |
high seed dispersal of all species (used for v2.0.0 runs) |
none |
no seed dispersal (all species) |
Additionally, v2.0.0 of the model uses adjusted fire return intervals (FRI) and log-adjusted rates of spread (ROS). Version 3.0.0 uses the LandMine defaults.
The fire scenario is principally set via .version
but can be overridden by specifying .ROStype
:
Fire Scenario | Description |
---|---|
default (v3) |
default rate of spread values |
burny |
Increases the flammability of non-forest types to facilitate fire spread in landscapes with discontinuous fuels. |
equal |
Set all rates of fire spread equal to each other (no vegetation differences) |
log (v2) |
Reduce the rates of spread but keep the magnitude of vegetation differences |
To define a scenario to run, select one dispersal scenario and one fire scenario from the tables above.
All LandWeb v2.0.0 runs from 2019 were run using .dispersalType = "high"
and .ROStype = "log"
.
Using v3.0.0 of the model, .dispersalType = "default"
and .ROStype = "default"
.
2.1.3 Replication
To run multiple replicates of a given run, set .rep
to an integer corresponding to the replicate id.
All replicate runs use a different random seed, and this seed is saved as on output for reuse in the event that a replicate needs to be rerun.
To rerun a replicate using a different seed, be sure to delete that run’s seed.rds
file.
The seed used is also saved in human-readable seed.txt
file.
2.2 Running the model
NOTE: The first time the model is run, it will automatically download additional data and install additional R packages, which can take some time to complete.
2.2.1 Interactive R session
When working in an R session, be sure to set the working directory to the LandWeb project directory.
The first time running the model, open the file 00-global.R
, and step through each line to ensure any prompts etc. are answered correctly.
source("00-global.R")
When authenticating with Google Drive, be sure to check the box to allow access to files.
2.2.2 Commandline interface
In addition to running the model in an interactive R session, we provide a command line interface to run replicates of the model for the study areas defined above (i.e., batch mode).
For example, to run replicate number 7 of the model at \(250 m\) resolution using FRI multiple of \(1\) for Alberta FMU L11, use:
cd ~/GitHub/LandWeb
## ./run_fmu.sh <FMU> <FRI> <RES> <REP>
./run_fmu.sh L11 1 250 7
FMU command line runs do not use modified dispersal nor fire scenarios, and thus only require the study area, replicate, and FRI multiple to be defined.
To run replicate number 7 of the model for the entire province of Alberta, use:
cd ~/GitHub/LandWeb
## ./run_fma.sh <FMU> <REP>
./run_fma.sh provAB 7
# ./run_fma_win.sh provAB 7 ## if on Windows!
FMA command line runs use highDispersal_logROS
scenarios at \(250 m\) resolution, and thus only require the study area and replicate to be defined.
To run the entire LandWeb study area, only a replicate number needs to be passed. For example:
## ./run_landweb.sh <REP>
./run_landweb.sh 7
LandWeb command line run set the dispersal and fire scenarios as above, and the pixel resolution (.pixelSize
) at \(250 m\), and thus only require the study area and replicate to be defined.
2.3 Post-processing analyses
After having run several reps of the model on a given study area, results are combined in subsequent post-processing analyses to generate the following outputs for each set of reporting polygons within the study area:
- boxplots of leading vegetation cover;
- histograms of leading vegetation cover;
- histograms of large patches.
To run processing, use .mode = "postprocess"
and be sure to set the number of replicates run in the config.
2.4 Advanced setup
2.4.2 Cache backend
Simulation caching is provided by the reproducible
and SpaDES.core
packages, and is enabled by default.
The default cache uses a SQLite database backend and stores cache files in cache/
.
However, other database backends can also be used, and advanced users running multiple parallel simulations may wish to set up and use a PostgreSQL database for this cache.
See https://github.com/PredictiveEcology/SpaDES/wiki/Using-alternate-database-backends-for-Cache and ensure the following options are added to your user-specific config in 02a-user-config.R
:
= "qs",
reproducible.cacheSaveFormat = SpaDES.config::dbConnCache("postgresql"), reproducible.conn
2.4.3 Speeding up disk-based operations
Caching and other disk-based file operations benefit from using an solid state drive (SSD) instead of a conventional spinning hard drive.
Advanced users can move their cache/
directory to an SSD mountpoint and create a symlink to this location in the project directory.
Likewise, users can configure a scratch path for temporary raster file operations to point to an SSD location.