skillfed

gsw

Gibbs Seawater Oceanographic Package of TEOS-10

gsw v3.6.23 114.9K downloads/30d#12,275 on PyPI177
Permissive license BSD-3-Clause Active released

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 gsw

uv

uv add gsw

poetry

poetry add gsw

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering

Tags

oceanographic thermodynamicsseawater properties calculatorTEOS-10 implementationsalinity temperature densityocean water equationsgsw oceanographyseawater equation of state
oceanographythermodynamicsnumpy-ufunc

More Scientific/Engineering packages