Skip to content

PhilippVerpoort/cet-units

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOI License: MIT Documentation Status CI Code style: Ruff Python versions

CET Units Logo

CET Units: Climate and Energy Transition Units

CET Units stands for Climate and Energy Transition Units. It is a Python package built on top of pint that defines units commonly used in energy systems, industrial ecology, and climate mitigation analysis.

Installation

You can install CET Units via pip directly from GitHub:

pip install git+https://github.com/PhilippVerpoort/cet-units.git

Or clone and install locally:

git clone https://github.com/PhilippVerpoort/cet-units.git
cd cet-units
pip install .

Note: The package will be published on PyPI in the near future for simpler installation.

Examples

Currencies

Deflators and exchange rates are defined to conveniently convert currencies from current (nominal) to constant (real) values and between currencies (e.g. USD and EUR).

>>> from cet_units import ureg
>>>
>>> unit_from = ureg("1 USD_2020")
>>> unit_to = unit_from.to("EUR_2024")
>>> print(f"{unit_to:.3f}")
1.098 EUR_2024

The deflators and exchange rates are obtained from the World Bank using the pydeflate package.

Emissions

Greenhouse-gas emission species can be converted according to a climate assessment, e.g. ARG6GWP100 (IPCC Assessment Report 6, 100-year warming period).

>>> from cet_units import ureg
>>>
>>> unit_from = ureg("1 Mt CH4")
>>> unit_to = unit_from.to("Mt CO2eq", "AR6GWP100")
>>> print(f"{unit_to:.3f}")
27.9 Mt CO2eq

The global-warming potentials for the different species have been taken from globalwarmingpotentials.

Energy carriers

This package defines additional units for converting amounts of energy carriers between different dimensions.

>>> from cet_units import ureg
>>>
>>> # Load definitions for hydrogen, natural gas, ammonia, and methanol.
>>> ureg.define_flows(["H2", "NG", "NH3", "MeOH"])
>>> unit_from = ureg("1 kg_H2")
>>> unit_to = unit_from.to("kWh_H2_LHV")
>>> print(f"{unit_to:.3f}")
33.333 kWh_H2_LHV

The possible dimensions for conversion are:

  • [mass]
  • [energy] — lower-heating value (LHV) and higher-heating value (HHV)
  • [volume] — normal (norm) and standard (std) temperature and pressure

The conversion factors and bibliographic information for their sources are stored in src/cet_units_generate/data.

Credits and Thanks

  • Built on top of pint. Thank you to its contributors.
  • Inspired by the iam-units package.
  • This package was developed as part of the Ariadne project with funding from the German Federal Ministry of Research, Technology and Space (grant nos. 03SFK5A, 03SFK5A0-2).

How to cite

  • To cite a release (recommended), please refer to a specific version archived on Zenodo.
  • To cite a specific commit, please refer to the citation information in CITATION.cff and include the commit hash.

Licence

This project is licensed under the MIT Licence.

Documentation

Full documentation is available on GitHub Pages.

About

Units for techno-economic assessments and manipulations.

Topics

Resources

License

Stars

Watchers

Forks

Contributors