2 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.

2.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 parametersfor 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 the capacity for 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, and more. The outputs of this module are used by CBM_dataPrep_SK and CBM_core in spadesCBM simulations.

2.2 List of input objects

Name Class Description Source
Archive Index SQL Database SQLite database file for CFS_CBM3 default tables https://github.com/cat-cfs/libcbm_py/tree/main/libcbm/resources/cbm_defaults_db
Disturbance Matrix Association Data table Default disturbance IDs https://raw.githubusercontent.com/cat-cfs/libcbm_py/main/libcbm/resources/cbm_exn/disturbance_matrix_association.csv
Disturbance Matrix Value Data table Default disturbance data https://raw.githubusercontent.com/cat-cfs/libcbm_py/main/libcbm/resources/cbm_exn/disturbance_matrix_value.csv
ecoLocator Shapefile Canada’s ecozone as polygon features http://sis.agr.gc.ca/cansis/nsdb/ecostrat/zone/ecozone_shp.zip
spuLocator Shapefile Canada’s spatial units as polygon features https://drive.google.com/file/d/1D3O0Uj-s_QEgMW7_X-NhVsEZdJ29FBed

2.3 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 the reproducible::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 species_tr object is created to match a species name to the provided growth curve.
  • The disturbanceMatrix and cTransfers 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 for the study area are spuLocator and ecolocator

2.4 List of output objects

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

2.5 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.

2.6 Usage

This module can run independently by running the global script below. Run independently, it provides transparent access tp default parameters for all managed forests of Canada for CBM 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)