🌲 GOBLIN_CBM_runner, a CBM CFS3 interface for the GOBLIN model
Based on the GOBLIN (General Overview for a Backcasting approach of Livestock INtensification) LifeCycle Analysis tool, the cbm_runner package generates the data requried for the CBM CFS3 (libcbm_py) tool. It also interfaces with the tool directly, generating results in a single dataframe for all scenarios.
The outputs are related to biomass, and dead organic matter. These are summed into a total ecosystem value.
The estimated volumns are all in t of C.
Installation
Install from git hub.
pip install "goblin_cbm_runner@git+https://github.com/GOBLIN-Proj/goblin_cbm_runner.git@main"
Install from PyPI
pip install goblin_cbm_runner
v0.6.0 note: From v0.6.0 the package targets GOBLIN_lite only — GeoGoblin / geo-runner support was removed (fork the
0.5.0line if you need it). The oldRunner/DataManagerentry point has been replaced by the scenario generators below. Output is archive-only: callexport_archive()to write a self-describing SQLite.db; no CSVs are written automatically.
Usage
There are four entry points. All accept a scenario DataFrame and produce an annual carbon-flux DataFrame plus a SQLite archive.
National pipeline — NationalScenarioGenerator
The standard national simulation (Forest Management + Afforestation + Scenarios) using the bundled Irish database, to 2070.
from goblin_cbm_runner.scenario_generator import NationalScenarioGenerator
nsg = NationalScenarioGenerator(
scenario_data=scenario_df, # pandas DataFrame of scenarios
afforestation_data=afforest_df, # pandas DataFrame of afforestation areas
config={"afforest_delay": 5, "annual_rate_pre_delay": 1200},
comprehensive=False, # True to also capture pools/flux/state validation tables
)
results = nsg.run_flux_simulation() # annual flux DataFrame (all scenarios + baseline)
nsg.export_archive("./simulation_archive.db")
Dynamic pipeline — DynamicScenarioGenerator
Extends FM and AF beyond 2070 with NAI-based (Net Annual Increment) harvest, and extends the scenario end year to match.
from goblin_cbm_runner.dynamic_scenario_generator import DynamicScenarioGenerator
dsg = DynamicScenarioGenerator(
scenario_data=scenario_df,
afforestation_data=afforest_df,
config={"afforest_delay": 5, "annual_rate_pre_delay": 1200},
dynamic_config={"harvest_ratio": 0.75, "dynamic_years": 50}, # optional; 0.75 recommended
)
# Use ONE of the two entry points (alternatives, not sequential steps):
results = dsg.run_flux_simulation() # extended FM + AF + SC (already includes the -1 baseline)
# baseline = dsg.run_baseline_flux_simulation() # extended FM + AF only — use INSTEAD for baseline-only
dsg.export_archive("./dynamic_archive.db")
Standard pipeline (user CSVs) — StandardSimGenerator
Run a simulation from your own inventory CSV files with an explicit disturbance schedule — no internal database of stands required (the bundled AIDB is still used for CBM parameters).
from goblin_cbm_runner.standard_sim_generator import StandardSimGenerator
# Copy and edit the template CSVs first:
StandardSimGenerator.get_template("./my_forest/")
gen = StandardSimGenerator(
csv_directory="./my_forest/",
config={"baseline_year": 2020, "end_year": 2050},
scenario=0,
)
results = gen.run_flux_simulation()
gen.export_archive("./standard_archive.db")
Dynamic standard pipeline (user CSVs + NAI) — DynamicStandardSimGenerator
Your own inventory CSVs with NAI-based dynamic harvest. Omit end_year for "NAI from day 1",
or set it for a static warm-up period before the dynamic phase.
from goblin_cbm_runner.dynamic_standard_sim_generator import DynamicStandardSimGenerator
gen = DynamicStandardSimGenerator(
csv_directory="./my_forest/",
config={"baseline_year": 2020}, # omit end_year → years=0
dynamic_config={"harvest_ratio": 0.75, "dynamic_years": 30},
)
results = gen.run_flux_simulation()
gen.export_archive("./dynamic_standard_archive.db")
Runnable versions of all four live in tests/examples/
(nsg_example.py, dsg_example.py, standard_sim_example.py, dynamic_standard_sim_example.py).
CBM Disturbance Sort Types Note
libcbm_py is not a direct conversion of the CBM-CFS3 model, and there are some small differences.
One key difference is the available sort types for stand disturbances. Some sorting options in CBM-CFS3 are not available in libcbm_py, while others may function slightly differently.
In particular, the "Sort by time since softwood component was last harvested" (4) and "Sort by time since hardwood component was last harvested" (13) are missing from libcbm_py. These sorts help prioritize stands based on past harvests, which can be important for disturbance modeling.
Below, we provide the full set of sort types from CBM-CFS3, followed by the available sorts in libcbm_py, along with suggested approximations for missing sorts.
Sort Types from CBM-CFS3
The following table lists all disturbance sort types available in CBM-CFS3:
| Sort Type | Description |
|---|---|
| 1 | No sorting; a proportion of each record to disturb is calculated. Only applicable to disturbance events with proportion (P) targets. |
| 2 | Sort by merchantable biomass carbon (highest first). Only applicable to disturbance events with merchantable carbon (M) targets. |
| 3 | Sort by oldest softwood first. |
| 4 | Sort by time since the softwood component was last harvested. |
| 5 | Sort by SVO (State Variable Object) ID. Used for spatially explicit projects and instructs the model to disturb 100% of a single eligible record. |
| 6 | Sort randomly. Only applicable to fire and insect disturbance events. |
| 7 | Sort by total stem snag carbon (highest first). |
| 8 | Sort by softwood stem snag carbon (highest first). |
| 9 | Sort by hardwood stem snag carbon (highest first). |
| 10 | Sort by softwood merchantable carbon (highest first). |
| 11 | Sort by hardwood merchantable carbon (highest first). |
| 12 | Sort by oldest hardwood first. |
| 13 | Sort by time since the hardwood component was last harvested. |
Available Sort Types in libcbm_py
Below are the disturbance sort types that are implemented in libcbm_py:
{
1: "PROPORTION_OF_EVERY_RECORD",
2: "MERCHCSORT_TOTAL",
3: "SORT_BY_SW_AGE",
5: "SVOID",
6: "RANDOMSORT",
7: "TOTALSTEMSNAG",
8: "SWSTEMSNAG",
9: "HWSTEMSNAG",
10: "MERCHCSORT_SW",
11: "MERCHCSORT_HW",
12: "SORT_BY_HW_AGE",
}
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for goblin_cbm_runner 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| goblin_cbm_runner-0.6.1.tar.gz | 917.2 kB | Without provenance | Details for goblin_cbm_runner-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| goblin_cbm_runner-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for goblin_cbm_runner-0.6.1-py3-none-any.whl |
Total release size: 1.9 MB
Release files / goblin_cbm_runner-0.6.1.tar.gz
| Download URL | goblin_cbm_runner-0.6.1.tar.gz |
|---|---|
| Size | 917.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
768a3004c62b5534759eef110d91d6d564e15897f38e228b3ce1d91bde35c131
|
|
BLAKE2b-256 checksum How to use checksums |
befb1ec42e781196c71d42fde91c51769a5d6f2491250c98cb5e8c45178b8e27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-134-generic
|
Release files / goblin_cbm_runner-0.6.1-py3-none-any.whl
| Download URL | goblin_cbm_runner-0.6.1-py3-none-any.whl |
|---|---|
| Size | 964.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5583f2d21d71c17c8be19155e812a4cd69518a05876208eda97450e28557dbe0
|
|
BLAKE2b-256 checksum How to use checksums |
ee34a4c146c28a283c3adec3662cd12886c12d992e651c506f3264d926b4652f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-134-generic
|
Security for goblin_cbm_runner 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.