Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

iClimate/ghgpy

Open more actions menu
 
 

Repository files navigation

GHGPy (Green House Gas Python)


Python PyPI license


GHGPy

A Python package for GHG (Greenhouse Gas) Inventory calculations based on IPCC 2006 Guidelines with 2019 Refinements.

Carbon inventory, make it easy!

PyPI version License: MIT Python 3.11+

Installation

pip install ghgpy

For development:

pip install ghgpy[dev]

pypi: ghgpy

Requirements / Dependencies

Python 3.11 and up

Quick Start

from ghgpy import __version__
from ghgpy.data import fuels_database

# Load the emission factors database
db = fuels_database(db='xlsx')

# Display available data
print(f"GHGPy v{__version__}")
print(f"Number of emission factors: {len(db.data)}")
print(db.data.head())

Features

  • IPCC 2006 Guidelines: Emission factors from IPCC 2006 with 2019 Refinements
  • Multiple Sectors: Support for Energy, IPPU, AFOLU, and Waste sectors
  • Flexible Database: Excel-based database with SQLite/MySQL support
  • Unit Converters: Built-in energy, weight, and volume conversions
  • Factory Pattern: Easy-to-use factory classes for GHG calculations
  • Uncertainty Support: Built-in uncertainty data types

Links


Call for Contributions

The GHGPy project welcomes your expertise and enthusiasm! We're looking for contributors to help with:

  • Adding emission factors for additional regions
  • Implementing new calculation methodologies
  • Improving documentation
  • Writing tests

Basic Usage

Import library

    # General factory 
    from src.ghgpy.factory import FactoryGeneral
    # Uncertainty data type
    from src.ghgpy.datamodel.fuel import UNumber

    # Database handles
    from src.ghgpy.datamodel.db import FuelDataHandle, GHGDataHandle, EFDataHandle
    # Default databases
    from src.ghgpy.data.fuels import default_fuel_database
    from src.ghgpy.data.ghg import ghg_gas_data
    from src.ghgpy.data.efs import s_combustion_energy

Create a factory

    # Init the factory class
    MyFactory = FactoryGeneral(name="Hong Ha Textile", desc = "Textile production for export!")

Connect to the database

    MyFactory.connection(FuelDataHandle(default_fuel_database),\
                EFDataHandle(s_combustion_energy),\
                    GHGDataHandle(ghg_gas_data, 'ar6'))

Add a combussion process in factory

    MyFactory.add_combustion(name = "Boiler", desc = "Đốt lò hơi")

Add another combussion process in factory

    MyFactory.add_combustion(name = "Boiler1", desc = "Đốt lò than bùn")

Add fuels use in these combussion

    MyFactory.combustion["Boiler"].add('Diesel_Oil', UNumber(value=1000), 'l')
    MyFactory.combustion["Boiler"].add('Anthracite', UNumber(value=1000), 'kg')
    MyFactory.combustion["Boiler1"].add('Lignite', UNumber(value=1000), 'kg')

Add refrigerant use in factory

    MyFactory.add_refrigerantuse(name='AC', desc='refrigerant use for AC')

Add amount of specific type of refrigerant

    MyFactory.refrigerantuse["AC"].add("R32", UNumber(value=10, uncertainty=0), 'kg')

Electriciy use in factory

    MyFactory.add_elecuse(name='Office')

Electriciy consumption

    MyFactory.elecuse['Office'].add(name='01', amount=UNumber(value=1), unit='MWh', gef=UNumber(value=0.987), force=True)

Calculate emission

    MyFactory.emission(scope=1)

License

MIT License - see LICENSE for details.

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 95.1%
  • Jupyter Notebook 4.9%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.