Metadata-Version: 2.4
Name: fast_gsw
Version: 0.2.0
Summary: Fast ctypes-based implementation of some gsw (TEOS-10) functions for vectorized CTD processing
Author-email: Lucas Merckelbach <lucas.merckelbach@hereon.de>
License-Expression: GPL-3.0-or-later
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Dynamic: license-file

# fast_gsw

A ctypes-based Python interface for fast, vectorized execution of a few
[TEOS-10 GSW](http://www.teos-10.org/) (Gibbs SeaWater) oceanographic
functions, intended for processing large arrays of CTD
(conductivity/temperature/pressure) data, such as from ocean gliders.

Currently implemented:

- `rho(C, t, P, lon, lat)` — in-situ density
- `pot_rho(C, t, P, lon, lat)` — potential density (reference pressure 0 dbar)
- `SA(C, t, P, lon, lat)` — absolute salinity
- `CT(C, t, P, lon, lat)` — conservative temperature

All inputs/outputs are plain numpy arrays (scalars are broadcast); units are
conductivity in mS/cm, temperature in °C, pressure in dbar, and longitude /
latitude in decimal degrees.

## Why

The pure-Python [`gsw`](https://pypi.org/project/gsw/) package computes
in-situ density (and similar derived quantities) as a chain of several
composed Python function calls per array (e.g.
`SP_from_C -> SA_from_SP -> rho_t_exact`). For large arrays of CTD triplets,
`fast_gsw` collapses that whole pipeline into a single C function call by
vendoring and compiling the TEOS-10 C implementation and calling it via
`ctypes`, which removes the Python-level per-step call overhead.

## Install

```
pip install fast_gsw
```

This compiles the vendored TEOS-10 C sources at install time, so a C
compiler (gcc/clang) must be available. No other manual steps, root access,
or system-wide library installation are required.

To install from a local checkout:

```
pip install .
```

## License

`fast_gsw` itself is licensed under the GPLv3 (see `LICENSE`). It vendors and
compiles source code from the [TEOS-10 GSW-C](https://github.com/TEOS-10/GSW-C)
Oceanographic Toolbox, C version 3.06.16, under the license in
`src/fast_gsw/_csrc/LICENSE`.
