Revision: 4337
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4337&view=rev
Author:   jswhit
Date:     2007-11-16 08:54:58 -0800 (Fri, 16 Nov 2007)

Log Message:
-----------
replace ireland.py example with hires.py

Modified Paths:
--------------
    trunk/toolkits/basemap-testing/examples/README
    trunk/toolkits/basemap-testing/examples/hires.py

Removed Paths:
-------------
    trunk/toolkits/basemap-testing/examples/ireland.py

Modified: trunk/toolkits/basemap-testing/examples/README
===================================================================
--- trunk/toolkits/basemap-testing/examples/README      2007-11-16 15:58:05 UTC 
(rev 4336)
+++ trunk/toolkits/basemap-testing/examples/README      2007-11-16 16:54:58 UTC 
(rev 4337)
@@ -25,15 +25,12 @@
 
 nytolondon.py shows how to draw a great circle on a map (NY to London)
 
-hires.py illustrates the use of the optional high-resolution coastlines, by
-drawing the coastlines, political boundaries and rivers of the British Isles.
+hires.py illustrates the use of the high-resolution coastlines, by
+drawing the coastlines, political boundaries and rivers of the British
+Isles. Shows how to pickle and re-load a Basemap class instance (useful
+for high-res coastlines when you are plotting the same small map region
+many times in different scripts).
 
-ireland.py draws maps of ireland with the crude, low and intermediate
-resolution boundary datasets. Also does high res coastlines if they
-are installed. Shows how to pickle and re-load a
-Basemap class instance (useful for high-res coastlines when you are plotting
-the same small map region many times in different scripts).
-
 quiver_demo.py shows how to plot wind vectors on a map.
 
 randompoints.py demonstrates the use of scatter to plot randomly distributed

Modified: trunk/toolkits/basemap-testing/examples/hires.py
===================================================================
--- trunk/toolkits/basemap-testing/examples/hires.py    2007-11-16 15:58:05 UTC 
(rev 4336)
+++ trunk/toolkits/basemap-testing/examples/hires.py    2007-11-16 16:54:58 UTC 
(rev 4337)
@@ -1,16 +1,28 @@
 from matplotlib.toolkits.basemap import Basemap
-from pylab import *
-import time
+from pylab import show, title, arange, figure, clf
+import cPickle, time
 
-# create new figure
-fig=figure()
-# background color will be used for 'wet' areas.
-fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
+# create figure with aqua background (will be oceans)
+fig = figure()
+
 # create Basemap instance. Use 'high' resolution coastlines.
 t1 = time.clock()
 m = Basemap(llcrnrlon=-11.,llcrnrlat=49.,urcrnrlon=5.,urcrnrlat=59.,
-            resolution='h',projection='tmerc',lon_0=-8.,lat_0=0.)
-print 'time to create instance with high-res boundaries = ',time.clock()-t1
+            resolution='h',projection='tmerc',lon_0=-8,lat_0=0)
+# make sure countries and rivers are loaded
+m.drawcountries()
+m.drawrivers()
+print time.clock()-t1,' secs to create original Basemap instance'
+
+# cPickle the class instance.
+cPickle.dump(m,open('map.pickle','wb'),-1)
+
+# clear the figure
+clf()
+ax = fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
+# read cPickle back in and plot it again (should be much faster).
+t1 = time.clock()
+m2 = cPickle.load(open('map.pickle','rb'))
 # draw coastlines and fill continents.
 m.drawcoastlines()
 m.fillcontinents(color='coral')
@@ -18,6 +30,7 @@
 m.drawcountries(linewidth=1)
 # draw major rivers.
 m.drawrivers(color='b')
+print time.clock()-t1,' secs to plot using using a pickled Basemap instance'
 # draw parallels
 circles = arange(48,65,2).tolist()
 m.drawparallels(circles,labels=[1,1,0,0])

