Skip to main content

A goblin tool for the generation of static land balance scenarios and environmental impacts

Project description

🧌🏋️ Goblin lite, for the generation of static scenarios using the GOBLIN modelling framework

license python Code style: black

Based on the GOBLIN (General Overview for a Backcasting approach of Livestock INtensification) Scenario module

The package makes use of several other custom packages that are designed around the original GOBLIN model and the Geo GOBLIN model. It is called "GOBLIN lite" more so for the fact that it does not rely on heavy code base found in previous GOBLIN models. Instead, the GOBLIN lite package coordinates stand alone packages related to herd generation, grassland production, land use, forest carbon sequestration, scenario generation and scenario assessment.

In addition to climate change impact categories, goblin lite also produces eutrophication and air quality impacts as well.

There are specific classes for the retrieval of input and output dataframes, and the production of a limited number of graphics.

GOBLIN lite also has the capacity to rank scenarios based on environmental impacts and the overall change in protein production.

For a full list of custom package documentation that GOBLIN lite relies on, please see the FUSION research website.

Installation

Install from git hub.

pip install "goblin_lite@git+https://github.com/GOBLIN-Proj/goblin_lite.git@main" 

Install from PyPI

pip install goblin_lite

Usage

Firstly, the config.json file should look like the following. The example shows a two scenarios.

To add additional scenarios, simply repeat the inputs given here, update the values, including the sceanrio numbers.

In previous versions, each scenario took 4 rows, 1 for each livestock system. This has been reduced to a single row for each scenario with additional prameters.

In addition, a csv file can now be used instead. Simply add the keys as columns and the values in the rows, with a row for every scenario.

Note: Afforest year should be the target year + 1

[{
    "Scenarios": 0,
    "Manure management cattle": "tank liquid",
    "Manure management sheep": "solid",
    "Dairy pop": 1060000,
    "Beef pop":10000,
    "Upland sheep pop": 3000,
    "Lowland sheep pop": 50000,
    "Dairy prod":0,
    "Beef prod":0,
    "Lowland sheep prod": 0,
    "Upland sheep prod": 0,
    "Forest area":1,
    "Conifer proportion":0.7,
    "Broadleaf proportion": 0.3,
    "Conifer harvest": 0.05,
    "Conifer thinned": 0.1,
    "Broadleaf harvest": 0,
    "Crop area": 0,
    "Wetland area":0,
    "Dairy GUE":0,
    "Beef GUE":0,
    "Dairy Pasture fertilisation": 150,
    "Beef Pasture fertilisation": 110,
    "Clover proportion": 0.5,
    "Clover fertilisation": 0,
    "Urea proportion": 0.2,
    "Urea abated proportion": 0,
    "Afforest year": 2051   
},
{
    "Scenarios": 1,
    "Manure management cattle": "tank liquid",
    "Manure management sheep": "solid",
    "Dairy pop": 1060000,
    "Beef pop":10000,
    "Upland sheep pop": 10000,
    "Lowland sheep pop": 10000,
    "Dairy prod":0,
    "Beef prod":0,
    "Lowland sheep prod": 0,
    "Upland sheep prod": 0,
    "Forest area":1,
    "Conifer proportion":0.7,
    "Broadleaf proportion": 0.3,
    "Conifer harvest": 0.05,
    "Conifer thinned": 0.8,
    "Broadleaf harvest": 0,
    "Crop area": 0,
    "Wetland area":0,
    "Dairy GUE":0,
    "Beef GUE":0,
    "Dairy Pasture fertilisation": 150,
    "Beef Pasture fertilisation": 110,
    "Clover proportion": 0.5,
    "Clover fertilisation": 0,
    "Urea proportion": 0.2,
    "Urea abated proportion": 0,
    "Afforest year": 2051  
}]

The model also requires a yaml file to set specific parameters for the CBM CFS3 model

Classifiers:
  baseline:
    harvest:
      clearfell:
        - conifer: 0.95
        - broadleaf: 0.6
      thinning:
        - conifer: 0.5
        - broadleaf: 0.9
  scenario:
    harvest:
      clearfell:
        - broadleaf: 0.0
      thinning:
        - broadleaf: 0.5
        
  age_classes:
    max_age: 100
    age_interval: 5

  species:
    - Sitka
    - SGB

  yield_class:
    Sitka:
      - YC13_16: 0.37
      - YC17_20: 0.26
      - YC20_24: 0.20
      - YC24_30: 0.17
    SGB:
      - YC10: 1

Below is an example of the model, which generates scenarios, and the uses the results to generate graphics.

from goblin_lite.goblin import ScenarioRunner
from goblin_lite.scenario_analysis.data_grapher import DataGrapher
import shutil
import os


def main():
    # configuration
    goblin_config = "./data/config.json"
    cbm_config = "./data/cbm_factory.yaml"
    ef_country = "ireland"
    baseline_year = 2020
    target_year = 2050

    data_path = "./graph_data"
    # remove graph dir
    shutil.rmtree(data_path)

    # output dir
    os.mkdir(data_path)


    # class instances
    runner_class = ScenarioRunner(
        ef_country, baseline_year, target_year, goblin_config, cbm_config
    )
    graph_class = DataGrapher()

    # run scenarios
    runner_class.run_scenarios()

    # plot data
    graph_class.plot_animal_lca_emissions_by_category(data_path)
    graph_class.plot_land_use_emissions(data_path)
    graph_class.plot_forest_flux(data_path, detail=True)
    graph_class.plot_forest_aggregate(data_path)
    graph_class.plot_forest_flux_subplot(data_path)
    graph_class.plot_crop_lca_emissions_by_category(data_path)
    graph_class.plot_crop_livestock_lca_emissions_by_category(data_path)

    # ranking variables
    target = 0.01
    gas = "CO2E"

    # plot ranks
    graph_class.rank_chart(target, gas, data_path)


if __name__ == "__main__":
    main()

License

This project is licensed under the terms of the GPL-3.0-or-later license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goblin_lite-0.4.2.tar.gz (84.6 kB view details)

Uploaded Source

Built Distribution

goblin_lite-0.4.2-py3-none-any.whl (93.0 kB view details)

Uploaded Python 3

File details

Details for the file goblin_lite-0.4.2.tar.gz.

File metadata

  • Download URL: goblin_lite-0.4.2.tar.gz
  • Upload date:
  • Size: 84.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.0 Linux/5.15.0-117-generic

File hashes

Hashes for goblin_lite-0.4.2.tar.gz
Algorithm Hash digest
SHA256 0903c718c3d220c51ea48aa15b61d9dab6df8f1f2733dd1d9b590701a76f41d7
MD5 0bead6bbce8967973b1d7d152e840738
BLAKE2b-256 1fbf4d8a20dbf7c92b4efc8cffb87620bed97a581c393deedd6ef5f82a8946ce

See more details on using hashes here.

File details

Details for the file goblin_lite-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: goblin_lite-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 93.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.0 Linux/5.15.0-117-generic

File hashes

Hashes for goblin_lite-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6ce0e749ed24f517604b8326557ccbf84dc2da36853f49c7cba6afa14efc981e
MD5 bbcdbf0468d45e7c086028df49574a9f
BLAKE2b-256 6df4746e472e49b3972ef1b75a8dcb8c067636190488d0c8e042125b3075863a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page