In [ ]:
from IPython.core.display import HTML

with open('../../common/creativecommons.html', 'r') as f:
    html = f.read()
    
with open('../../common/custom.css', 'r') as f:
    styles = f.read()
    
HTML(styles)

name = "temperature_contour"
text = 'Check this post at'
url = 'http://nbviewer.ipython.org/urls/raw.github.com/'
url += 'ocefpaf/python4oceanographers/master/content/downloads/notebooks'
link = """<p>%s <a href="%s/%s"><em>nbviewer</em>.</a></p>""" % (text, url, name)
html += str(link)

In [ ]:
%matplotlib inline

import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt

In [ ]:
depth = np.loadtxt('temp_fullset.dat', usecols=(0,))
dist = np.arange(1, 14)  # km ?
temp = np.loadtxt('temp_fullset.dat', usecols=range(1, 14))
temp = ma.masked_invalid(temp)

In [ ]:
fig, ax = plt.subplots()
cs = ax.contour(dist, depth, temp, colors='k')
ax.clabel(cs, fmt='%2.1f')
ax.invert_yaxis()
fig.savefig("solution.png")

In [ ]:
levels = [6.0, 6.5, 7.0, 7.5, 8.0, 8.5]
fig, ax = plt.subplots()
cs = ax.contour(dist, depth, temp, colors='k', levels=levels)
ax.clabel(cs, fmt='%2.1f')
ax.invert_yaxis()

In [ ]:
fig, ax = plt.subplots()
cs = ax.contourf(dist, depth, temp)
ax.invert_yaxis()
_ = fig.colorbar(cs)

In [ ]:
fig, ax = plt.subplots()
cs = ax.pcolormesh(dist, depth, temp)
ax.invert_yaxis()
_ = fig.colorbar(cs)

In [ ]:
HTML(html)