OpenGHG gas calibration scale conversion tool
Convert from one calibration scale to another. If multiple conversions are required, conversion functions are chained together, following the shortest path.
Conversions can be defined as a function of the original scale, or as a function of time.
For example, conversion of CO from the WMO-X2014A to the CSIRO-94 scale uses a function:
$$ \chi_{WMO} = (\chi_{CSIRO}+3.17)/0.9898 $$
Or the conversion of the SIO-93 to the SIO-98 scale for N$_2$O involves a 4th order polynomial as a function of time.
The code uses sympy to rearrange the equations to do the conversion in the reverse order, or, in the case of time-based conversions, calculate the inverse. The shortest path between two scales is found using networkx.
Please feel free to propose new scale conversions or bug fixes by submitting a pull request.
Installation
pip
You can install openghg_calcscales using pip
pip install openghg_calscales
conda
Or with conda by doing
conda install -c conda-forge -c openghg openghg_calscales
Developer
If you want to make modifications to the package you can use an editable install with pip
First, clone the repository using git
git clone https://github.com/openghg/openghg_calscales.git
And then install the package using pip
pip install -e openghg_calscales/
Usage
For example, to convert a Pandas Series or xarray DataArray from the CSIRO-94 to TU-87 scale for CH4:
from openghg_calscales import convert
ch4_tu1987 = convert(ch4_csiro94, "CH4", "CSIRO-94", "TU-1987")
Add your own functions to data/convert_functions.csv, and submit them as a pull request to share with others.
Development
For the recommended development process please see the OpenGHG documentation
Release
The package is released using GitHub actions and pushed to conda and PyPI.
1. Update the CHANGELOG
- Update the changelog to add the header for the new version and add the date.
- Update the Unreleased header to match the version you're releasing and
...HEAD.
2. Update pyproject.toml
For a new release the package version must be updated in the pyproject.toml file. Try and follow the Semantic Versioning method.
3. Tag the commit
Now tag the commit. First we create the tag and add a message (remember to insert correct version numbers here).
git tag -a x.x.x -m "openghg_calscales release vx.x.x"
Next push the tag. This will trigger the automated release by GitHub Actions.
git push origin x.x.x
4. Check GitHub Actions runners
Check the GitHub Actions runners to ensure the tests have all passed and the build for conda and PyPI has run successfully.
Metadata
Release files for openghg-calscales 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openghg_calscales-0.1.3.tar.gz | 9.0 kB | With provenance | Details for openghg_calscales-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openghg_calscales-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for openghg_calscales-0.1.3-py3-none-any.whl |
Total release size: 19.3 kB
Release files / openghg_calscales-0.1.3.tar.gz
| Download URL | openghg_calscales-0.1.3.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d10f4034a8ae933099099ce8aa4b4ea8d34d1a7c083ce0d131e37b5a5693a7e
|
|
BLAKE2b-256 checksum How to use checksums |
80ed416dab8dcac5dcf5f67e57e141aced267c98703cbef11608c328ad94f6f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2025.
Transparency logRelease files / openghg_calscales-0.1.3-py3-none-any.whl
| Download URL | openghg_calscales-0.1.3-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c526e46a2731941ba568e6c731caf77335781a3c34843689368160ece411a851
|
|
BLAKE2b-256 checksum How to use checksums |
3269ca6716fcb1d122a6427953be2df0560ecc6eecbf38ed39bc0656d8941c81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2025.
Transparency logSecurity for openghg-calscales 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for openghg_calscales-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.