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.
You can install CET Units via pip directly from GitHub:
pip install git+https://github.com/PhilippVerpoort/cet-units.gitOr 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.
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_2024The deflators and exchange rates are obtained from the World Bank using the pydeflate package.
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 CO2eqThe global-warming potentials for the different species have been taken from globalwarmingpotentials.
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_LHVThe 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.
- 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).
- 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.cffand include the commit hash.
This project is licensed under the MIT Licence.
Full documentation is available on GitHub Pages.