The seawater package


The seawater package provides basic functions in Python for physical properties of sea water. The scope is similar to the MATLAB toolboxes SEAWATER from CSIRO and parts of OCEANS from Woods Hole Institute.

Note added 2011-02-07. With the new Gibbs function based equation of state TEOS-10 this seawater package is becoming obsolete. It is retained here under the MIT-license for backwards compability. Work is underway, headed by Filipe Fernandes, to implement the new equation of state in python. See the python-gsw page.

Most of the formulas used are taken from Unesco's joint panel on oceanographic tables and standards, UNESCO 1981 and UNESCO 1983.

The present version is 1.1, released 07 November 2004.

User documentation

The functions are mainly polynomials, with an occasional fractional exponent. The functions can therefore be used traditionally without NumPy to compute a single value. With NumPy the functions act like "ufuncs" in the NumPy sence. This means that they can take array arguments and return an array of the same shape.

 Public functions:
 Density related
   dens(S,T,P)           Density of sea water              kg/m**3
   svan(S,T,P)           Specific volume anomaly           m**3/kg
   sigma(S,T,P)          Density anomaly                   kg/m**3
   drhodt(S,T,P)         Temperature derivative of density kg/(K*m**3)
   alpha(S,T,P)          Thermal expansion coefficient     1/K 
   drhods(S,T,P)         Salinity derivative of density    kg/m**3
   beta(S,T,P)           Salinity expansion coefficient
 Salinity related
   salt(R,T,P)           Salinity
   cond(S,T,P)           Conductivity ratio

 Heat related
   heatcap(S,T,P)        Heat capacity                     J/(kg*K)
   adtgrad(S,T,P)        Adiabatic lapse rate              K/dbar
   temppot(S,T,P,Pref)   Potential temperature             °C
   temppot0(S,T,P)       Potential temperature             °C
   freezept(S,P)         Freezing point                    °C
   soundvel(S,T,P)       Sound velocity                    m/s
   depth(P,lat)          Depth                             m

   S	                 Salinity                 
   T                     Temperature                       °C
   P                     Pressure                          dbar 
   R                     Conductivity ratio
   Pref                  Reference pressure                dbar
   lat                   Latitude                          deg

Test scripts

The test directory contains several test scripts. The script tests some standard values in the UNESCO 1983 report. The script prints out part of table A3.1 in the book by Gill (1982). To recreate the potential temperature values, the alternative function temppot0 implementing the algorithm from Bryden (1983) is used.

The scripts testdens, testsalt, testheat, and testmisc computes and prints tables from the UNESCO 1983 report.


The seawater package is written in pure Python and should work on any system. NumPy is not necessary, but highly recommended. To install the module, download the file seawater.tar.gz, unpack, and install by python's standard distribution utility,


Bryden, 1973
New polynomials for thermal expansion, adiabatic temperature gradient and potential temperature gradient of sea water, Deep-Sea Res. 20, 401-408
A. E. Gill, 1982
Atmosphere-Ocean Dynamics, Academic Press.
Tenth report of the joint panel on oceanographic tables and standards, Unesco technical papers in marine science, 36.
N.P. Fofonoff and R.C. Millard Jr., Algorithms for computation of fundamental properties of seawater, Unesco technical papers in marine science, 44. [pdf]

Bjørn Ådlandsvik (
Institute of Marine Research
Last modified: 19 December 2012

Valid XHTML 1.0! Valid CSS!