Plotting a CF-1.6 Time Series file with Iris


In [1]:
import iris
import matplotlib.pyplot as plt
import iris.quickplot as qplt
%matplotlib inline

In [2]:
url='http://comt.sura.org/thredds/dodsC/comt_1_archive_full/inundation_tropical/observations/tropical/netcdf/Ike/NOAA/8729108_Panama_City_Ike_WL.nc'

In [3]:
cl = iris.load(url)

In [4]:
print cl


0: Predicted Water Level / (Meters)    (time: 7680)
1: station name / (no_unit)            (-- : 64)
2: Water Level / (Meters)              (time: 7680)

In [5]:
fig, ax = plt.subplots(figsize=(12, 3.5))
qplt.plot(cl[2], label=cl[2].name())
plt.grid()


You can also convert Iris cube object to a Pandas Series object


In [6]:
from iris.pandas import as_cube, as_series, as_data_frame
df = as_series(cl[2])
df.head()


Out[6]:
2008-08-20 00:00:00           0.082
2008-08-20 00:06:00.000018    0.089
2008-08-20 00:12:00           0.088
2008-08-20 00:18:00.000016    0.087
2008-08-20 00:24:00           0.088
dtype: float64

In [7]:
df.plot(figsize=(12,3.5));



In [8]:
df.describe()


Out[8]:
count    7680.000000
mean        0.269347
std         0.235647
min        -0.273000
25%         0.110000
50%         0.259000
75%         0.419000
max         1.076000
dtype: float64

In [8]: