Skip to main content

Unit definitions for integrated-assessment research

Project description

© 2020 IAM-units authors; licensed under the GNU GPL version 3.

The file definitions.txt gives Pint-compatible definitions of energy, climate, and related units to supplement the SI and other units included in Pint’s default_en.txt. These definitions are used by:

and may be used for research in integrated assessment, energy systems, transportation, or other, related fields. (Please open a pull request to add your usage to this README!)

Usage

>>> from iam_units import registry

>>> qty = registry('1.2 tce')
>>> qty
1.2 <Unit('tonne_of_coal_equivalent')>

>>> qty.to('GJ')
29.308 <Unit('gigajoule')>

To make the registry from this package the default:

>>> import pint
>>> pint.set_application_registry(registry)

# Now used by default for pint top-level classes and methods
>>> pint.Quantity('1.2 tce')
1.2 <Unit('tonne_of_coal_equivalent')>

Warnings

iam_units overwrites Pint’s default definitions in the following cases:

pint default

iam_units

Note

‘C’ = Coulomb

‘C’ = carbon

See emissions.txt at line 10.

‘kt’ = knot [velocity]

‘kt’ = 1000 metric tons

‘kt’ is commonly used for emissions in the IAM-context.

Technical details

Emissions and GWP

emissions.txt defines some greenhouse gases (GHGs) as Pint base units. Conversion of masses of these GHGs to CO₂ equivalents use selectable global warming potential (GWP) metrics, implemented as Pint contexts in the other files in the same directory. The contexts have names like gwp_<IPCC report>GWP<years>, where <years> is 100 and:

<IPCC report>

Meaning

SAR

Second Assessment Report (1995)

AR4

Fourth Assessment Report (2007)

AR5

Fifth Assessment Report (2014)

To use one of these contexts, give its name as the second argument to the pint.Quantity.to() method:

>>> qty = registry('3.5e3 t N20')
>>> qty
3500 <Unit('metric_ton * nitrous_oxide')>

>>> qty.to('Mt CO2', 'gwp_AR4GWP100')
0.9275 <Unit('carbon_dioxide * megametric_ton')>

# Using a different metric
>>> qty.to('Mt CO2', 'gwp_SARGWP100')
1.085 <Unit('carbon_dioxide * megametric_ton')>

Data sources

The GWP unit definitions are generated using the file metric_conversions.csv. The file is copied from lewisjared/scmdata v0.4, authored by @lewisjared, @swillner, and @znicholls and licensed under BSD-3. The version in scmdata was transcribed from this source (PDF link).

See DEVELOPING.rst for details on updating the definitions.

Tests and development

Use pytest iam_units to check that the definitions can be loaded. Example unit expressions in checks.csv are also checked. See DEVELOPING.rst for further details.

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

iam_units-2020.4.9.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

iam_units-2020.4.9-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file iam_units-2020.4.9.tar.gz.

File metadata

  • Download URL: iam_units-2020.4.9.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.5

File hashes

Hashes for iam_units-2020.4.9.tar.gz
Algorithm Hash digest
SHA256 6b5ed20ab219cf9b999228ed3e9905f449a181cc3faaea6fa8323d7a0e76841e
MD5 6bbd56a78b40a600438811128ffe6ad7
BLAKE2b-256 e175379f54997aa42b95fccaacebc104e8a17a6f9bee5d3769fcf2788e2ac5af

See more details on using hashes here.

File details

Details for the file iam_units-2020.4.9-py3-none-any.whl.

File metadata

  • Download URL: iam_units-2020.4.9-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.5

File hashes

Hashes for iam_units-2020.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d24149aa6f81816dca10237c1972a88a5bfc1097584e1e9c7bef19d8fa4f746d
MD5 4fb18a07b58d97eba67dce6ef7aed618
BLAKE2b-256 e0b158177e49baade57014b23f72fc499968bad27b155384f6ffe4b7dfc004c0

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