@@ -265,8 +265,7 @@ class AitoffTransform(_GeoTransform):
265
265
266
266
def transform_non_affine (self , ll ):
267
267
# docstring inherited
268
- longitude = ll [:, 0 ]
269
- latitude = ll [:, 1 ]
268
+ longitude , latitude = ll .T
270
269
271
270
# Pre-compute some values
272
271
half_long = longitude / 2.0
@@ -278,10 +277,9 @@ def transform_non_affine(self, ll):
278
277
# We want unnormalized sinc. numpy.sinc gives us normalized
279
278
sinc_alpha = np .sin (alpha ) / alpha
280
279
281
- xy = np .empty_like (ll , float )
282
- xy [:, 0 ] = (cos_latitude * np .sin (half_long )) / sinc_alpha
283
- xy [:, 1 ] = np .sin (latitude ) / sinc_alpha
284
- return xy
280
+ x = (cos_latitude * np .sin (half_long )) / sinc_alpha
281
+ y = np .sin (latitude ) / sinc_alpha
282
+ return np .column_stack ([x , y ])
285
283
286
284
def inverted (self ):
287
285
# docstring inherited
@@ -405,9 +403,9 @@ def transform_non_affine(self, xy):
405
403
# from Equations (7, 8) of
406
404
# http://mathworld.wolfram.com/MollweideProjection.html
407
405
theta = np .arcsin (y / np .sqrt (2 ))
408
- lon = (np .pi / (2 * np .sqrt (2 ))) * x / np .cos (theta )
409
- lat = np .arcsin ((2 * theta + np .sin (2 * theta )) / np .pi )
410
- return np .column_stack ([lon , lat ])
406
+ longitude = (np .pi / (2 * np .sqrt (2 ))) * x / np .cos (theta )
407
+ latitude = np .arcsin ((2 * theta + np .sin (2 * theta )) / np .pi )
408
+ return np .column_stack ([longitude , latitude ])
411
409
412
410
def inverted (self ):
413
411
# docstring inherited
@@ -474,21 +472,20 @@ def __init__(self, center_longitude, center_latitude, resolution):
474
472
475
473
def transform_non_affine (self , xy ):
476
474
# docstring inherited
477
- x = xy [:, 0 :1 ]
478
- y = xy [:, 1 :2 ]
475
+ x , y = xy .T
479
476
clong = self ._center_longitude
480
477
clat = self ._center_latitude
481
478
p = np .maximum (np .hypot (x , y ), 1e-9 )
482
479
c = 2 * np .arcsin (0.5 * p )
483
480
sin_c = np .sin (c )
484
481
cos_c = np .cos (c )
485
482
486
- lat = np .arcsin (cos_c * np .sin (clat ) +
487
- ((y * sin_c * np .cos (clat )) / p ))
488
- lon = clong + np .arctan (
483
+ latitude = np .arcsin (cos_c * np .sin (clat ) +
484
+ ((y * sin_c * np .cos (clat )) / p ))
485
+ longitude = clong + np .arctan (
489
486
(x * sin_c ) / (p * np .cos (clat )* cos_c - y * np .sin (clat )* sin_c ))
490
487
491
- return np .concatenate (( lon , lat ), 1 )
488
+ return np .column_stack ([ longitude , latitude ] )
492
489
493
490
def inverted (self ):
494
491
# docstring inherited
0 commit comments