Revision: 4343
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4343&view=rev
Author: jswhit
Date: 2007-11-16 12:16:22 -0800 (Fri, 16 Nov 2007)
Log Message:
-----------
workarounds for an a bug in proj4 for tmerc projection.
Modified Paths:
--------------
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py
Modified:
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
===================================================================
--- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
2007-11-16 20:02:16 UTC (rev 4342)
+++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
2007-11-16 20:16:22 UTC (rev 4343)
@@ -229,8 +229,12 @@
projparams['a'] = rsphere[1]
projparams['b'] = rsphere[0]
except:
- projparams['a'] = rsphere
- projparams['b'] = rsphere
+ if projection == 'tmerc':
+ # use Ra instead of R because of obscure bug
+ # in proj4 for tmerc projection.
+ projparams['Ra'] = rsphere
+ else:
+ projparams['R'] = rsphere
# set units to meters.
projparams['units']='m'
# check for sane values of lon_0, lat_0, lat_ts, lat_1, lat_2
@@ -483,7 +487,7 @@
self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
elif projection == 'ortho':
- if projparams['a'] != projparams['b']:
+ if not projparams.has_key('R'):
raise ValueError, 'orthographic projection only works for
perfect spheres - not ellipsoids'
if lat_0 is None or lon_0 is None:
raise ValueError, 'must specify lat_0 and lon_0 for
Orthographic basemap'
@@ -1452,6 +1456,10 @@
if self.projection in ['merc','cyl','mill','moll','robin','sinu']:
lons = npy.arange(self.llcrnrlon,self.urcrnrlon+0.01,0.01)
+ elif self.projection in ['tmerc']:
+ lon_0 = self.projparams['lon_0']
+ # tmerc only defined within +/- 90 degrees of lon_0
+ lons = npy.arange(lon_0-90,lon_0+90.01,0.01)
else:
lons = npy.arange(0,360.01,0.01)
# make sure latmax degree parallel is drawn if projection not merc or
cyl or miller
Modified: trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py
===================================================================
--- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py
2007-11-16 20:02:16 UTC (rev 4342)
+++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/proj.py
2007-11-16 20:16:22 UTC (rev 4343)
@@ -54,7 +54,10 @@
self.rmajor = projparams['a']
self.rminor = projparams['b']
except:
- self.rmajor = projparams['R']
+ try:
+ self.rmajor = projparams['R']
+ except:
+ self.rmajor = projparams['Ra']
self.rminor = self.rmajor
if self.rmajor == self.rminor:
self.ellipsoid = False
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