Revision: 4737
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4737&view=rev
Author:   jswhit
Date:     2007-12-14 16:12:13 -0800 (Fri, 14 Dec 2007)

Log Message:
-----------
add ice to plot.

Modified Paths:
--------------
    trunk/toolkits/basemap/examples/plotsst.py

Modified: trunk/toolkits/basemap/examples/plotsst.py
===================================================================
--- trunk/toolkits/basemap/examples/plotsst.py  2007-12-14 21:16:38 UTC (rev 
4736)
+++ trunk/toolkits/basemap/examples/plotsst.py  2007-12-15 00:12:13 UTC (rev 
4737)
@@ -1,12 +1,14 @@
 from matplotlib.toolkits.basemap import Basemap, NetCDFFile
 import pylab, numpy
-# read in sea-surface temperature data
+# read in sea-surface temperature and ice data
 # can be a local file, a URL for a remote opendap dataset,
 # or (if PyNIO is installed) a GRIB or HDF file.
 ncfile = 
NetCDFFile('http://nomads.ncdc.noaa.gov:8085/thredds/dodsC/oisst/2007/AVHRR/sst4-navy-eot.20071201.nc')
 # read sst.  Will automatically create a masked array using
 # missing_value variable attribute.
 sst = ncfile.variables['sst'][:]
+# read ice.
+ice = ncfile.variables['ice'][:]
 # read lats and lons (representing centers of grid boxes).
 lats = ncfile.variables['lat'][:]
 lons = ncfile.variables['lon'][:]
@@ -30,12 +32,13 @@
 # color background of map projection region.
 # missing values over land will show up this color.
 m.drawmapboundary(fill_color='0.3')
-# plot with pcolor
-im = m.pcolor(x,y,sst,shading='flat',cmap=pylab.cm.gist_ncar)
+# plot ice, then with pcolor
+im1 = m.pcolor(x,y,sst,shading='flat',cmap=pylab.cm.gist_ncar)
+im2 = m.pcolor(x,y,ice,shading='flat',cmap=pylab.cm.gist_gray)
 # draw parallels and meridians, but don't bother labelling them.
 m.drawparallels(numpy.arange(-90.,120.,30.))
 m.drawmeridians(numpy.arange(0.,420.,60.))
 # draw horizontal colorbar.
-pylab.colorbar(orientation='horizontal')
+pylab.colorbar(im1,orientation='horizontal')
 # display the plot.
 pylab.show()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to