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. 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 (DEFINE) 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. 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 |
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 theSpaDES
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
species_tr
object is created to match a species name to the user-provided growth curve. - 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 for the
spinup
event in the CBM_core modules are assembled in the spinupSQL object. -
pooldef
gives the names of each carbon pool that exists in CBM. - Objects that narrow the parameter selection to the study area are
spuLocator
andecolocator
1.5 Outputs
Name | Class | Description |
---|---|---|
species_tr | Data table | Default species data |
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 |
ecoLocator | Shapefile | Canada’s ecozone as polygon features with ecozone IDs |
spuLocator | Shapefile | Canada’s spatial units as polygon features with spatial unit IDs |
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.
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)
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"),
)
outDefaults <- SpaDES.core::simInitAndSpades2(out)