CF-compliant unit registry and formatter for Pint
Project description
pint-cf
This package extends Pint with a CF-compliant unit registry and formatter.
Features
This package provides:
- A CF-compliant Pint UnitRegistry, with explicit plurals.
- A custom formatter
cf, supporting both long and short (symbol) formats.
Known limitations:
- Pint does not support time coordinates (e.g.
days since 2001-01-01) or climate calendars (e.g.,360_days). Consider using cftime for that. - Pint does not support scaling factors in Unit expressions (e.g.
pint.Unit('0.1 m')). You can work around this by adding your own unit definition.
Usage
Create a CF-ready unit registry with cf_unitregistry().
This function also registers the cf formatter.
from pint_cf import cf_unitregistry
ureg = cf_unitregistry()
print(type(ureg)) # <class 'pint.registry.UnitRegistry'>
q = ureg('10 meters per second^2').to('km s-2')
print(f"{q:cf}") # 0.01 kilometer-second^-2
print(f"{q:~cf}") # 0.01 km/s2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pint_cf-0.1.0a3.tar.gz.
File metadata
- Download URL: pint_cf-0.1.0a3.tar.gz
- Upload date:
- Size: 29.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d847a18143583a8645d5c03593d240be8bb88f3a00d483baf55c38ce79cc26c
|
|
| MD5 |
f3793546238340176d45596c2671e097
|
|
| BLAKE2b-256 |
585105ea58c1a02818214ed8417bab3a64adc8f11f9d2f7126ea4760d02ee017
|
Provenance
The following attestation bundles were made for pint_cf-0.1.0a3.tar.gz:
Publisher:
python-publish.yml on pgamez/pint-cf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pint_cf-0.1.0a3.tar.gz -
Subject digest:
9d847a18143583a8645d5c03593d240be8bb88f3a00d483baf55c38ce79cc26c - Sigstore transparency entry: 1254826159
- Sigstore integration time:
-
Permalink:
pgamez/pint-cf@ef3e0e3e33b3d583398735a4ed95a98110f6df65 -
Branch / Tag:
refs/tags/v0.1.0-alpha.3 - Owner: https://github.com/pgamez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ef3e0e3e33b3d583398735a4ed95a98110f6df65 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pint_cf-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: pint_cf-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cfe757a38ebbb3e81db0221bd9868a5a58bf46a675798c5920f671b6e6d5851
|
|
| MD5 |
0b318a648e3dea2d61cee14ac2a65e6f
|
|
| BLAKE2b-256 |
7beb2813815b44c78502ea7689c7b463be1642738e4aadf6f2d0247371f72cb8
|
Provenance
The following attestation bundles were made for pint_cf-0.1.0a3-py3-none-any.whl:
Publisher:
python-publish.yml on pgamez/pint-cf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pint_cf-0.1.0a3-py3-none-any.whl -
Subject digest:
3cfe757a38ebbb3e81db0221bd9868a5a58bf46a675798c5920f671b6e6d5851 - Sigstore transparency entry: 1254826504
- Sigstore integration time:
-
Permalink:
pgamez/pint-cf@ef3e0e3e33b3d583398735a4ed95a98110f6df65 -
Branch / Tag:
refs/tags/v0.1.0-alpha.3 - Owner: https://github.com/pgamez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ef3e0e3e33b3d583398735a4ed95a98110f6df65 -
Trigger Event:
release
-
Statement type: