11""" isometric latitude, meridian distance """
2- import numpy as np
2+ from math import radians , degrees , sin , cos , atan2 , tan , log , sqrt , pi
33from .ellipsoid import Ellipsoid
44
55
@@ -40,20 +40,20 @@ def isometric(lat: float, ell: Ellipsoid = None, deg: bool = True):
4040 f = ell .flattening # flattening of ellipsoid
4141
4242 if deg is True :
43- lat = np . deg2rad (lat )
43+ lat = radians (lat )
4444
4545 e2 = f * (2 - f ) # eccentricity-squared
46- e = np . sqrt (e2 ) # eccentricity of ellipsoid
46+ e = sqrt (e2 ) # eccentricity of ellipsoid
4747
48- x = e * np . sin (lat )
48+ x = e * sin (lat )
4949 y = (1 - x ) / (1 + x )
50- z = np . pi / 4 + lat / 2
50+ z = pi / 4 + lat / 2
5151
5252# calculate the isometric latitude
53- isolat = np . log (np . tan (z ) * (y ** (e / 2 )))
53+ isolat = log (tan (z ) * (y ** (e / 2 )))
5454
5555 if deg is True :
56- isolat = np . degrees (isolat )
56+ isolat = degrees (isolat )
5757
5858 return isolat
5959
@@ -90,7 +90,7 @@ def meridian_dist(lat: float, ell: Ellipsoid = None, deg: bool = True):
9090 """
9191
9292 if deg is True :
93- lat = np . radians (lat )
93+ lat = radians (lat )
9494
9595 # set ellipsoid parameters
9696 if ell is None :
@@ -116,11 +116,11 @@ def meridian_dist(lat: float, ell: Ellipsoid = None, deg: bool = True):
116116 F = (693 / 131072 ) * e10
117117
118118 term1 = A * lat
119- term2 = (B / 2 ) * np . sin (2 * lat )
120- term3 = (C / 4 ) * np . sin (4 * lat )
121- term4 = (D / 6 ) * np . sin (6 * lat )
122- term5 = (E / 8 ) * np . sin (8 * lat )
123- term6 = (F / 10 ) * np . sin (10 * lat )
119+ term2 = (B / 2 ) * sin (2 * lat )
120+ term3 = (C / 4 ) * sin (4 * lat )
121+ term4 = (D / 6 ) * sin (6 * lat )
122+ term5 = (E / 8 ) * sin (8 * lat )
123+ term6 = (F / 10 ) * sin (10 * lat )
124124
125125 mdist = a * (1 - e2 ) * (term1 - term2 + term3 - term4 + term5 - term6 )
126126
@@ -177,7 +177,7 @@ def loxodrome_inverse(lat1: float, lon1: float, lat2: float, lon2: float,
177177 ell = Ellipsoid ()
178178
179179 if deg is True :
180- lat1 , lon1 , lat2 , lon2 = np . radians ([ lat1 , lon1 , lat2 , lon2 ] )
180+ lat1 , lon1 , lat2 , lon2 = radians (lat1 ), radians ( lon1 ), radians ( lat2 ), radians ( lon2 )
181181
182182 # compute isometric latitude of P1 and P2
183183 isolat1 = isometric (lat1 , deg = False , ell = ell )
@@ -188,15 +188,15 @@ def loxodrome_inverse(lat1: float, lon1: float, lat2: float, lon2: float,
188188 dlon = lon2 - lon1
189189
190190 # compute azimuth
191- az12 = np . arctan2 (dlon , disolat )
191+ az12 = atan2 (dlon , disolat )
192192
193193 # compute distance along loxodromic curve
194194 m1 = meridian_dist (lat1 , deg = False , ell = ell )
195195 m2 = meridian_dist (lat2 , deg = False , ell = ell )
196196 dm = m2 - m1
197- lox_s = dm / np . cos (az12 )
197+ lox_s = dm / cos (az12 )
198198
199199 if deg is True :
200- az12 = np . degrees (az12 ) % 360.
200+ az12 = degrees (az12 ) % 360.
201201
202202 return lox_s , az12
0 commit comments