cf-units
Units of measure as required by the Climate and Forecast (CF) metadata conventions
What it is and what it does
cf-units is a Python library that implements units of measure as specified by the Climate and Forecast Metadata Conventions, a standard used across earth science data formats like NetCDF. It depends on numpy for array operations, cftime for time-related units, and jinja2 for template rendering. The package is designed for scientists and researchers working with atmospheric, oceanographic, and climate data who need to ensure their measurements conform to CF standards.
The library handles unit representation, validation, and operations within the CF framework. It is actively maintained, supports Python 3.11–3.14, and provides pre-built wheels for common platforms (macOS, Linux, Windows), reducing installation complexity for most users. With no known security vulnerabilities and a permissive BSD-3-Clause license, it is suitable for both academic and commercial projects.
Use it for:
- Validate and standardize units in NetCDF climate datasets to ensure CF metadata compliance.
- Convert between equivalent unit representations in atmospheric and oceanographic data pipelines.
- Build data processing workflows that require consistent unit handling across multiple earth science sources.
- Integrate CF-compliant unit metadata into scientific data analysis and visualization tools.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
cf-units provides units of measure as defined by the Climate and Forecast (CF) Metadata Conventions, enabling standardized unit handling for scientific data in atmospheric science, oceanography, and climate research.
Yes. cf-units is production-stable, actively maintained, has no known vulnerabilities, and carries a permissive license. Install friction is moderate but manageable via pre-built wheels. Install it if you work with CF-compliant earth science data (climate, oceanography, meteorology) and need standardized unit handling; otherwise it is not necessary.
Install
cf-units on PyPI
pip
pip install cf-unitsuv
uv add cf-unitspoetry
poetry add cf-unitsInstalling cf-units
Before you install
Medium install friction due to compiled wheels for specific platforms (macOS arm64/x86_64, Linux x86_64, Windows amd64). Actively maintained with recent releases; last commit 2026-08-10 and production-stable status indicate reliable upkeep.
License in practice
BSD-3-Clause (permissive) allows commercial and private use with minimal restrictions, requiring only license and copyright notice retention.
Quickstart
pip install cf-units
import cf_units
# Create a unit object following CF conventions
temperature_unit = cf_units.Unit('K') # Kelvin
print(temperature_unit)
Requires Python 3.11 or later; compiled wheels are available for macOS (arm64, x86_64), Linux (x86_64), and Windows (amd64)—other platforms may require building from source.
Verify before relying
- Whether the package handles unit conversion between different CF-compliant systems or only validates/represents units.
- Performance characteristics when working with large arrays or high-frequency unit operations.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 3 — cftime, jinja2, numpy |
| Maintenance | actively maintained — 210 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 75,415/month — #14,718 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cf_units-3.3.1-cp311-abi3-macosx_15_0_arm64.whl; cf_units-3.3.1-cp311-abi3-macosx_15_0_x86_64.whl; cf_units-3.3.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; cf_units-3.3.1-cp311-abi3-win_amd64.whl
Keywords: units, cf, cf-metadata, netcdf, science, earth-science, oceanography, meteorology, climate, python
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
cf-xarraycf-xarray adds a `.cf` accessor to xarray…
permissive · top 15,000 on PyPI
nc-time-axisEnables matplotlib to plot data using cftime…
permissive · top 15,000 on PyPI
cftimeConverts between calendar dates and numeric…
permissive · top 5,000 on PyPI
earthkit-dataearthkit-data provides a unified Python…
permissive · top 15,000 on PyPI
cfgribcfgrib maps GRIB meteorological data files to…
permissive · top 5,000 on PyPI
gswGSW-Python wraps the TEOS-10 seawater…
permissive · top 15,000 on PyPI
scikit-baseProvides base classes and design patterns for…
permissive · top 5,000 on PyPI
meteostatMeteostat provides access to historical weather…
unclear · top 15,000 on PyPI
unytAttaches units to NumPy arrays and provides…
permissive · top 15,000 on PyPI
conda-packconda-pack creates relocatable conda…
permissive · top 15,000 on PyPI