Skip to main content

A goblin tool for the estimation of emissions from various land cover types

Project description

🏘️🌳🌲🌽🍀 Land cover LCA for the GOBLIN model (Ireland only)

license python Code style: black

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

The package takes outputs from the landcover_assignment module (land use data and transition matrix) and produces emissions inventory for cropland, grassland, forest and wetlands

Currently parameterised for Ireland, the historic land uses and areas of organic and mineral soil are taken from the National Invetory CRF Tables

Final result are pandas dataframes that can be read by numerous GOBLIN packages.

Installation

Install from git hub.

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

Install from PyPI

pip install landcover_lca

Usage

The baseline year represents the scenario baseline. The target year is the end year for each one of the scenarios.

Transition dataframe is the land use transition matrix, and the land use dataframe is the areas for each land use.

The land use dataframe includes proportions for area mineral, organic, rewetted, burnt, and peat extraction.

Annual trade data has been used for horticultural peat exports.

from landcover_lca.models import load_transition_matrix, load_land_use_data
import landcover_lca.lca_emission as lca
import pandas as pd
import os


def main():

    data_dir = "./data"

    ef_country = "ireland"
    baseline = 2020
    target = 2050

    transition = pd.read_csv(os.path.join(data_dir, "transition.csv"), index_col = 0)
    land_uses = pd.read_csv(os.path.join(data_dir, "land_uses.csv"), index_col = 0)

            
    transition_matrix = load_transition_matrix(transition, ef_country, baseline, target)
        
    land_use_data = load_land_use_data(land_uses, baseline)

    baseline_index = -1
    base = -baseline

    emission_df = pd.DataFrame(
        columns=["CO2", "CH4", "N2O", "CO2e"],
        index=pd.MultiIndex.from_product(
            [
                # list(scenario_list),
                [baseline_index],
                ["cropland", "grassland", "forest", "wetland", "total"],
                [
                    baseline
                ],
            ],
            names=["scenario", "land_use", "year"],
        ),
    )

    emission_df.index.levels[0].astype(int)

    emission_df.loc[
            (
                baseline_index,
                "total",
                baseline,
            ),
            "CH4",
        ] = (
            lca.total_ch4_emission(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )

        )
    emission_df.loc[
            (
                baseline_index,
                "total",
                baseline,
            ),
            "CO2",
        ] = lca.total_co2_emission(
            land_use_data[base],
            land_use_data[base],
            transition_matrix[base],
            ef_country
        ) 

    emission_df.loc[
            (
                baseline_index,
                "total",
                baseline,
            ),
            "N2O",
        ] = (
            lca.total_n2o_emission(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )
        )
    
    emission_df.loc[
            (
                baseline_index,
                "cropland",
                baseline
            ),
            "CO2",
        ] = lca.total_co2_emission_cropland(
            land_use_data[base],
            land_use_data[base],
            transition_matrix[base],
            ef_country
        )

    emission_df.loc[
            (
                baseline_index,
                "cropland",
                baseline,
            ),
            "CH4",
        ] = lca.total_ch4_emission_cropland(
            ef_country,
            transition_matrix[base],
            land_use_data[base],
            land_use_data[base]
                
    
            )
    
    emission_df.loc[
            (
                baseline_index,
                "cropland",
                baseline,
            ),
            "N2O",
        ] = (
            lca.total_n2o_emission_cropland(
                ef_country,
                transition_matrix[base],
                land_use_data[base],
                land_use_data[base],
            )
        )
    
    
    emission_df.loc[
            (
                baseline_index,
                "grassland",
                baseline,
            ),
            "CO2",
        ] = (
            lca.total_co2_emission_grassland(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )
        )
    
    emission_df.loc[
            (
                baseline_index,
                "grassland",
                baseline,
            ),
            "CH4",
        ] = (
            lca.total_ch4_emission_grassland(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )
            
        )
    
    emission_df.loc[
            (
                baseline_index,
                "grassland",
                baseline
            ),
            "N2O",
        ] = (
            lca.total_n2o_emission_grassland(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )
        )
    emission_df.loc[
            (
                baseline_index,
                "wetland",
                baseline,
            ),
            "CO2",
        ] = (
            lca.total_co2_emission_wetland(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country,
            ) + lca.horticulture_co2_peat_export(ef_country, baseline, baseline)
        )
    emission_df.loc[
            (
                baseline_index,
                "wetland",
                baseline,
            ),
            "CH4",
        ] = (
            lca.total_ch4_emission_wetland(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )
        )
    emission_df.loc[
            (
                baseline_index,
                "wetland",
                baseline,
            ),
            "N2O",
        ] = (
            lca.total_n2o_emission_wetland(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country,
            )
        )
    emission_df.loc[
            (
                baseline_index,
                "forest",
                baseline,
            ),
            "CO2",
        ] = (
            lca.total_co2_emission_forest(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country,

            )
            
        ) 
    emission_df.loc[
            (
                baseline_index,
                "forest",
                baseline
            ),
            "CH4",
        ] = (
            lca.total_ch4_emission_forest(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )
           
        )
    emission_df.loc[
            (
                baseline_index,
                "forest",
                baseline
            ),
            "N2O",
        ] = (
            lca.total_n2o_emission_forest(
                land_use_data[base],
                land_use_data[base],
                transition_matrix[base],
                ef_country
            )

        )

    emission_df["CO2e"] = (
            emission_df["CO2"]
            + (emission_df["CH4"] * 28)
            + (emission_df["N2O"] * 295)
        )
    print(emission_df)

if __name__ == "__main__":
    main()

    

License

This project is licensed under the terms of the MIT 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

landcover_lca-0.1.2.tar.gz (45.4 kB view details)

Uploaded Source

Built Distribution

landcover_lca-0.1.2-py3-none-any.whl (46.8 kB view details)

Uploaded Python 3

File details

Details for the file landcover_lca-0.1.2.tar.gz.

File metadata

  • Download URL: landcover_lca-0.1.2.tar.gz
  • Upload date:
  • Size: 45.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.0 Linux/5.15.0-105-generic

File hashes

Hashes for landcover_lca-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cb2e67029995195f78e364e801240efd58a85b66c67dfa32ae9481f1e62ceec6
MD5 a0aa98f6d301387fe7f602b64e52e6f4
BLAKE2b-256 0eace4dd857e23e07fd96fcc7337c3a36a7e8e46b9949da2ae38a9c02cc580bb

See more details on using hashes here.

File details

Details for the file landcover_lca-0.1.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for landcover_lca-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d17d38fdf011f066f268e1ab09abdebef7920dd1973dc62880838b052aa696c1
MD5 d0d679bc870d76298ce0c17eeb8b59e0
BLAKE2b-256 ca44e44a4eb1ac55b7d458ef5bcf3c3d5050d27a18392708e6c7153d5cba0fe2

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