@@ -887,20 +887,26 @@ def __call__(self,x,y,inverse=False):
887887 Input arguments lon, lat can be either scalar floats,
888888 sequences, or numpy arrays.
889889 """
890+ if self .celestial :
891+ # don't assume center of map is at greenwich
892+ # (only relevant for cyl or pseudo-cyl projections)
893+ if (self .projection in _pseudocyl ) or (self .projection in _cylproj ):
894+ lon_0 = self .projparams ['lon_0' ]
895+ else :
896+ lon_0 = 0.
890897 if self .celestial and not inverse :
891898 try :
892- x = - x
899+ x = 2. * lon_0 - x
893900 except TypeError :
894- x = [- xx for xx in x ]
901+ x = [2 * lon_0 - xx for xx in x ]
895902 xout ,yout = self .projtran (x ,y ,inverse = inverse )
896903 if self .celestial and inverse :
897904 try :
898- xout = - xout
905+ xout = - 2. * lon_0 - xout
899906 except :
900- xout = [- xx for xx in xout ]
907+ xout = [- 2. * lon_0 - xx for xx in xout ]
901908 return xout ,yout
902909
903-
904910 def makegrid (self ,nx ,ny ,returnxy = False ):
905911 """
906912 return arrays of shape (ny,nx) containing lon,lat coordinates of
@@ -1892,7 +1898,9 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
18921898 xd = (x [1 :]- x [0 :- 1 ])** 2
18931899 yd = (y [1 :]- y [0 :- 1 ])** 2
18941900 dist = np .sqrt (xd + yd )
1895- split = dist > 500000.
1901+ #split = dist > 500000.
1902+ # normalize by radius of sphere
1903+ split = dist > 5000000. / 6370997.0 * self .rmajor
18961904 if np .sum (split ) and self .projection not in _cylproj :
18971905 ind = (np .compress (split ,np .squeeze (split * np .indices (xd .shape )))+ 1 ).tolist ()
18981906 xl = []
@@ -2191,7 +2199,9 @@ def addlon(meridians,madd):
21912199 xd = (x [1 :]- x [0 :- 1 ])** 2
21922200 yd = (y [1 :]- y [0 :- 1 ])** 2
21932201 dist = np .sqrt (xd + yd )
2194- split = dist > 500000.
2202+ #split = dist > 500000.
2203+ # normalize by radius of sphere
2204+ split = dist > 5000000. / 6370997.0 * self .rmajor
21952205 if np .sum (split ) and self .projection not in _cylproj :
21962206 ind = (np .compress (split ,np .squeeze (split * np .indices (xd .shape )))+ 1 ).tolist ()
21972207 xl = []
0 commit comments