Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def transit(lon1, lon2):
# Return 1 or -1 if crossing prime meridian in east or west direction.
# Otherwise return zero.
from pyproj.geodesic import Geodesic
lon1 = Geodesic.AngNormalize(lon1)
lon2 = Geodesic.AngNormalize(lon2)
# treat lon12 = -180 as an eastward geodesic, so convert to 180.
lon12 = -Geodesic.AngNormalize(lon1 - lon2) # In (-180, 180]
if lon1 < 0 and lon2 >= 0 and lon12 > 0:
cross = 1
elif lon2 < 0 and lon1 >= 0 and lon12 < 0:
cross = -1
else:
cross = 0
return cross
transit = staticmethod(transit)
def transit(lon1, lon2):
# Return 1 or -1 if crossing prime meridian in east or west direction.
# Otherwise return zero.
from pyproj.geodesic import Geodesic
lon1 = Geodesic.AngNormalize(lon1)
lon2 = Geodesic.AngNormalize(lon2)
# treat lon12 = -180 as an eastward geodesic, so convert to 180.
lon12 = -Geodesic.AngNormalize(lon1 - lon2) # In (-180, 180]
if lon1 < 0 and lon2 >= 0 and lon12 > 0:
cross = 1
elif lon2 < 0 and lon1 >= 0 and lon12 < 0:
cross = -1
else:
cross = 0
return cross
transit = staticmethod(transit)
def transit(lon1, lon2):
# Return 1 or -1 if crossing prime meridian in east or west direction.
# Otherwise return zero.
from pyproj.geodesic import Geodesic
lon1 = Geodesic.AngNormalize(lon1)
lon2 = Geodesic.AngNormalize(lon2)
# treat lon12 = -180 as an eastward geodesic, so convert to 180.
lon12 = -Geodesic.AngNormalize(lon1 - lon2) # In (-180, 180]
if lon1 < 0 and lon2 >= 0 and lon12 > 0:
cross = 1
elif lon2 < 0 and lon1 >= 0 and lon12 < 0:
cross = -1
else:
cross = 0
return cross
transit = staticmethod(transit)
if outmask & Geodesic.DISTANCE:
if arcmode:
s12 = self._b * ((1 + self._A1m1) * sig12 + AB1)
else:
s12 = s12_a12
if outmask & Geodesic.LONGITUDE:
lam12 = omg12 + self._A3c * (
sig12 + (Geodesic.SinCosSeries(True, ssig2, csig2,
self._C3a, Geodesic.nC3_-1)
- self._B31))
lon12 = lam12 / Math.degree
# Can't use AngNormalize because longitude might have wrapped multiple
# times.
lon12 = lon12 - 360 * math.floor(lon12/360 + 0.5)
lon2 = Geodesic.AngNormalize(self._lon1 + lon12)
if outmask & Geodesic.LATITUDE:
lat2 = math.atan2(sbet2, self._f1 * cbet2) / Math.degree
if outmask & Geodesic.AZIMUTH:
# minus signs give range [-180, 180). 0- converts -0 to +0.
azi2 = 0 - math.atan2(-salp2, calp2) / Math.degree
if outmask & (Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE):
ssig1sq = Math.sq(self._ssig1)
ssig2sq = Math.sq( ssig2)
w1 = math.sqrt(1 + self._k2 * ssig1sq)
w2 = math.sqrt(1 + self._k2 * ssig2sq)
B22 = Geodesic.SinCosSeries(True, ssig2, csig2, self._C2a, Geodesic.nC2_)
AB2 = (1 + self._A2m1) * (B22 - self._B21)
J12 = (self._A1m1 - self._A2m1) * sig12 + (AB1 - AB2)