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. It defines units that help analysing common problems in energy systems, industrial ecology, and climate mitigation.
Installation
Install via pip:
pip install git+https://github.com/PhilippVerpoort/cet-units.git
Note: The package will be published on PyPI in the near future for simpler installation.
Basic Functionality
CET Units extends pint with specialised units for climate and energy transition analysis and modelling.
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
Emissions
Greenhouse-gas emission species can be converted according to a climate assessment, e.g. AR6GWP100 (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
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
Credits and Thanks
- Developed by P.C. Verpoort at the Potsdam Institute for Climate Impact Research (PIK).
- 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).