Metadata-Version: 2.4
Name: atmoslib
Version: 1.0.1
Summary: Python library for atmospheric thermodynamic calculations
Project-URL: Homepage, https://github.com/actris-cloudnet/atmoslib
Project-URL: Issues, https://github.com/actris-cloudnet/atmoslib/issues
Author-email: Simo Tukiainen <simo.tukiainen@fmi.fi>, Tuomas Siipola <tuomas.siipola@fmi.fi>
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Requires-Python: >=3.10
Requires-Dist: numpy
Provides-Extra: dev
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: release-version; extra == 'dev'
Provides-Extra: test
Requires-Dist: mypy; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: ruff; extra == 'test'
Description-Content-Type: text/markdown

# atmoslib

[![Run tests](https://github.com/actris-cloudnet/atmoslib/actions/workflows/test.yml/badge.svg)](https://github.com/actris-cloudnet/atmoslib/actions/workflows/test.yml)

Python library for atmospheric thermodynamic calculations.

## Installation

```sh
pip install atmoslib
```

## Usage

```python
import numpy as np
import atmoslib

t = np.array([293.15, 283.15, 273.15])    # temperature (K)
p = np.array([101325.0, 95000.0, 90000.0]) # pressure (Pa)
q = np.array([0.010, 0.005, 0.001])        # specific humidity (kg/kg)

tw = atmoslib.wet_bulb_temperature(t, p, q)
```

All inputs accept scalars or NumPy arrays of any shape (broadcasting follows
NumPy rules).

## Available functions

| Function                                | Description                                                   |
| --------------------------------------- | ------------------------------------------------------------- |
| `wet_bulb_temperature(t, p, q)`         | Wet-bulb temperature (K)                                      |
| `vapor_pressure(p, q)`                  | Vapor pressure of water (Pa)                                  |
| `saturation_vapor_pressure(t)`          | Saturation vapor pressure (Pa, Goff-Gratch, liquid/ice/mixed) |
| `relative_humidity(t, p, q)`            | Relative humidity over liquid water (1)                       |
| `absolute_humidity(t, vp)`              | Absolute humidity (kg/m³)                                     |
| `dew_point(t, rh)`                      | Dew-point temperature (K, Magnus)                             |
| `mixing_ratio(vp, p)`                   | Mixing ratio (kg/kg)                                          |
| `latent_heat_vaporization(t)`           | Temperature-dependent latent heat of vaporization (J/kg)      |
| `virtual_temperature(t, q)`             | Virtual temperature (K)                                       |
| `potential_temperature(t, p)`           | Potential temperature (K)                                     |
| `equivalent_potential_temperature(...)` | Equivalent potential temperature (K, linearized approx.)      |
| `air_density(p, t, mr)`                 | Moist-air density (kg/m³)                                     |
| `adiabatic_dlwc_dz(t, p)`               | Adiabatic vertical gradient of LWC at cloud base (kg/m³/m)    |
| `geometric_height(gph)`                 | Geopotential height to geometric height (m, ECMWF)            |
| `isa_altitude(t, p)`                    | Altitude from pressure and temperature (m, ISA)               |
| `c2k(t)` / `k2c(t)`                     | Celsius ↔ Kelvin conversion                                  |

See the docstrings for argument details and references.

## License

MIT
