Metadata-Version: 2.4
Name: nomogram
Version: 0.1.1
Summary: Repository of scientific formulas: notations, units, validity domains
Keywords: scientific computing,formulas,units,dimensional analysis,physics,thermodynamics,geoscience,atmospheric science,meteorology,hydrology,psychrometrics
Author: miki4ia
Author-email: miki4ia <miki4ia@gmail.com>
License-Expression: BSD-3-Clause AND CC-BY-4.0 AND CC0-1.0
License-File: LICENSE
License-File: src/nomogram/data/NOTICE.md
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Classifier: Topic :: Scientific/Engineering :: Hydrology
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Typing :: Typed
Requires-Dist: numpy>=2.0
Requires-Dist: pint>=0.24.4
Requires-Dist: sympy>=1.13
Requires-Dist: matplotlib>=3.10.7 ; extra == 'viz'
Requires-Python: >=3.12
Project-URL: Homepage, https://github.com/miki4iaml/nomogram
Project-URL: Repository, https://github.com/miki4iaml/nomogram
Project-URL: Issues, https://github.com/miki4iaml/nomogram/issues
Project-URL: Changelog, https://github.com/miki4iaml/nomogram/blob/main/CHANGELOG.md
Provides-Extra: viz
Description-Content-Type: text/markdown

# nomogram

**English** | [Français](README.fr.md)

[![CI](https://github.com/miki4iaml/nomogram/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/miki4iaml/nomogram/actions/workflows/ci.yml)
[![CodeQL](https://github.com/miki4iaml/nomogram/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/miki4iaml/nomogram/actions/workflows/github-code-scanning/codeql)
[![codecov](https://codecov.io/gh/miki4iaml/nomogram/graph/badge.svg?branch=develop)](https://codecov.io/gh/miki4iaml/nomogram)
[![Python](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fmiki4iaml%2Fnomogram%2Fdevelop%2Fpyproject.toml)](pyproject.toml)
[![License](https://img.shields.io/github/license/miki4iaml/nomogram)](LICENSE)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-fe5196)](https://www.conventionalcommits.org/en/v1.0.0/)

A repository of scientific formulas: alternative notations across
authors and conventions, parameter units (including empirical ones),
validity domains, LaTeX rendering and symbolic computation.

Pure Python, built on SymPy, numpy and pint; it works on an offline
workstation (no online engine).

> Early stage project (alpha).

## Installation

```
pip install nomogram          # core
pip install "nomogram[viz]"   # with plots (matplotlib)
```

## Installation from source

```
git clone https://github.com/miki4iaml/nomogram.git
cd nomogram
uv sync
```

Python 3.12 or later. Plots need the `viz` extra (matplotlib):
`uv sync --extra viz`.

## Example

Every saturation vapour pressure formulation of the catalog against the
IAPWS reference; curves stop where a formulation leaves its stated
validity domain ([script](docs/examples/saturation_vapour_pressure.py)):

```python
import numpy as np
from nomogram.catalog import catalog
from nomogram.comparison import compare
from nomogram.plot import plot_deviations  # extra viz
from nomogram.units import Q_

formulations = catalog().formulations_of("SaturationVapourPressureOverWater")
reference = catalog().formulations["iapws_sr1_86"]
temperatures = Q_(np.linspace(-60, 110, 341), "degC")

table = compare(formulations, reference, {"ThermodynamicTemperature": temperatures})
plot_deviations(table)
```

![Deviation of saturation vapour pressure formulations from IAPWS](https://raw.githubusercontent.com/miki4iaml/nomogram/v0.1.0/docs/images/saturation-vapour-pressure.png)

## Usage

The table holds the values and the relative deviations, by formulation;
values outside a formulation's validity domain are NaN unless asked
otherwise (`outside="ignore"`). Formulations also chain, for instance
the absolute humidity from any saturation vapour pressure formulation:

```python
from nomogram.comparison import compose

ha = compose(catalog().formulations["mass_concentration_ideal_gas"], {"e_s": reference})
ha.evaluate(RH=Q_(100, "percent"), T=Q_(20, "degC")).to("g/m^3")  # 17.29
```

Each formulation keeps its units, validity domain, temperature scale and
references. The vocabulary is mapped in [docs/rosetta.md](docs/rosetta.md).

## Contributing

References to integrate, information or corrections about catalog
entries, new formulas and code are all welcome: see the
[ways to contribute](.github/CONTRIBUTING.md#ways-to-contribute) and
the [catalog guide](docs/catalog.md).

## License

[BSD-3-Clause](LICENSE).
