Preamble for stuff.


In [1]:
%matplotlib inline

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

This is my first notebook. I want to load a model run and do some $\zeta$ plots first. First read data,


In [2]:
dname = "runs/topoeddy/runew-03/"
print(dname)
fname = "".join([dname, "ocean_avg.nc"])
print(fname)
file = h5py.File(fname,'r')

zeta = file['zeta']


runs/topoeddy/runew-03/
runs/topoeddy/runew-03/ocean_avg.nc

Let's plot!


In [3]:
plt.contour(zeta[14,:,:],20)


Out[3]:
<matplotlib.contour.QuadContourSet instance at 0x2e4e830>

Let's try and read a .mat file. Turns out MAT files are HDF5 in their latest avatar. But h5py doesn't seem to like it so falling back on scipy.io


In [4]:
watername = "".join([dname,"watermass.mat"])
print(watername)

import scipy.io
water = scipy.io.loadmat(watername)
water = water["water"];


runs/topoeddy/runew-03/watermass.mat

Since I'm having trouble reading in structures from MAT files let's try looking at the jet.


In [21]:
u = file['u']
ubg = u[1,:,:,:]

ujet = u - ubg

In [24]:
ujet.shape


Out[24]:
(19, 40, 212, 401)

Trying mlab


In [101]:
import matplotlib.pyplot as plt
import numpy as np

x = np.random.randn(50)
f,axarr = plt.subplots(2,2, sharex=True)


plt.plot(x)
plt.xticks(np.arange(20)*2,('sd','ds','sd'));