1 CBM_defaults
This documentation is work in progress. Potential discrepancies and omissions may exist for the time being. If you find any regarding this module, contact us here.
1.1 Overview
CBM_defaults reads in default parameters for the managed forest of Canada. In SpaDES-speak, it has one event (init
). On its own, this module provides R-based access to all defaults CBM parameters for the managed forests of Canada (run Usage section below to run this module independently). As part of spadesCBM, it provides simulations with default parameter values for the managed forests of Canada, akin to the Archive Index in the CBM-CFS3 documentation. Most parameters are read in from an SQLite database (link below), with some defaults, modified from CBM-CFS3 to accommodate a more flexible representation of vegetation dynamics enable by the libcbm
Python functions used, available here. Defaults for the managed forests of Canada include disturbance data such as different disturbance types and their IDs, spinup parameters, pool names, fire return intervals for each ecozone and more. The outputs of this module are used by CBM_dataPrep_SK and CBM_core in spadesCBM simulations.
1.2 Background
This example uses default parameters that were created for use in CBM-CFS3 as described in Kurz et al. (2009). Few of these parameters have source references. The ones who do are outline in the Operational-scale Carbon Budget Model of the Canadian Forest Sector (CBM-CFS3) version 1.2: user’s guide. CBM_defaults brings the parameters to an R-environment, for easy user-access and modifications.
1.3 Inputs
Name | Class | Description | Source |
---|---|---|---|
Archive Index | SQL Database | SQLite database file for CFS_CBM3 default tables | GitHub |
Disturbance Matrix Association | Data table | Default disturbance IDs | GitHub |
Disturbance Matrix Value | Data table | Default disturbance data | GitHub |
species.csv | Data table | Default species information | GitHub |
ecoLocator | Shapefile | Canada’s ecozone as polygon features | Canadian Soil information Service |
spuLocator | Shapefile | Canada’s spatial units as polygon features | Google Drive |
1.4 Module functioning
- The SQLite database, and a selection of the
cbm_exn
resource files are downloaded and stored into the user’s Inputs folder from GitHub using thereproducible::prepInputs
function, a useful tool in the SpaDES toolkit. - Parameters necessary for spadesCBM simulations are extracted from the downloaded files. Each of these are saved as objects in the simList (see list of output objects above).
- The
disturbanceMatrix
andcTransfers
objects help identify which carbon transfers matches the provided disturbances as it matches the transfer matrix IDs and the proportions transferred to disturbance names. - Parameters necessary for the
spinup
event in the CBM_core modules are assembled in thespinupSQL
object. -
pooldef
gives the names of each carbon pool that exists in CBM. -
species.csv
is read in as theCBMspecies
object. -
cbmAdmin
identifies all ecozones and spatial unit IDs combinations possible for each province and territory.
1.5 Outputs
Name | Class | Description |
---|---|---|
disturbanceMatrix | Data table | Default disturbance data |
cTransfers | Data table | Default disturbance data |
spinupSQL | Data table | Parameters for CBM_core spinup event |
pooldef | Character | Vector of pools |
CBMspecies | Data table | Default species data |
cbmAdmin | Data table | Ecozone and spatial unit information for provincial boundaries |
1.6 Usage
This module can run independently by running the global script below. Run independently, it provides transparent access to default parameters for all managed forests of Canada for spadesCBM simulations.
# project path and package install
projectPath <- "~/CBM_defaults"
repos <- c("predictiveecology.r-universe.dev", getOption("repos"))
if ((packageVersion("SpaDES.project") < "0.1.1" || packageVersion("Require") < "1.0.1.9002") |>
tryCatch(error = function(x) TRUE))
install.packages(c("SpaDES.project", "Require"), repos = repos)
# setup
out <- SpaDES.project::setupProject(
paths = list(projectPath = projectPath),
options = options(
repos = c(repos = repos),
reproducible.destinationPath = "inputs"
),
modules = c("PredictiveEcology/CBM_defaults@main"),
require = c("SpaDES.core"),
)
# run
outDefaults <- SpaDES.core::simInitAndSpades2(out)