Skip to main content

atmoflux

A Python package for atmospheric and surface flux calculation and analysis.

Overview

atmoflux is a Python library for atmospheric and surface flux calculations relevant to climate, micrometeorology, and urban environmental research. The package provides modular tools for radiative, turbulent, hydrological, aerosol, and energy balance calculations, alongside supporting utilities for atmospheric state variables and physical constants.

The atmoflux library emphasizes physically explicit formulations and transparent diagnostics, supporting process-based analysis and integration with statistical or machine learning models. All functions accept scalars or NumPy arrays, so calculations vectorize naturally over gridded or time-series data.

atmoflux is being developed alongside dissertation research focused on urban microclimates, heat stress, and land–atmosphere interactions, and is intended to evolve as a flexible research framework rather than a fixed operational model.

Citation

If you use atmoflux in academic work, please cite the software using the DOI provided below.

Each release is archived via Zenodo and assigned a permanent DOI to ensure reproducibility.

The recommended citation format is available in CITATION.cff and via the “Cite this repository” button on GitHub.

DOI: https://doi.org/10.5281/zenodo.20470203

Requirements

  • Python ≥ 3.10 (developed and tested in 3.12)
  • NumPy ≥ 1.26 — the only runtime dependency

Keeping the dependency footprint minimal is a deliberate design goal; NumPy is the sole external requirement.

Installation

pip install atmoflux

From source

Clone the repository and install from the project root. Use an editable install if you intend to modify the code:

git clone https://github.com/JustinGeoSci/atmoflux.git
cd atmoflux

pip install .       # regular installation
pip install -e .    # editable (development) installation

Quick Start

import atmoflux as af

# Net all-wave radiation at a surface (W/m²)
rn = af.radiative.net_radiation(
    sw_down=800, lw_down=350, albedo=0.2, temp_surface=295
)

# Turbulent sensible heat flux via the bulk-aerodynamic method
rho = af.turbulent.air_density(temp=22, pressure=101.325)
h = af.turbulent.sensible_heat_flux(
    rho, wind_speed=3.0, temp_air=22, temp_surface=25, transfer_coeff=0.0013
)

# Assemble a surface energy balance with derived diagnostics
eb = af.balance.energy_balance(
    rn, sensible_heat=h, latent_heat=250, ground_heat=60
)
print(eb.residual)       # closure residual (W/m²)
print(eb.bowen_ratio)    # H / LE

Modules

Atmospheric state

Module Description
temperature Unit conversion, dew point, potential, virtual, wet-bulb and equivalent potential temperature, lapse rates, surface temperature from longwave
humidity Saturation and actual vapor pressure, relative, specific, and saturation specific humidity, mixing ratio, vapor pressure deficit, absolute humidity, precipitable water
wind Speed unit conversion, vector components, log and power-law profiles, friction velocity, shear, wind power density, canopy-derived roughness and displacement
atmosphere Scale height, barometric pressure with altitude, hypsometric thickness, density altitude, US Standard Atmosphere profile

Radiation

Module Description
solar Solar declination, hour angle, zenith and elevation, daylight hours, extraterrestrial and clear-sky shortwave radiation
radiative Blackbody emission, net shortwave and longwave (clear-sky and cloud-adjusted), net radiation, clear-sky emissivity, diffuse fraction

Surface fluxes

Module Description
turbulent Dry and moist air density, bulk-aerodynamic sensible and latent heat fluxes, transfer coefficients, surface shear stress, aerodynamic resistance
stability Bulk Richardson number, Obukhov length, stability parameter and correction functions, stability classification
hydro Latent-heat-to-evaporation conversion, Penman, Penman-Monteith, FAO-56 reference ET, Priestley-Taylor, Hargreaves, equilibrium and Dalton evaporation
aerosols Gravitational settling, particle Reynolds number, dry deposition, surface emission flux
balance Energy budget residual, Bowen ratio, available energy, energy balance ratio, ground heat fraction, EnergyBalance assembly

Core & utilities

Module Description
core Shared data structures, including the EnergyBalance and AtmosphericState containers
constants Physical and derived constants with documented units
exceptions Package exception hierarchy rooted at AtmofluxError

Testing

The package ships with a pytest suite mirroring the module structure, plus doctests in every public function.

# Unit tests
pytest atmoflux/tests/

# Docstring examples
pytest --doctest-modules atmoflux/

Changelog

See CHANGELOG.md for the full version history. The latest release is 1.2.0.

License

Released under the MIT License. See the LICENSE file for details.

Metadata

Release files for atmoflux 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atmoflux 1.2.0
File Size Uploaded Provenance Actions
atmoflux-1.2.0.tar.gz 47.8 kB Without provenance Details for atmoflux-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for atmoflux 1.2.0
File Interpreter ABI Platform Actions
atmoflux-1.2.0-py3-none-any.whl Python 3 none any Details for atmoflux-1.2.0-py3-none-any.whl

Total release size: 91.1 kB

Release files / atmoflux-1.2.0.tar.gz

Download URL atmoflux-1.2.0.tar.gz
Size 47.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ff3cd35955b75913e93a5ebc15ae4fbda40068aceb12cbded3ff55c68a9c6e16
BLAKE2b-256 checksum
How to use checksums
6379d4b922361c5c8b4e1b503fdb71577701d95ffc83b79e6681d20374bc7fd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / atmoflux-1.2.0-py3-none-any.whl

Download URL atmoflux-1.2.0-py3-none-any.whl
Size 43.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4731c6b2a003c9b1c24e08021de721ab2e50092d9a6c1e947bf51a7018108ab2
BLAKE2b-256 checksum
How to use checksums
fc5f579ee7e3e9e558b594af9dd2191d489253e96c495e2c957e9b47bf36ca0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for atmoflux 1.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page