Coverage for pygeodesy/karney.py : 97%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
of U{GeographicLib <https://PyPI.org/project/geographiclib>}, provided that package is installed.
'''
'''(INTERNAL) Basic C{dict} with key I{and} attribute access to the items (minimal version of _NamedDict). ''' except KeyError: return dict.__getattr__(self, name)
''''(INTERNAL) Wrapper for some of Karney's U{GeographicLib <https://PyPI.org/project/geographiclib>} classes. '''
def Geodesic(self): '''(INTERNAL) Get the wrapped C{Geodesic} class, provided the U{GeographicLib<https://PyPI.org/project/geographiclib>} package is installed, otherwise throw an C{ImportError}. '''
'''Karney U{Geodesic <https://geographiclib.SourceForge.io/html/ python/code.html#geographiclib.geodesic.Geodesic>} wrapper. '''
'''Return the C{Direct} result. '''
'''Return the destination lat, lon and reverse azimth in C{degrees}. '''
'''Return the C{Inverse} result. '''
'''Return the non-negative I{angular} distance in C{degrees}. ''' # see .FrechetKarney.distance, .HausdorffKarney._distance # and .HeightIDWkarney._distances # XXX self.DISTANCE needed for 'a12'?
'''Return the distance in C{meter} and the forward and reverse azimuths in C{degrees}. '''
# Geodesic.Direct.__doc__ = _Geodesic.Direct.__doc__ # Geodesic.Inverse.__doc__ = _Geodesic.Inverse.__doc__ # Geodesic.Line.__doc__ = _Geodesic.Line.__doc__
def GeodesicLine(self): '''(INTERNAL) Get the wrapped C{GeodesicLine} class, provided the U{GeographicLib<https://PyPI.org/project/geographiclib>} package is installed, otherwise throw an C{ImportError}. '''
'''Karney U{GeodesicLine <https://geographiclib.SourceForge.io/html/ python/code.html#geographiclib.geodesicline.GeodesicLine>} wrapper. '''
# GeodesicLine.ArcPosition.__doc__ = _GeodesicLine.ArcPosition.__doc__ # GeodesicLine.Position.__doc__ = _GeodesicLine.Position.__doc__
def Geodesic_WGS84(self): '''(INTERNAL) Get the wrapped C{Geodesic.WGS84} I{instance} iff the U{GeographicLib<https://PyPI.org/project/geographiclib>} package is installed, otherwise throw an C{ImportError}. '''
def geoMath(self): '''(INTERNAL) Get the C{Math} class if the U{GeographicLib <https://PyPI.org/project/geographiclib>} package is installed or C{False} otherwise. '''
def Math(self): '''(INTERNAL) Get the C{Math} class, provided the U{GeographicLib<https://PyPI.org/project/geographiclib>} package is installed, otherwise throw an C{ImportError}. '''
'''Compute C{deg - deg0}, reduced to C{[-180,180]} accurately.
@return: 2-Tuple C{(delta_angle, residual)} in C{degrees}. '''
d = -180
'''Replace angle in C{degrees} outside [-90,90] by NAN.
@return: Angle C{degrees} or NAN. '''
'''Cascaded summation, like C{.fmath.fsum_}.
@arg vs: Values to be added (C{scalar}[]).
@return: 2-Tuple C{(sum_of_vs, residual)}.
@note: NOT "error-free", see .test/testKarney.py.
@see: U{Algorithm 4.1<https://www.ti3.TUHH.DE/paper/rump/OgRuOi05.pdf>}. '''
'''Reduce angle in C{degrees} to (-180,180].
@return: Reduced angle C{degrees}. '''
# with Python 2.7.16 and 3.7.3 on macOS 10.13.6 # fmod( 0, 360) == 0.0 # fmod( 360, 360) == 0.0 # fmod(-0, 360) == 0.0 # fmod(-0.0, 360) == -0.0 # fmod(-360, 360) == -0.0 # however, using the % operator ... # 0 % 360 == 0 # 360 % 360 == 0 # 360.0 % 360 == 0.0 # -0 % 360 == 0 # -360 % 360 == 0 # -0.0 % 360 == 0.0 # -360.0 % 360 == 0.0
# On Windows 32-bit with Python 2.7, math.fmod(-0.0, 360) # == +0.0. This fixes this bug. See also Math::AngNormalize # in the C++ library. Math::sincosd has a similar fix. if d <= 180 else (d - 360))
'''Error-free summation like C{Math::sum}.
@return: 2-Tuple C{(sum_u_plus_v, residual)}.
@note: The C{residual} can be the same as B{C{u}} or B{C{v}}.
@see: U{Algorithm 3.1<https://www.ti3.TUHH.DE/paper/rump/OgRuOi05.pdf>}. '''
# if True: # Algorithm 3.1
# else: # in Math C/C++ # r -= u # t -= v # t = -(r + t)
# u + v = s + t # = round(u + v) + t
# **) MIT License # # Copyright (C) 2016-2020 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. |