92nd American Meteorological Society Annual Meeting (January 22-26, 2012)

Monday, 23 January 2012: 2:00 PM
A Python Implementation of the New Thermodynamic Equation of State for Seawater
Room 346/347 (New Orleans Convention Center )
Filipe Pires Fernandes, SMAST, New Bedford, MA; and B. ┼dlandsvik

Recently the Intergovernmental Oceanographic Commission (IOC), with the endorsement of the Scientific Committee on Oceanic Research (SCOR) and the International Association for the Physical Sciences of the Oceans (IAPSO), has adopted the International Thermodynamic Equation of Seawater - 2010 (TEOS-10) as the official description of seawater in marine science. The new TEOS-10 should replace UNESCO's joint panel on oceanographic tables and standards, UNESCO 1981 and UNESCO 1983 (EOS-80).

The Gibbs-Seawater (GSW) Oceanographic Toolbox contains the TEOS-10 subroutines for evaluating the thermodynamic properties of pure water (using IAPWS-09) and seawater (using IAPWS-08 for the saline part).

Notable differences between TEOS-10 and EOS-80 are:

1. Absolute Salinity S_A is used to describe the salinity of seawater. S_A incorporates the spatially varying composition of seawater. 2. Conservative Temperature replaces potential temperature. 3. TEOS-10 thermodynamic quantities are mutually consistent with each other.

The GSW toolbox (www.TEOS-10.org) is currently distributed in Fortran (version 1 and 3) and MATLAB (versions 2 and 3). While Fortran has open source compilers, Fortran is not a language recommend as an analysis tool. MATLAB on the other hand is a "scripting" language, making it a better choice as an analysis tool. However, one must acquire a license and deal with a closed source solution.

Following the idea that an important algorithm, such as the TEOS-10, should have the flexibility of a scripting language, and an open source alternative, we decided to convert the GSW toolbox to Python.

Python is an elegant and robust programming language that combines the power and flexibility of traditional compiled languages with the ease-of-use of simpler scripting and interpreted languages. Also, when Python is augmented by SciPy, NumPy, SymPy, and matplotlib, it offers an environment for numerical/scientific computing equivalent to (or better than?) commercial products like MATLAB, IDL, Maple, etc. The use of python based analysis tools in physical oceanography is gaining momentum.

The Python version of TEOS-10 is compatible with the official MATLAB version, allowing an easy transition for new users and a seamless use of the original documentation between the different implementations. Although, we allowed ourselves to drift from the original code to implement some improvements, like a cleaner and more intuitive function to calculate Absolute Salinity, and a decorator providing a consistent interface to the functions for scalars, and ordinary and masked NumPy arrays, both written by Eric Firing.

We opted for an open developing model, with a code repository at Google Project Hosting, (version controlled via mercurial), and a strong testing suite. This model makes collaboration, bug fixing and feedback between users and developers much easier and transparent. The latest source can be acquired at:


while the stable version can be obtained via the Python Package Index PyPI:


The Python version of the GSW toolbox is still under development and some routines are still being implemented.

Supplementary URL: