Skip to main content

fast_gsw

A ctypes-based Python interface for fast, vectorized execution of a few TEOS-10 GSW (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 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 Oceanographic Toolbox, C version 3.06.16, under the license in src/fast_gsw/_csrc/LICENSE.

Metadata

Release files for fast-gsw 0.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 fast-gsw 0.2.0
File Size Uploaded
fast_gsw-0.2.0.tar.gz 2.4 MB Details

Release files / fast_gsw-0.2.0.tar.gz

Download URL fast_gsw-0.2.0.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
3829bf47ed53263246cacf256e5db65ad7474ff5d57e5e5a27d22a92e07e790a
BLAKE2b-256 checksum
How to use checksums
ea603afb464ec1a134cc816c58ab6ee3770814e7e9f78e0330119fd266288a2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

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