0
# Seawater
1
2
A Python implementation of the CSIRO seawater toolbox for calculating properties of sea water using the EOS-80 equation of state. The package provides oceanographic calculations based on UNESCO 1981 and UNESCO 1983 formulas, supporting the fundamental properties and derived quantities needed for oceanographic research and marine science applications.
3
4
## Package Information
5
6
- **Package Name**: seawater
7
- **Language**: Python
8
- **Installation**: `pip install seawater`
9
10
## Core Imports
11
12
```python
13
import seawater as sw
14
```
15
16
Import specific functions:
17
18
```python
19
from seawater import dens, svel, ptmp, salt
20
```
21
22
## Basic Usage
23
24
```python
25
import seawater as sw
26
import numpy as np
27
28
# Define oceanographic conditions
29
salinity = 35.0 # psu (PSS-78)
30
temperature = 15.0 # °C (ITS-90)
31
pressure = 100.0 # db (decibars)
32
latitude = 45.0 # degrees
33
34
# Calculate basic seawater properties
35
density = sw.dens(salinity, temperature, pressure)
36
sound_velocity = sw.svel(salinity, temperature, pressure)
37
potential_temperature = sw.ptmp(salinity, temperature, pressure)
38
39
print(f"Density: {density:.3f} kg/m³")
40
print(f"Sound velocity: {sound_velocity:.2f} m/s")
41
print(f"Potential temperature: {potential_temperature:.3f} °C")
42
43
# Calculate depth from pressure
44
depth = sw.dpth(pressure, latitude)
45
print(f"Depth: {depth:.1f} m")
46
47
# Calculate potential density at surface reference
48
pot_density = sw.pden(salinity, temperature, pressure, pr=0)
49
print(f"Potential density: {pot_density:.3f} kg/m³")
50
```
51
52
## Architecture
53
54
The seawater library organizes oceanographic calculations into distinct functional modules:
55
56
- **Core EOS-80 functions**: Fundamental equation of state calculations for density, temperature, pressure relationships
57
- **Geostrophic calculations**: Ocean current and circulation analysis including Brünt-Väisälä frequency and geostrophic velocities
58
- **Auxiliary functions**: Distance calculations, gas solubilities, and Coriolis effects
59
- **Library support**: Low-level conductivity conversions and temperature scale transformations
60
61
All functions support NumPy array inputs with broadcasting, enabling efficient processing of oceanographic datasets while maintaining compatibility with MATLAB's SEAWATER-3.3 toolbox.
62
63
## Capabilities
64
65
### Core EOS-80 Functions
66
67
Fundamental equation of state calculations for seawater density, temperature, pressure, and salinity relationships. These functions implement the UNESCO 1983 algorithms that form the foundation of oceanographic property calculations.
68
69
```python { .api }
70
def dens(s, t, p): ...
71
def dens0(s, t): ...
72
def pden(s, t, p, pr=0): ...
73
def ptmp(s, t, p, pr=0): ...
74
def temp(s, pt, p, pr=0): ...
75
def salt(r, t, p): ...
76
def svel(s, t, p): ...
77
def cp(s, t, p): ...
78
def alpha(s, t, p, *, pt=False): ...
79
def beta(s, t, p, *, pt=False): ...
80
```
81
82
[Core EOS-80 Functions](./core-eos80.md)
83
84
### Geostrophic and Dynamic Calculations
85
86
Ocean circulation and dynamic oceanography calculations including geostrophic velocities, Brünt-Väisälä frequency, and potential vorticity analysis for understanding ocean currents and stability.
87
88
```python { .api }
89
def bfrq(s, t, p, lat=None): ...
90
def svan(s, t, p=0): ...
91
def gpan(s, t, p): ...
92
def gvel(ga, lat, lon): ...
93
```
94
95
[Geostrophic Functions](./geostrophic.md)
96
97
### Auxiliary and Environmental Functions
98
99
Additional oceanographic calculations including distance and bearing calculations, gas solubilities, Coriolis effects, and wave velocities for comprehensive marine environment analysis.
100
101
```python { .api }
102
def dist(lat, lon, units="km"): ...
103
def f(lat): ...
104
def satO2(s, t): ...
105
def satN2(s, t): ...
106
def satAr(s, t): ...
107
def swvel(length, depth): ...
108
```
109
110
[Auxiliary Functions](./auxiliary.md)
111
112
### Support and Conversion Functions
113
114
Low-level support functions for conductivity calculations, temperature scale conversions, and specialized oceanographic computations that support the main EOS-80 calculations.
115
116
```python { .api }
117
def cndr(s, t, p): ...
118
def salds(rtx, delt): ...
119
def salrp(r, t, p): ...
120
def salrt(t): ...
121
def sals(rt, t): ...
122
def smow(t): ...
123
def seck(s, t, p=0): ...
124
def T68conv(T90): ...
125
def T90conv(t, t_type="T68"): ...
126
```
127
128
[Support Functions](./support.md)
129
130
## Constants
131
132
Physical and oceanographic constants used throughout the calculations:
133
134
```python { .api }
135
# Gravity and Earth parameters
136
gdef = 9.8 # m/s²
137
earth_radius = 6371000.0 # m
138
OMEGA = 7.292e-5 # rad/s
139
140
# Unit conversions
141
db2Pascal = 1e4
142
Kelvin = 273.15
143
DEG2NM = 60.0
144
NM2KM = 1.8520
145
deg2rad = π/180.0
146
rad2deg = 180.0/π
147
148
# Reference conductivity
149
c3515 = 42.914 # S/m at S=35 psu, T=15°C, P=0 dbar
150
```
151
152
## Common Parameter Patterns
153
154
Standard parameter conventions used across all functions:
155
156
- `s` - Salinity [psu (PSS-78)]
157
- `t` - Temperature [°C (ITS-90)]
158
- `p` - Pressure [db (decibars)]
159
- `lat` - Latitude [decimal degrees]
160
- `lon` - Longitude [decimal degrees]
161
- `depth` - Depth [meters]
162
- `pr` - Reference pressure [db], defaults to 0 (surface)
163
164
## Temperature Scale Notes
165
166
The library uses the ITS-90 temperature scale for all input and output temperatures. Temperature scale conversions from legacy oceanographic data (IPTS-68, IPTS-48) are handled internally by the library functions when needed for compatibility with historical algorithms.
167
168
## Deprecation Warning
169
170
**Important**: The seawater library is deprecated in favor of the GSW (Gibbs SeaWater) library which implements the more modern TEOS-10 equation of state. This library is maintained for compatibility with legacy scripts and to facilitate transition to TEOS-10.