Annotated TS-diagram

In [1]:
import gsw
import numpy as np

Te = np.linspace(0, 13, 25)
Se = np.linspace(34.4, 35.4, 25)

Tg, Sg = np.meshgrid(Te, Se)
sigma_theta = gsw.sigma0(Sg, Tg)
cnt = np.linspace(sigma_theta.min(), sigma_theta.max(), 10)
In [2]:
import pandas as pd

df = pd.read_csv('data/water_mass.csv', index_col='p')
df
SPCT
p
0.035.23943712.669123
20.035.26552312.557223
50.035.29410412.129957
100.035.30103811.044503
150.035.22239610.271577
250.034.9351778.331906
400.034.7169156.418602
600.034.5142374.232079
800.034.4615893.018598
1000.034.5067342.473099
1200.034.5879032.271567
1400.034.6678302.161632
1750.034.7555791.969424
2500.034.8010341.565978
3500.034.7712110.923388
4500.034.7025010.104218
In [3]:
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator


fig, ax = plt.subplots(figsize=(7, 7))

cs = ax.contour(Sg, Tg, sigma_theta, colors='grey', levels=cnt, zorder=1)
kw = dict(color='blue', fontsize=14, fontweight='black')
ax.text(35.00, 11.9, 'SACW', **kw)
ax.text(34.50, 3.12, 'AAIW', **kw)
ax.text(34.82, 1.72, 'NADW', **kw)

kw = dict(color='darkorange', linestyle="none", marker='*')
ax.plot(df['SP'], df['CT'], **kw)
ax.set_xlabel('Salinity [g kg$^{-1}$]')
ax.set_ylabel('Temperature [$^\circ$C]')
ax.set_title('T-S Diagram')
ax.xaxis.set_major_locator(MaxNLocator(nbins=5))

png