SF.net SVN: matplotlib: [4380] trunk/toolkits/basemap-testing/lib/ matplotlib/toolkits/basemap/basemap.py
Revision: 4380
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4380&view=rev
Author: jswhit
Date: 2007-11-19 05:10:49 -0800 (Mon, 19 Nov 2007)
Log Message:
---
more minor reformatting
Modified Paths:
--
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
Modified:
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
===
--- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
2007-11-18 20:54:22 UTC (rev 4379)
+++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
2007-11-19 13:10:49 UTC (rev 4380)
@@ -1,10 +1,10 @@
from matplotlib import rcParams
-from matplotlib import __version__ as matplotlib_version
+from matplotlib import __version__ as _matplotlib_version
# check to make sure matplotlib is not too old.
-mpl_required_version = '0.90'
-if matplotlib_version < mpl_required_version:
+_mpl_required_version = '0.90'
+if _matplotlib_version < _mpl_required_version:
raise ImportError('your matplotlib is too old - basemap '
- 'requires at least %s, you have
%s'%(mpl_required_version,matplotlib_version))
+'requires version %s or higher'% _matplotlib_version)
from matplotlib.collections import LineCollection
from matplotlib.patches import Ellipse, Circle, Polygon
from matplotlib.lines import Line2D
@@ -49,8 +49,8 @@
'gnom' : 'Gnomonic',
}
supported_projections = []
-for k,v in _projnames.iteritems():
- supported_projections.append("'%s' = %s\n" % (k,v))
+for _items in _projnames.iteritems():
+ supported_projections.append("'%s' = %s\n" % (_items))
supported_projections = ''.join(supported_projections)
# The __init__ docstring is pulled out here because it is so long;
@@ -61,8 +61,8 @@
arguments:
- projection - map projection. Supported projections are:\n"""+\
-supported_projections+"""
+ projection - map projection. Supported projections are:
+%(supported_projections)s
Default is 'cyl'.
The map projection region can either be specified by setting these keywords:
@@ -94,7 +94,7 @@
'l' (low), 'i' (intermediate), 'h' (high), 'f' (full) or None.
If None, no boundary data will be read in (and class methods
such as drawcoastlines will raise an exception if invoked).
- Resolution drops off by roughly 80%
+ Resolution drops off by roughly 80%%
between datasets. Higher res datasets are much slower to draw.
Default 'c'. Coastline data is from the GSHHS
(http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html).
@@ -161,7 +161,7 @@
latitude circle boundinglat is tangent to the edge of the map at lon_0.
satellite_height - height of satellite (in m) above equator -
only relevant for geostationary projections ('geos').
-"""
+""" % locals()
# unsupported projection error message.
_unsupported_projection = ["'%s' is an unsupported projection.\n"]
@@ -191,7 +191,7 @@
Useful instance variables:
projection - map projection. Print the module variable
-"supported_projections" to see a list of supported projections.
+"supported_projections" to see a list.
aspect - map aspect ratio (size of y dimension / size of x dimension).
llcrnrlon - longitude of lower left hand corner of the desired map domain.
llcrnrlon - latitude of lower left hand corner of the desired map domain.
@@ -245,7 +245,7 @@
boundinglat=None,
anchor='C',
ax=None):
-# docstring is added after definition
+# docstring is added after __init__ method definition
# where to put plot in figure (default is 'C' or center)
self.anchor = anchor
@@ -281,7 +281,7 @@
_insert_validated(projparams, lon_2, 'lon_2', -360, 720)
if satellite_height is not None:
projparams['h'] = satellite_height
-
+# check for sane values of projection corners.
using_corners = (None not in [llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat])
if using_corners:
self.llcrnrlon = _validated_ll(llcrnrlon, 'llcrnrlon', -360, 720)
@@ -292,6 +292,7 @@
# for each of the supported projections,
# compute lat/lon of domain corners
# and set values in projparams dict as needed.
+
if projection in ['lcc', 'eqdc', 'aea']:
# if lat_0 is given, but not lat_1,
# set lat_1=lat_0
@@ -310,9 +311,6 @@
llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat =
_choosecorners(width,height,**projparams)
self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
-
-# skipping over the following for now; it can be beautified and
-# consolidated later
elif projection == 'stere':
if lat_0 is None or lon_0 is None:
SF.net SVN: matplotlib: [4381] trunk/toolkits/basemap-testing/lib/ matplotlib/toolkits/basemap/basemap.py
Revision: 4381
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4381&view=rev
Author: jswhit
Date: 2007-11-19 05:14:53 -0800 (Mon, 19 Nov 2007)
Log Message:
---
run reindent.py
Modified Paths:
--
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
Modified:
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
===
--- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
2007-11-19 13:10:49 UTC (rev 4380)
+++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
2007-11-19 13:14:53 UTC (rev 4381)
@@ -49,8 +49,8 @@
'gnom' : 'Gnomonic',
}
supported_projections = []
-for _items in _projnames.iteritems():
- supported_projections.append("'%s' = %s\n" % (_items))
+for _items in _projnames.iteritems():
+supported_projections.append("'%s' = %s\n" % (_items))
supported_projections = ''.join(supported_projections)
# The __init__ docstring is pulled out here because it is so long;
@@ -91,7 +91,7 @@
but if they are not, the entire globe is plotted.
resolution - resolution of boundary database to use. Can be 'c' (crude),
- 'l' (low), 'i' (intermediate), 'h' (high), 'f' (full) or None.
+ 'l' (low), 'i' (intermediate), 'h' (high), 'f' (full) or None.
If None, no boundary data will be read in (and class methods
such as drawcoastlines will raise an exception if invoked).
Resolution drops off by roughly 80%%
@@ -289,8 +289,8 @@
self.llcrnrlat = _validated_ll(llcrnrlat, 'llcrnrlat', -90, 90)
self.urcrnrlat = _validated_ll(urcrnrlat, 'urcrnrlat', -90, 90)
-# for each of the supported projections,
-# compute lat/lon of domain corners
+# for each of the supported projections,
+# compute lat/lon of domain corners
# and set values in projparams dict as needed.
if projection in ['lcc', 'eqdc', 'aea']:
@@ -302,7 +302,7 @@
if lat_1 is None or lon_0 is None:
raise ValueError('must specify lat_1 or lat_0 and lon_0 for
%(projection)s basemap (lat_2 is optional)' % _projnames)
if lat_2 is None:
- projparams['lat_2'] = lat_1
+projparams['lat_2'] = lat_1
if not using_corners:
if width is None or height is None:
raise ValueError, 'must either specify lat/lon values of
corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height
in meters'
@@ -475,7 +475,7 @@
# initialize proj4
proj =
Proj(projparams,self.llcrnrlon,self.llcrnrlat,self.urcrnrlon,self.urcrnrlat)
-
+
# make sure axis ticks are suppressed.
self.noticks = suppress_ticks
@@ -571,12 +571,12 @@
dist = npy.sqrt(xd+yd)
split = dist > 500.
if npy.sum(split) and self.projection not in
['merc','cyl','mill']:
- ind =
(npy.compress(split,squeeze(split*npy.indices(xd.shape)))+1).tolist()
- iprev = 0
- ind.append(len(xd))
- for i in ind:
- coastsegs.append(zip(x[iprev:i],y[iprev:i]))
- iprev = i
+ind =
(npy.compress(split,squeeze(split*npy.indices(xd.shape)))+1).tolist()
+iprev = 0
+ind.append(len(xd))
+for i in ind:
+coastsegs.append(zip(x[iprev:i],y[iprev:i]))
+iprev = i
else:
coastsegs.append(seg)
self.coastsegs = coastsegs
@@ -619,7 +619,7 @@
msg = dedent("""
Unable to open boundary dataset file. Only the 'crude', 'low',
'intermediate' and 'high' resolution datasets are installed by default.
-If you are requesting a 'full' resolution dataset, you may need to
+If you are requesting a 'full' resolution dataset, you may need to
download and install those files separately
(see the basemap README for details).""")
try:
@@ -649,7 +649,7 @@
# make sure orthographic projection has containsPole=True
# we will compute the intersections in stereographic
# coordinates, then transform to orthographic.
-if self.projection == 'ortho' and name == 'gshhs':
+if self.projection == 'ortho' and name == 'gshhs':
containsPole = True
lon_0=self.projparams['lon_0']
lat_0=self.projparams['lat_0']
@@ -674,7 +674,7 @@
offsetbytes = int(linesplit[5])
bytecount = int(linesplit[6])
bdatfile.seek(offsetbytes,0)
-# read in binary string convert into an npts by 2
+# read in binary string convert into an npts
SF.net SVN: matplotlib: [4382] trunk/toolkits/basemap-testing/lib/ matplotlib/toolkits/basemap/proj.py
Revision: 4382 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4382&view=rev Author: jswhit Date: 2007-11-19 05:17:02 -0800 (Mon, 19 Nov 2007) Log Message: --- run reindent.py Modified Paths: -- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py === --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py 2007-11-19 13:14:53 UTC (rev 4381) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py 2007-11-19 13:17:02 UTC (rev 4382) @@ -341,4 +341,3 @@ assert (lons==lonlat[...,0]).all(), "The longitudes are different" assert (lats==lonlat[...,1]).all(), "The latitudes are different" - 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/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4383] trunk/matplotlib/lib/matplotlib
Revision: 4383 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4383&view=rev Author: jdh2358 Date: 2007-11-19 13:43:24 -0800 (Mon, 19 Nov 2007) Log Message: --- fixed a minor bug in csv2rec Modified Paths: -- trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/axes.py === --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-19 13:17:02 UTC (rev 4382) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-19 21:43:24 UTC (rev 4383) @@ -3313,7 +3313,7 @@ self.hold(holdstate) # restore previous hold state if adjust_xlim: -xmin, xmax = self.dataLim.intervalx().get_bounds() +xmin, xmax = self.dataLim.intervalx().get_bounds() xmin = npy.amin(width) if xerr is not None: xmin = xmin - npy.amax(xerr) Modified: trunk/matplotlib/lib/matplotlib/mlab.py === --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-19 13:17:02 UTC (rev 4382) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-19 21:43:24 UTC (rev 4383) @@ -44,7 +44,7 @@ compute it for a lot of pairs. This function is optimized to do this efficiently by caching the direct FFTs. -= record array helper functions = += record array helper functions = rec2csv : store record array in CSV file rec2excel: store record array in excel worksheet - required pyExcelerator @@ -1261,8 +1261,6 @@ def splitfunc(x): return x.split(delimiter) - - converterseq = None for i,line in enumerate(fh): if i symbol self.model.clear() @@ -2596,7 +2595,7 @@ thisiter = self.iterd[key] self.model.remove(thisiter) del self.datad[key] -del self.iterd[key] +del self.iterd[key] self.iters.remove(thisiter) for i, thisiter in enumerate(self.iters): @@ -2611,7 +2610,7 @@ del self.datad[key] -del self.iterd[key] +del self.iterd[key] self.rownumd[len(self.iters)] = key self.iters.remove(thisiter) @@ -2619,7 +2618,7 @@ if thiskey==key: del self.rownumd[rownum] def add_row(self, row): -thisiter = self.model.append() +thisiter = self.model.append() self.model.set(thisiter, *self.flat(row)) key = tuple(row) self.datad[key] = row @@ -2702,7 +2701,7 @@ win.add(scroll) win.show_all() scroll.win = win - + return scroll 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/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4384] trunk/toolkits/basemap-testing/lib/ matplotlib/toolkits/basemap/basemap.py
Revision: 4384 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4384&view=rev Author: jswhit Date: 2007-11-19 18:37:12 -0800 (Mon, 19 Nov 2007) Log Message: --- lake_color keyword arg to fill continents added Modified Paths: -- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py === --- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-19 21:43:24 UTC (rev 4383) +++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-20 02:37:12 UTC (rev 4384) @@ -991,11 +991,12 @@ # set axes limits to fit map region. self.set_axes_limits(ax=ax) -def fillcontinents(self,color='0.8',ax=None,zorder=None): +def fillcontinents(self,color='0.8',lake_color=None,ax=None,zorder=None): """ Fill continents. color - color to fill continents (default gray). +lake_color - color to fill inland lakes (default axes background). ax - axes instance (overrides default axes instance). zorder - sets the zorder for the continent polygons (if not specified, uses default zorder for a Polygon patch). Set to zero if you want to paint @@ -1038,8 +1039,11 @@ xy = zip(xa.tolist(),ya.tolist()) if self.coastpolygontypes[np] != 2: poly = Polygon(xy,facecolor=color,edgecolor=color,linewidth=0) -else: # lakes filled with background color. -poly = Polygon(xy,facecolor=axisbgc,edgecolor=axisbgc,linewidth=0) +else: # lakes filled with background color by default +if lake_color is None: +poly = Polygon(xy,facecolor=axisbgc,edgecolor=axisbgc,linewidth=0) +else: +poly = Polygon(xy,facecolor=lake_color,edgecolor=lake_color,linewidth=0) if zorder is not None: poly.set_zorder(zorder) ax.add_patch(poly) 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/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4385] trunk/toolkits/basemap-testing/examples/ show_colormaps.py
Revision: 4385
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4385&view=rev
Author: jswhit
Date: 2007-11-19 20:08:52 -0800 (Mon, 19 Nov 2007)
Log Message:
---
change outerproduct to outer
Modified Paths:
--
trunk/toolkits/basemap-testing/examples/show_colormaps.py
Modified: trunk/toolkits/basemap-testing/examples/show_colormaps.py
===
--- trunk/toolkits/basemap-testing/examples/show_colormaps.py 2007-11-20
02:37:12 UTC (rev 4384)
+++ trunk/toolkits/basemap-testing/examples/show_colormaps.py 2007-11-20
04:08:52 UTC (rev 4385)
@@ -1,16 +1,16 @@
-from pylab import *
+import numpy, pylab
from matplotlib.toolkits.basemap import cm
-a=outerproduct(arange(0,1,0.01),ones(10))
-figure(figsize=(10,7))
-subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)
+a=numpy.outer(numpy.arange(0,1,0.01),numpy.ones(10))
+pylab.figure(figsize=(10,7))
+pylab.subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)
maps=[m for m in cm.datad.keys() if not m.endswith("_r")]
maps.sort()
l=len(maps)+1
i=1
for m in maps:
-subplot(1,l,i)
-axis("off")
-imshow(a,aspect='auto',cmap=cm.__dict__[m],origin="lower")
-title(m,rotation=90,fontsize=10)
+pylab.subplot(1,l,i)
+pylab.axis("off")
+pylab.imshow(a,aspect='auto',cmap=cm.__dict__[m],origin="lower")
+pylab.title(m,rotation=90,fontsize=10)
i=i+1
-show()
+pylab.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/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4386] trunk/toolkits/basemap-testing/Changelog
Revision: 4386 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4386&view=rev Author: jswhit Date: 2007-11-19 20:09:55 -0800 (Mon, 19 Nov 2007) Log Message: --- added lake_color keyword to fillcontinents Modified Paths: -- trunk/toolkits/basemap-testing/Changelog Modified: trunk/toolkits/basemap-testing/Changelog === --- trunk/toolkits/basemap-testing/Changelog2007-11-20 04:08:52 UTC (rev 4385) +++ trunk/toolkits/basemap-testing/Changelog2007-11-20 04:09:55 UTC (rev 4386) @@ -1,4 +1,5 @@ version 0.9.7 (not yet released) + * added lake_color keyword to fillcontinents. * fixed a bug in the 'tmerc' projection. * added pure python NetCDFFile reader from Roberto De Almeida to basemap namespace 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/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
