Hydrometeorology Calculation Library
A trusted library of verified and referenced hydrometeorological calculations and derivations.
Overview
hydrometlib is a small collection of standard calculations used to turn raw hydrometeorological
measurements into derived quantities: net radiation, potential evapotranspiration, absolute humidity, soil moisture
from cosmic-ray neutron counts, and more. Each one is a single function you call with the data types you already have.
- Flexible inputs: call every function with a Polars expression, a column name, a Polars Series, a pandas Series or a NumPy array, and get the result back in the same form. Site attributes, such as a sensor height or latitude, take a plain number or a column.
- Referenced and tested: every calculation cites the paper or standard it comes from, and is checked against known-good values across all supported input types.
- Trusted source: developed and maintained by UKCEH as part of the Floods and Droughts Research Infrastructure (FDRI).
See the quick start for example calculations using Polars, pandas and NumPy, and the calculation library for every function with its inputs, units and source.
Installation
pip install hydrometlib
or with uv:
uv add hydrometlib
pandas and NumPy inputs need the matching extra, e.g. pip install "hydrometlib[pandas]".
See the installation guide for details.
License
This project is licensed under the MIT license.
Contributing
Contributions are welcome. Please feel free to submit a Pull Request.
- Clone the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please make sure your code passes all tests and follows the coding style before submitting a PR. See developer setup below for more information.
Developer Setup
This is for active development on the hydrometlib package itself.
Requirements
Install uv
Clone the repository
git clone https://github.com/NERC-CEH/hydrometlib.git
cd hydrometlib
Setting up and activating a virtual environment
uv sync
source .venv/bin/activate
Linting
Linting uses ruff using the config in pyproject.toml
ruff check --fix
Formatting
Formating uses ruff using the config in pyproject.toml which follows the default black settings.
ruff format .
Testing
Testing is done using pytest and tests are in the /tests directory.
pytest
Pre commit hooks
Run below to setup the pre-commit hooks.
git config --local core.hooksPath .githooks/
This will set this repo up to use the git hooks in the .githooks/ directory.
The hook runs ruff format --check and ruff check to prevent commits that are not formatted correctly or have errors.
The hook intentionally does not alter the files, but informs the user which command to run.
Documentation
For full documentation, visit https://nerc-ceh.github.io/hydrometlib/
To build the documentation locally:
# Install documentation dependencies (but they are included by default)
uv sync --group docs
# Build the documentation
cd docs
make html
# View documentation
open _build/html/index.html
Citation
If you use this software, please cite it using the metadata in CITATION.cff.
Built with Cookiecutter and the NERC-CEH/fdri-cookiecutter-pypackage template.
Metadata
Release files for hydrometlib 1.1.1
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 |
|---|---|---|---|---|
| hydrometlib-1.1.1.tar.gz | 680.0 kB | With provenance | Details for hydrometlib-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hydrometlib-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for hydrometlib-1.1.1-py3-none-any.whl |
Total release size: 708.1 kB
Release files / hydrometlib-1.1.1.tar.gz
| Download URL | hydrometlib-1.1.1.tar.gz |
|---|---|
| Size | 680.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db6322d3a483391fad7f4e120f86120a461dbab23baee7b1b955278bca2e547e
|
|
BLAKE2b-256 checksum How to use checksums |
e0d73a7dec4716bf719b0a0d04966c91d519aa02b0a2e83a2701cb3992cc793a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logRelease files / hydrometlib-1.1.1-py3-none-any.whl
| Download URL | hydrometlib-1.1.1-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7ccf0c4e96791323f499ff90440520f25fb72039d05f4b775f517698a314861
|
|
BLAKE2b-256 checksum How to use checksums |
7bbbd50425750757e007759241b1439d445f33c80253418c7477687f551e8e5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logSecurity for hydrometlib 1.1.1
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 hydrometlib-1.1.1.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 Oct 19, 2026.
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.