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

## netCDF via IRIS example
##  Live 8.5  *  darkblue-b
##

In [2]:
## Convert a DEM GeoTIFF to netCDF with gdal
!rm 'SanMateo_CA.cf'
!gdal_translate -of netcdf SanMateo_CA.tif SanMateo_CA.cf

## previously extracted from a large USGS DEM via
##   gdal_translate -projwin -122.44 37.7 -122.2 37.4 -of GTiff imgn38w123_1.img  SanMateo_CA.tif


rm: cannot remove ‘SanMateo_CA.cf’: No such file or directory
Input file size is 864, 1080
0...10...20...30...40...50...60...70...80...90...100 - done.

In [3]:
## Open the netCDF with IRIS
res = iris.load('SanMateo_CA.cf')

print ' TYPE: ', type(res)
print 'CUBES: ', res
print ' REPR: ', res[0]


 TYPE:  <class 'iris.cube.CubeList'>
CUBES:  0: GDAL Band Number 1 / (unknown)      (latitude: 1080; longitude: 864)
 REPR:  GDAL Band Number 1 / (unknown)      (latitude: 1080; longitude: 864)
     Dimension coordinates:
          latitude                           x                -
          longitude                          -                x
     Attributes:
          Conventions: CF-1.5
          GDAL: GDAL 1.11.1, released 2014/09/24
          GDAL_AREA_OR_POINT: Area
          LAYER_TYPE: athematic
          history: Sun Jan 25 20:16:47 2015: GDAL CreateCopy( SanMateo_CA.cf, ... )

In [17]:
## color visualization of elevation data using IRIS Quickplot
iplt.pcolormesh(res[0], cmap=plt.get_cmap('gist_earth'))
iplt.show()



In [18]:
contour = qplt.contour(res[0])

## use the center point for a quick demo
lon = -122.3200000
lat =   37.5500000

plt.scatter(lon, lat, marker=(5, 1), color='red', s=200)
plt.title("Welcome to San Mateo")

plt.show()



In [ ]: