Permalink
Browse files

Fixes issue with using lon_0 not equal to 0 for celestial coordinates…

… in a cyclic or polycyclic projection.
  • Loading branch information...
1 parent fed1457 commit 23db4bbebf4d7fe6ca202b5dad50b6a2054dd685 @mollyswanson committed Nov 29, 2011
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/mpl_toolkits/basemap/__init__.py
@@ -887,20 +887,23 @@ def __call__(self,x,y,inverse=False):
Input arguments lon, lat can be either scalar floats,
sequences, or numpy arrays.
"""
+ if (self.projection in _pseudocyl) or (self.projection in _cylproj):
+ lon_0=self.projparams['lon_0']
+ else:
+ lon_0=0.
if self.celestial and not inverse:
try:
- x = -x
+ x = 2.*lon_0-x
except TypeError:
- x = [-xx for xx in x]
+ x = [2.*lon_0-xx for xx in x]
xout,yout = self.projtran(x,y,inverse=inverse)
if self.celestial and inverse:
try:
- xout = -xout
+ xout = 2.*lon_0-xout
except:
- xout = [-xx for xx in xout]
+ xout = [2.*lon_0-xx for xx in xout]
return xout,yout
-
def makegrid(self,nx,ny,returnxy=False):
"""
return arrays of shape (ny,nx) containing lon,lat coordinates of

0 comments on commit 23db4bb

Please sign in to comment.