Example

Here we provide an example script to run a small area of managed forests British Columbia between 2000 and 2010. This example is relatively lightweight and most computers should be able to run the simulation. However, this does require a significant amount of storage space and will download several large files. Due to this as well as initial caching, the first time you run this script it will likely take a few hours, but re-running the script should only be minutes long.

If you have access to the computing power, larger areas and different scenarios can be found in scripts here. Note that some of these require >100Gbs of RAM to run.

Setup

A few things need to be set up the first time running spadesCBM. While the global script below will take care and guide you through most of these, here are some things to note during the initial set up.

Google account

To run the provided example, users need to access some of the data using the googledrive R package (part of the tidyverse family of R packages). During the simInit() (or simInitAndSpades) call, a function to initialize (or initialize and run) SpaDES-based simulations, R will prompt you to either choose a previously authenticated account (if you have previously used googledrive) or to open a browser window and authenticate.

Make sure you give tidyverse read/write access to your files:

Python

The CBM_core module, which is the simulation module of spadesCBM, requires Python >=3.9 and <=3.12.7.

If a suitable version of Python does not already exist on your computer, The reticulate package will be used to install it using the pyenv or pyenv-win.

If you are using a Windows computer with Git installed, the pyenv-win tool will be acquired and managed directly by reticulate. If you are using a Windows computer without Git installed, you will be prompted to allow the pyenv-win tool to be downloaded directly from Github to your local user application data directory (tools::R_user_dir("CBMutils")).

If the Python installation process fails or you would prefer to manually install Python, it can be downloaded directly from python.org/downloads. The calls to Python are for functions from a package called libcbm. Python functions are only used in the CBM_core module. Details on CBM_core module and the Python functions are provided in CBM_core chapter in this manual.

Running the simulation