In [1]:
import iris
import iris.plot as iplt
import iris.quickplot as qplt
import matplotlib.pyplot as plt

cube = iris.load_cube(iris.sample_data_path('A1B_north_america.nc'))
print cube.summary(True)


air_temperature / (K)               (time: 240; latitude: 37; longitude: 49)

Exercise 6: Use the a1b sample data ('A1B_north_america.nc'), with appropriate slicing, to produce the following:

1. a contour plot of longitude vs time


In [5]:
qplt.contour(cube[:, 0])
plt.show()


2. a contourf map (of the first timestep) on a LambertConformal projection (with coastlines)


In [7]:
import cartopy.crs as ccrs
ax = plt.axes(projection=ccrs.LambertConformal())
ax.coastlines()
iplt.contourf(cube[0])


Out[7]:
<matplotlib.contour.QuadContourSet instance at 0x110fa8638>

3. a block plot (pcolormesh) map (of the first timestep) in its native projection (with coastlines)


In [4]:
iplt.pcolormesh(cube[0])
plt.gca().coastlines()
plt.show()


4. a line plot showing forecast_period vs air_temperature for the first latitude and longitude points (hint: plot accepts two arguments for the x and y axes)


In [9]:
series = cube[:, 0, 0]
qplt.plot(series.coord('forecast_period'), series)
plt.show()


5. a scatter plot showing longitude vs air_temperature for the first time and latitude points


In [3]:
lon_slice = cube[0, 20, :]
qplt.scatter(lon_slice.coord('longitude'), lon_slice)
plt.show()