from IPython.core.display import HTML
HTML('<iframe src=http://www.smast.umassd.edu:8080/thredds/hindcasts.html?dataset=fvcom/hindcasts/30yr_gom3 width=1000 height=600></iframe>')
import netCDF4
import matplotlib.pyplot as plt
import matplotlib.tri as tri
url = 'http://www.smast.umassd.edu:8080/thredds/dodsC/fvcom/hindcasts/30yr_gom3/mean'
nc = netCDF4.Dataset(url)
x = nc.variables['lon'][:]
y = nc.variables['lat'][:]
var = nc.variables['temp'][-1,-1,:] # [time, level, node]
# read connectivity array
nv= nc.variables['nv'][:,:]
nv= nv.T - 1 # 1-based => 0-based indexing of nodes
nc.close()
# define TRI object
triang = tri.Triangulation(x, y, triangles=nv)
# Tricontourf is fast
plt.figure(figsize=(18,10))
plt.gca().set_aspect(1./cos(42*pi/180))
plt.tricontourf(triang, var,levels=arange(0,20,1));
plt.colorbar();
#plt.tricontour(triang, var, colors='k',levels=arange(0,20,1))
plt.title('Bottom Temperature, December, 2010');
# Tripcolor is slow
plt.figure(figsize=(18,10))
plt.gca().set_aspect('equal')
plt.tripcolor(x, y, nv, var, shading='faceted')
plt.axis([-71.2, -70.5, 42.0, 42.5])
plt.colorbar()
plt.title('Bottom Temperature in December, 2010')
plt.xlabel('Longitude (degrees)')
plt.ylabel('Latitude (degrees)')
<matplotlib.text.Text at 0x3c36250>
from IPython.core.display import Image
Image('http://epi.whoi.edu/esr/Picture_ESRI.png')