gsw
Gibbs Seawater Oceanographic Package of TEOS-10
What it is and what it does
GSW-Python is a scientific library that implements the TEOS-10 (Thermodynamic Equation of Seawater 2010) standard for oceanographic calculations. It wraps 165 scalar C functions as numpy ufuncs, exposing 158 of them in the main namespace alongside Python implementations of additional functions. The library replaces an earlier pure-Python implementation with a C-based approach that trades build-time compilation for gains in speed, memory efficiency, and function coverage.
The package is designed for oceanographers and marine scientists who need to compute seawater properties—salinity, temperature, density, sound speed, and related quantities—from field measurements. It depends only on numpy and supports Python >=3.11 across macOS, Linux, Windows, and WebAssembly platforms via pre-built wheels. The core use case is converting between different oceanographic measurement conventions and deriving quantities used in ocean modeling and data analysis.
Use it for:
- Convert practical salinity and in-situ temperature to absolute salinity and potential temperature for ocean model initialization
- Calculate seawater density and sound speed from CTD sensor data for water mass classification
- Derive conservative temperature and other thermodynamic properties for oceanographic research
- Batch process large arrays of oceanographic measurements using numpy ufunc broadcasting
- Integrate TEOS-10 calculations into xarray-based ocean data pipelines via gsw-xarray wrapper
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
GSW-Python wraps the TEOS-10 seawater thermodynamic equations as numpy ufuncs, providing fast oceanographic calculations for properties like salinity, temperature, and density from in-situ measurements.
Yes, if you work with oceanographic data or seawater thermodynamics. The package is stable (Production/Stable status), actively maintained, has no known vulnerabilities, and provides the standard reference implementation of TEOS-10. The C-based approach offers substantial performance gains. The main constraint is the Python >=3.11 requirement and C compiler dependency for source builds, but pre-built wheels mitigate friction on common platforms.
Install
gsw on PyPI
pip
pip install gswuv
uv add gswpoetry
poetry add gswInstalling gsw
Before you install
Medium install friction due to C compilation requirement; pre-built wheels available for common platforms (macOS, Linux x86_64/aarch64, Windows). Active maintenance with recent release (54 days ago) and ongoing repository activity.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.
Quickstart
pip install gsw
import gsw
import numpy as np
# Calculate absolute salinity from practical salinity and temperature
SA = gsw.SA_from_SP(SP, t, p, lon)
# Calculate potential temperature
pt = gsw.pt_from_t(SA, t, p)
Requires C compiler (gcc/clang on Unix, MSVC on Windows) when building from source; pre-built wheels available for Python >=3.11 on common platforms.
Verify before relying
- Performance improvements quantified relative to the original pure-Python implementation
- Compatibility with masked arrays and edge cases in real oceanographic datasets
- Whether all 158 wrapped ufuncs are fully documented with equivalent detail
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 54 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 114,910/month — #12,275 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gsw-3.6.23-cp311-abi3-macosx_10_9_x86_64.whl; gsw-3.6.23-cp311-abi3-macosx_11_0_arm64.whl; gsw-3.6.23-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; gsw-3.6.23-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; gsw-3.6.23-cp311-abi3-pyemscripten_2026_0_wasm32.whl; gsw-3.6.23-cp311-abi3-win_amd64.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
iapwsCalculates thermodynamic and transport…
copyleft · top 15,000 on PyPI
pygeosPyGEOS wraps GEOS geometry operations in NumPy…
permissive · top 15,000 on PyPI
pymap3dConverts between geographic and 3-D coordinate…
permissive · top 15,000 on PyPI
copernicusmarineCopernicusmarine provides a CLI and Python API…
unclear · top 15,000 on PyPI
cf-unitscf-units provides units of measure as defined…
permissive · top 15,000 on PyPI
simple-equA library of ready-to-use STEM equations…
permissive · top 15,000 on PyPI
cmoceanProvides perceptually uniform colormaps…
unclear · top 15,000 on PyPI
CoolPropCoolProp provides thermodynamic and transport…
permissive · top 5,000 on PyPI
pyscfPySCF is a Python framework for quantum…
permissive · top 15,000 on PyPI
gstools-cythonProvides optimized Cython implementations of…
copyleft · top 15,000 on PyPI