Revision: 6507
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6507&view=rev
Author:   jswhit
Date:     2008-12-08 12:44:41 +0000 (Mon, 08 Dec 2008)

Log Message:
-----------
now can specify just lon_0 to define global cylindrical projection 
centered on lon_0.

Modified Paths:
--------------
    trunk/toolkits/basemap/Changelog
    trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py

Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog    2008-12-08 12:31:06 UTC (rev 6506)
+++ trunk/toolkits/basemap/Changelog    2008-12-08 12:44:41 UTC (rev 6507)
@@ -1,4 +1,6 @@
 version 0.99.2 (not yet released)
+           * Now can specify just lon_0 for all cylindrical projections
+             (to produce global map centered on lon_0).
            * Added save_background.py example, showing how to re-use
              a map background without redrawing coastlines.
            * Added embedding_map_in_wx.py example (courtesy of

Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-08 
12:31:06 UTC (rev 6506)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-08 
12:44:41 UTC (rev 6507)
@@ -261,8 +261,9 @@
  ================ ====================================================
  Keyword          Description
  ================ ====================================================
- lat_ts           latitude of true scale for mercator projection,
+ lat_ts           latitude of true scale.
                   optional for stereographic projection.
+                  mandatory for mercator projection.
  lat_1            first standard parallel for lambert conformal, 
                   albers equal area and equidistant conic.
                   Latitude of one of the two points on the projection 
@@ -532,24 +533,6 @@
                 llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = 
_choosecorners(width,height,**projparams)
                 self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
                 self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
-        elif projection == 'merc':
-            if lat_ts is None:
-                raise ValueError, 'must specify lat_ts for Mercator basemap'
-            # clip plot region to be within -89.99S to 89.99N
-            # (mercator is singular at poles)
-            if not using_corners:
-                llcrnrlon = -180.
-                llcrnrlat = -90.
-                urcrnrlon = 180
-                urcrnrlat = 90.
-            if llcrnrlat < -89.99: llcrnrlat = -89.99
-            if llcrnrlat > 89.99: llcrnrlat = 89.99
-            if urcrnrlat < -89.99: urcrnrlat = -89.99
-            if urcrnrlat > 89.99: urcrnrlat = 89.99
-            self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
-            self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
-            if width is not None or height is not None:
-                print 'warning: width and height keywords ignored for %s 
projection' % _projnames[self.projection]
         elif projection in ['tmerc','gnom','cass','poly'] :
             if projection == 'gnom' and not projparams.has_key('R'):
                 raise ValueError, 'gnomonic projection only works for perfect 
spheres - not ellipsoids'
@@ -640,26 +623,29 @@
                 llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = 
_choosecorners(width,height,**projparams)
                 self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
                 self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
-        elif projection in ['mill','gall']:
+        elif projection in _cylproj:
             if not using_corners:
-                llcrnrlon = -180.
                 llcrnrlat = -90.
-                urcrnrlon = 180
                 urcrnrlat = 90.
+                if lon_0 is not None:
+                    llcrnrlon = lon_0-180.
+                    urcrnrlon = lon_0+180.
+                else:
+                    llcrnrlon = -180.
+                    urcrnrlon = 180
+                if projection == 'merc':
+                    if lat_ts is None:
+                        raise ValueError, 'must specify lat_ts for Mercator 
basemap'
+                    # clip plot region to be within -89.99S to 89.99N
+                    # (mercator is singular at poles)
+                    if llcrnrlat < -89.99: llcrnrlat = -89.99
+                    if llcrnrlat > 89.99: llcrnrlat = 89.99
+                    if urcrnrlat < -89.99: urcrnrlat = -89.99
+                    if urcrnrlat > 89.99: urcrnrlat = 89.99
                 self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
                 self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
             if width is not None or height is not None:
                 print 'warning: width and height keywords ignored for %s 
projection' % _projnames[self.projection]
-        elif projection == 'cyl':
-            if not using_corners:
-                llcrnrlon = -180.
-                llcrnrlat = -90.
-                urcrnrlon = 180
-                urcrnrlat = 90.
-                self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
-                self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
-            if width is not None or height is not None:
-                print 'warning: width and height keywords ignored for %s 
projection' % _projnames[self.projection]
         else:
             raise ValueError(_unsupported_projection % projection)
 


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

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to