Deleted: trunk/toolkits/basemap-testing/examples/ireland.py
===================================================================
--- trunk/toolkits/basemap-testing/examples/ireland.py  2007-11-16 15:58:05 UTC 
(rev 4336)
+++ trunk/toolkits/basemap-testing/examples/ireland.py  2007-11-16 16:54:58 UTC 
(rev 4337)
@@ -1,144 +0,0 @@
-from matplotlib.toolkits.basemap import Basemap, basemap_datadir
-from pylab import show, title, arange, figure, draw, ion, ioff, clf
-import cPickle, time, sys, os
-
-# turn interactive mode on.
-ion()
-# create new figure
-fig=figure()
-# create Basemap instance. Use 'crude' resolution coastlines.
-m = Basemap(llcrnrlon=-11.,llcrnrlat=50.5,urcrnrlon=-5.,urcrnrlat=56.,
-            resolution='c',projection='tmerc',lon_0=-8.,lat_0=0.)
-# draw coastlines and fill continents.
-m.drawcoastlines()
-m.fillcontinents()
-# draw political boundaries.
-m.drawcountries()
-# draw parallels
-circles = arange(50,60,1).tolist()
-m.drawparallels(circles,labels=[1,1,0,0])
-# draw meridians
-meridians = arange(-12,0,1)
-m.drawmeridians(meridians,labels=[0,0,1,1])
-print 'plotting with crude res boundaries ...'
-title("Crude Res Boundaries ('c')",y=1.05)
-draw()
-time.sleep(5)
-
-# create new figure
-#fig=figure()
-clf()
-# create Basemap instance. Use 'low' resolution coastlines.
-m = Basemap(llcrnrlon=-11.,llcrnrlat=50.5,urcrnrlon=-5.,urcrnrlat=56.,
-            resolution='l',projection='tmerc',lon_0=-8.,lat_0=0.)
-# draw coastlines and fill continents.
-m.drawcoastlines()
-m.fillcontinents()
-# draw political boundaries.
-m.drawcountries()
-# draw parallels
-m.drawparallels(circles,labels=[1,1,0,0])
-# draw meridians
-m.drawmeridians(meridians,labels=[0,0,1,1])
-print 'plotting with low res boundaries ...'
-title("Low Res Boundaries ('l')",y=1.05)
-draw()
-time.sleep(5)
-
-t1 = time.clock()
-# create new figure
-#fig=figure()
-clf()
-print 'plotting with intermediate res boundaries ...'
-# create Basemap instance. Use 'intermediate' resolution coastlines.
-m = Basemap(llcrnrlon=-11.,llcrnrlat=50.5,urcrnrlon=-5.,urcrnrlat=56.,
-            resolution='i',projection='tmerc',lon_0=-8.,lat_0=0.)
-print time.clock()-t1,'seconds to create class instance with intermediate res 
coastlines'
-# cPickle the class instance.
-cPickle.dump(m,open('map.pickle','wb'),-1)
-# draw coastlines and fill continents.
-m.drawcoastlines()
-m.fillcontinents()
-# draw political boundaries.
-m.drawcountries()
-# draw parallels
-m.drawparallels(circles,labels=[1,1,0,0])
-# draw meridians
-m.drawmeridians(meridians,labels=[0,0,1,1])
-title("Intermediate Res Boundaries ('i')",y=1.05)
-draw()
-time.sleep(5)
-
-# create new figure
-#fig=figure()
-clf()
-# read cPickle back in and plot it again (should be much faster).
-t1 = time.clock()
-m2 = cPickle.load(open('map.pickle','rb'))
-print time.clock()-t1,' to read the intermediate res coastline class instance 
back in from a cPickle'
-# draw coastlines and fill continents.
-m2.drawcoastlines()
-m2.fillcontinents()
-# draw political boundaries.
-m2.drawcountries(linewidth=1.0)
-# draw major rivers.
-m2.drawrivers(color='b')
-# draw parallels
-m2.drawparallels(circles,labels=[1,1,0,0])
-# draw meridians
-m2.drawmeridians(meridians,labels=[0,0,1,1])
-print 'plotting with intermediate res boundaries from a saved pickle ...'
-title("Intermediate Res Boundaries ('i') with major rivers",y=1.05)
-draw()
-time.sleep(5)
-# only do high-res coastlines if they are installed, otherwise stop here.
-if not os.path.isfile(os.path.join(basemap_datadir,'gshhs_h.dat')):
-    sys.exit(0)
-
-import time
-t1 = time.clock()
-# create new figure
-#fig=figure()
-clf()
-print 'plotting with high res boundaries ...'
-# create Basemap instance. Use 'high' resolution coastlines.
-m = Basemap(llcrnrlon=-11.,llcrnrlat=50.5,urcrnrlon=-5.,urcrnrlat=56.,
-            resolution='h',projection='tmerc',lon_0=-8.,lat_0=0.)
-print time.clock()-t1,'seconds to create class instance with high res 
coastlines'
-# cPickle the class instance.
-cPickle.dump(m,open('map.pickle','wb'),-1)
-# draw coastlines and fill continents.
-m.drawcoastlines()
-m.fillcontinents()
-# draw political boundaries.
-m.drawcountries()
-# draw parallels
-m.drawparallels(circles,labels=[1,1,0,0])
-# draw meridians
-m.drawmeridians(meridians,labels=[0,0,1,1])
-title("High Res Boundaries ('i')",y=1.05)
-draw()
-time.sleep(5)
-
-# create new figure
-#fig=figure()
-clf()
-# read cPickle back in and plot it again (should be much faster).
-t1 = time.clock()
-m2 = cPickle.load(open('map.pickle','rb'))
-print time.clock()-t1,' to read the high res coastline class instance back in 
from a cPickle'
-# draw coastlines and fill continents.
-m2.drawcoastlines()
-m2.fillcontinents()
-# draw political boundaries.
-m2.drawcountries(linewidth=1.0)
-# draw major rivers.
-m2.drawrivers(color='b')
-# draw parallels
-m2.drawparallels(circles,labels=[1,1,0,0])
-# draw meridians
-m2.drawmeridians(meridians,labels=[0,0,1,1])
-print 'plotting with high res boundaries from a saved pickle ...'
-title("High Res Boundaries ('i') with major rivers",y=1.05)
-ioff()
-show()


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to