from pylab import * from matplotlib.toolkits.basemap import Basemap,shiftgrid def contour(lon,lat,x): """ Makes a contour map of field x, with coastlines overlayed lon is 1-d array of longitudes in INCREASING order lat is 1-d array of latitudes in INCREASING order x is a 2-d array of data to plot, arranged as lat lon x[ : , : ] """ map = Basemap(projection='cyl', llcrnrlon=lon[0], urcrnrlon=lon[-1], llcrnrlat=lat[0], urcrnrlat=lat[-1], resolution='c') Lon, Lat = map(*meshgrid(lon,lat)) map.contourf(Lon,Lat,x) map.drawcoastlines() # draw coastlines map.drawmapboundary() # draw a line around the map region map.drawparallels(arange(-90.,90.,10.)) # draw parallels map.drawmeridians(arange(-360.,360.,10.)) # draw meridians colorbar(orientation='horizontal') # draw colorbar