Revision: 6826
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6826&view=rev
Author:   jswhit
Date:     2009-01-25 14:38:48 +0000 (Sun, 25 Jan 2009)

Log Message:
-----------
add comments.

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

Modified: trunk/toolkits/basemap/examples/maskoceans.py
===================================================================
--- trunk/toolkits/basemap/examples/maskoceans.py       2009-01-25 14:29:31 UTC 
(rev 6825)
+++ trunk/toolkits/basemap/examples/maskoceans.py       2009-01-25 14:38:48 UTC 
(rev 6826)
@@ -3,6 +3,8 @@
 import matplotlib.pyplot as plt
 import matplotlib.mlab as mlab
 
+# example showing how to mask out 'wet' areas on a contour or pcolor plot.
+
 topodatin = mlab.load('etopo20data.gz')
 lonsin = mlab.load('etopo20lons.gz')
 latsin = mlab.load('etopo20lats.gz')
@@ -17,29 +19,31 @@
 lons, lats = np.meshgrid(lons1,lats1)
 x, y = m(lons, lats)
 # interpolate land/sea mask to topo grid, mask ocean values.
+# output may look 'blocky' near coastlines, since data is at much
+# lower resolution than land/sea mask.
 topo = maskoceans(lons, lats, topoin, inlands=False)
 # make contour plot (ocean values will be masked)
-#CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
-im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
+CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
+#im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
 # draw coastlines.
 m.drawcoastlines()
 plt.title('ETOPO data with marine areas masked (original grid)')
 
 fig=plt.figure()
 # interpolate topo data to higher resolution grid (to better match
-# the land/sea mask).
+# the land/sea mask). Output looks less 'blocky' near coastlines.
 nlats = 3*topoin.shape[0]
 nlons = 3*topoin.shape[1]
 lons = np.linspace(-180,180,nlons)
 lats = np.linspace(-90,90,nlats)
 lons, lats = np.meshgrid(lons, lats)
+x, y = m(lons, lats)
 topo = interp(topoin,lons1,lats1,lons,lats,order=1)
-x, y = m(lons, lats)
 # interpolate land/sea mask to topo grid, mask ocean values.
 topo = maskoceans(lons, lats, topo, inlands=False)
 # make contour plot (ocean values will be masked)
-#CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
-im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
+CS=m.contourf(x,y,topo,np.arange(-300,3001,50),cmap=plt.cm.jet,extend='both')
+#im=m.pcolormesh(x,y,topo,cmap=plt.cm.jet,vmin=-300,vmax=3000)
 # draw coastlines.
 m.drawcoastlines()
 plt.title('ETOPO data with marine areas masked (data on finer grid)')


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

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to