pygeodesy 25.1.9__py2.py3-none-any.whl → 25.4.25__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. pygeodesy/__init__.py +35 -31
  2. pygeodesy/__main__.py +3 -3
  3. pygeodesy/albers.py +29 -36
  4. pygeodesy/auxilats/_CX_4.py +2 -2
  5. pygeodesy/auxilats/_CX_6.py +2 -2
  6. pygeodesy/auxilats/_CX_8.py +2 -2
  7. pygeodesy/auxilats/_CX_Rs.py +59 -40
  8. pygeodesy/auxilats/__init__.py +3 -3
  9. pygeodesy/auxilats/__main__.py +9 -7
  10. pygeodesy/auxilats/auxAngle.py +2 -2
  11. pygeodesy/auxilats/auxLat.py +13 -13
  12. pygeodesy/auxilats/auxily.py +13 -9
  13. pygeodesy/azimuthal.py +7 -6
  14. pygeodesy/basics.py +65 -22
  15. pygeodesy/booleans.py +12 -10
  16. pygeodesy/cartesianBase.py +21 -20
  17. pygeodesy/clipy.py +11 -10
  18. pygeodesy/constants.py +11 -10
  19. pygeodesy/css.py +14 -11
  20. pygeodesy/datums.py +8 -8
  21. pygeodesy/deprecated/bases.py +2 -2
  22. pygeodesy/deprecated/classes.py +2 -2
  23. pygeodesy/deprecated/consterns.py +4 -4
  24. pygeodesy/dms.py +8 -8
  25. pygeodesy/ecef.py +10 -7
  26. pygeodesy/elevations.py +9 -8
  27. pygeodesy/ellipsoidalBase.py +19 -8
  28. pygeodesy/ellipsoidalBaseDI.py +17 -15
  29. pygeodesy/ellipsoidalNvector.py +6 -3
  30. pygeodesy/ellipsoidalVincenty.py +4 -1
  31. pygeodesy/ellipsoids.py +167 -138
  32. pygeodesy/elliptic.py +9 -9
  33. pygeodesy/errors.py +44 -43
  34. pygeodesy/etm.py +9 -9
  35. pygeodesy/fmath.py +10 -9
  36. pygeodesy/formy.py +11 -12
  37. pygeodesy/frechet.py +216 -109
  38. pygeodesy/fstats.py +5 -4
  39. pygeodesy/fsums.py +107 -122
  40. pygeodesy/gars.py +7 -7
  41. pygeodesy/geodesici.py +15 -14
  42. pygeodesy/geodesicw.py +34 -32
  43. pygeodesy/geodesicx/__init__.py +1 -1
  44. pygeodesy/geodesicx/__main__.py +12 -10
  45. pygeodesy/geodesicx/gx.py +30 -33
  46. pygeodesy/geodesicx/gxarea.py +2 -2
  47. pygeodesy/geodesicx/gxline.py +5 -5
  48. pygeodesy/geodsolve.py +18 -17
  49. pygeodesy/geohash.py +7 -8
  50. pygeodesy/geoids.py +35 -34
  51. pygeodesy/hausdorff.py +17 -13
  52. pygeodesy/heights.py +2 -4
  53. pygeodesy/internals.py +31 -46
  54. pygeodesy/interns.py +12 -9
  55. pygeodesy/iters.py +8 -8
  56. pygeodesy/karney.py +73 -66
  57. pygeodesy/ktm.py +5 -5
  58. pygeodesy/latlonBase.py +14 -18
  59. pygeodesy/lazily.py +73 -74
  60. pygeodesy/lcc.py +11 -9
  61. pygeodesy/ltp.py +8 -7
  62. pygeodesy/ltpTuples.py +2 -2
  63. pygeodesy/mgrs.py +7 -6
  64. pygeodesy/named.py +47 -31
  65. pygeodesy/nvectorBase.py +7 -7
  66. pygeodesy/osgr.py +9 -8
  67. pygeodesy/points.py +12 -10
  68. pygeodesy/props.py +25 -25
  69. pygeodesy/resections.py +11 -10
  70. pygeodesy/rhumb/__init__.py +1 -1
  71. pygeodesy/rhumb/aux_.py +14 -14
  72. pygeodesy/rhumb/bases.py +22 -20
  73. pygeodesy/rhumb/ekx.py +6 -6
  74. pygeodesy/rhumb/solve.py +15 -15
  75. pygeodesy/solveBase.py +3 -3
  76. pygeodesy/sphericalBase.py +6 -6
  77. pygeodesy/sphericalNvector.py +6 -5
  78. pygeodesy/sphericalTrigonometry.py +8 -7
  79. pygeodesy/streprs.py +14 -14
  80. pygeodesy/trf.py +14 -12
  81. pygeodesy/triaxials.py +29 -26
  82. pygeodesy/units.py +5 -4
  83. pygeodesy/unitsBase.py +5 -4
  84. pygeodesy/ups.py +3 -3
  85. pygeodesy/utily.py +4 -4
  86. pygeodesy/utmups.py +4 -4
  87. pygeodesy/utmupsBase.py +88 -18
  88. pygeodesy/vector2d.py +18 -11
  89. pygeodesy/vector3d.py +7 -6
  90. pygeodesy/webmercator.py +6 -5
  91. pygeodesy/wgrs.py +6 -5
  92. {pygeodesy-25.1.9.dist-info → pygeodesy-25.4.25.dist-info}/METADATA +35 -31
  93. pygeodesy-25.4.25.dist-info/RECORD +118 -0
  94. pygeodesy-25.1.9.dist-info/RECORD +0 -118
  95. {pygeodesy-25.1.9.dist-info → pygeodesy-25.4.25.dist-info}/WHEEL +0 -0
  96. {pygeodesy-25.1.9.dist-info → pygeodesy-25.4.25.dist-info}/top_level.txt +0 -0
pygeodesy/clipy.py CHANGED
@@ -12,11 +12,12 @@ I{Greiner-Hormann} and L{clipSH} and L{clipSH3} I{Sutherland-Hodgeman}.
12
12
  # make sure int/int division yields float quotient, see .basics
13
13
  from __future__ import division as _; del _ # PYCHOK semicolon
14
14
 
15
- # from pygeodesy.basics import len2 # from .fmath
15
+ from pygeodesy.basics import len2, typename
16
16
  from pygeodesy.constants import EPS, _0_0, _1_0
17
17
  from pygeodesy.errors import _AssertionError, ClipError, PointsError
18
- from pygeodesy.fmath import fabs, len2, Fsum
18
+ from pygeodesy.fmath import fabs, Fsum
19
19
  # from pygeodesy.fsums import Fsum # from .fmath
20
+ # from pygeodesy.internals import typename # from .basics
20
21
  from pygeodesy.interns import NN, _clipid_, _convex_, _DOT_, _end_, _few_, \
21
22
  _fi_, _height_, _i_, _invalid_, _j_, _lat_, \
22
23
  _lon_, _near_, _not_, _points_, _start_, _too_
@@ -30,7 +31,7 @@ from pygeodesy.units import Bool, FIx, HeightX, Lat, Lon, Number_
30
31
  # from math import fabs # from .fmath
31
32
 
32
33
  __all__ = _ALL_LAZY.clipy
33
- __version__ = '23.09.20'
34
+ __version__ = '25.04.14'
34
35
 
35
36
  _fj_ = 'fj'
36
37
  _original_ = 'original'
@@ -126,7 +127,7 @@ class _CS(_Named):
126
127
  # elif c & _CS._XR:
127
128
  # return self.lat4(p, self._xr)
128
129
  # # should never get here
129
- # raise _AssertionError(self._DOT_(self.clip4.__name__))
130
+ # raise _AssertionError(self._DOT_(typename(self.clip4)))
130
131
 
131
132
  def code4(self, p): # compute code for point p
132
133
  if p.lat < self._yb:
@@ -168,7 +169,7 @@ class _CS(_Named):
168
169
 
169
170
  def nop4(self, b, p): # PYCHOK no cover
170
171
  if p: # should never get here
171
- raise _AssertionError(self._DOT_(self.nop4.__name__))
172
+ raise _AssertionError(self._DOT_(typename(self.nop4)))
172
173
  return _CS._IN, self.nop4, b, p
173
174
 
174
175
 
@@ -202,7 +203,7 @@ def clipCS4(points, lowerleft, upperight, closed=False, inull=False):
202
203
  @raise PointsError: Insufficient number of B{C{points}}.
203
204
  '''
204
205
  T4 = ClipCS4Tuple
205
- cs = _CS(lowerleft, upperight, name=clipCS4.__name__)
206
+ cs = _CS(lowerleft, upperight, name=typename(clipCS4))
206
207
  n, pts = _pts2(points, closed, inull)
207
208
 
208
209
  i, m = _imdex2(closed, n)
@@ -398,7 +399,7 @@ def clipLB6(points, lowerleft, upperight, closed=False, inull=False):
398
399
  U{Liang-Barsky algorithm<https://WikiPedia.org/wiki/Liang-Barsky_algorithm>}.
399
400
  '''
400
401
  xl, yb, \
401
- xr, yt = _box4(lowerleft, upperight, clipLB6.__name__)
402
+ xr, yt = _box4(lowerleft, upperight, typename(clipLB6))
402
403
  n, pts = _pts2(points, closed, inull)
403
404
 
404
405
  T6 = ClipLB6Tuple
@@ -578,7 +579,7 @@ class _SH(_Named):
578
579
  fx = float(p2.lon - x)
579
580
  d = fy * dx - fx * dy # fdot((fx, fy), dx, -dy)
580
581
  if fabs(d) < EPS: # PYCHOK no cover
581
- raise _AssertionError(self._DOT_(self.intersect.__name__))
582
+ raise _AssertionError(self._DOT_(typename(self.intersect)))
582
583
  d = Fsum(self._xy, -y * dx, x * dy).fover(d)
583
584
  y += d * fy
584
585
  x += d * fx
@@ -644,7 +645,7 @@ def clipSH(points, corners, closed=False, inull=False):
644
645
 
645
646
  @raise PointsError: Insufficient number of B{C{points}}.
646
647
  '''
647
- sh = _SH(corners, name=clipSH.__name__)
648
+ sh = _SH(corners, name=typename(clipSH))
648
649
  n, pts = sh.clip2(points, closed, inull)
649
650
  for i in range(n):
650
651
  p, _ = sh.clipped2(pts[i])
@@ -671,7 +672,7 @@ def clipSH3(points, corners, closed=False, inull=False):
671
672
 
672
673
  @raise PointsError: Insufficient number of B{C{points}} or B{C{corners}}.
673
674
  '''
674
- sh = _SH(corners, name=clipSH3.__name__)
675
+ sh = _SH(corners, name=typename(clipSH3))
675
676
  n, pts = sh.clip2(points, closed, inull)
676
677
  if n > 1:
677
678
  T3 = ClipSH3Tuple
pygeodesy/constants.py CHANGED
@@ -13,8 +13,8 @@ from __future__ import division as _; del _ # PYCHOK semicolon
13
13
  from pygeodesy.basics import _copysign, isbool, iscomplex, isint
14
14
  from pygeodesy.errors import _xError, _xError2, _xkwds_get1, _xkwds_item2
15
15
  # from pygeodesy.fsums import _isFsum_2Tuple # _MODS
16
- from pygeodesy.internals import _0_0, _100_0
17
- from pygeodesy.interns import _INF_, _NAN_, _UNDER_
16
+ from pygeodesy.internals import _0_0, _100_0, typename
17
+ from pygeodesy.interns import _DMAIN_, _INF_, _NAN_
18
18
  from pygeodesy.lazily import _ALL_MODS as _MODS, _ALL_LAZY
19
19
  # from pygeodesy.streprs import Fmt # from .unitsBase
20
20
  from pygeodesy.unitsBase import Float, Int, Radius, Fmt
@@ -26,7 +26,7 @@ except ImportError: # Python 2-
26
26
  _inf, _nan = float(_INF_), float(_NAN_)
27
27
 
28
28
  __all__ = _ALL_LAZY.constants
29
- __version__ = '24.12.22'
29
+ __version__ = '25.04.14'
30
30
 
31
31
 
32
32
  def _copysign_0_0(y):
@@ -360,7 +360,7 @@ def isfinite(obj):
360
360
  return _iscfinite(obj)
361
361
  if _MODS.fsums._isFsum_2Tuple(obj): # OverflowError
362
362
  return obj.is_finite()
363
- raise _xError(x, Fmt.PAREN(isfinite.__name__, obj))
363
+ raise _xError(x, Fmt.PAREN(typename(isfinite), obj))
364
364
 
365
365
 
366
366
  def isint0(obj, both=False):
@@ -493,13 +493,14 @@ def _umod_PI2(rad):
493
493
  return (rad % PI2) or _0_0
494
494
 
495
495
 
496
- if __name__ == '__main__':
496
+ if __name__ == _DMAIN_:
497
497
 
498
- def _main():
498
+ def _main(locals):
499
499
  from pygeodesy import itemsorted, printf
500
+ from pygeodesy.interns import _DALL_, _UNDER_
500
501
 
501
502
  t = n = v = []
502
- for n, v in itemsorted(locals()):
503
+ for n, v in itemsorted(locals):
503
504
  if isinstance(v, (Float, Int, Radius)):
504
505
  printf('%9s: %r', n, v.toRepr(std=False))
505
506
  if v.name != n:
@@ -508,10 +509,10 @@ if __name__ == '__main__':
508
509
  raise AssertionError('%r is not %r' % (n, v))
509
510
  if not n.startswith(_UNDER_):
510
511
  t.append(n)
511
- t.append(float_.__name__)
512
- printf('__all__ = %r', tuple(t))
512
+ t.append(typename(float_))
513
+ printf('%s = %r', _DALL_, tuple(t))
513
514
 
514
- _main()
515
+ _main(locals())
515
516
 
516
517
  # **) MIT License
517
518
  #
pygeodesy/css.py CHANGED
@@ -3,12 +3,13 @@
3
3
 
4
4
  u'''Cassini-Soldner (CSS) projection.
5
5
 
6
- Classes L{CassiniSoldner}, L{Css} and L{CSSError} requiring I{Charles Karney}'s
7
- U{geographiclib <https://PyPI.org/project/geographiclib>} Python package to be
8
- installed.
6
+ Classes L{CassiniSoldner}, L{Css} and L{CSSError} use I{Charles Karney}'s
7
+ U{geographiclib <https://PyPI.org/project/geographiclib>} Python package
8
+ if installed, see property L{CassiniSoldner.geodesic}.
9
9
  '''
10
10
 
11
- from pygeodesy.basics import islistuple, neg, _xinstanceof, _xsubclassof
11
+ from pygeodesy.basics import _isin, islistuple, neg, _xinstanceof, \
12
+ _xsubclassof
12
13
  from pygeodesy.constants import _umod_360, _0_0, _0_5, _90_0
13
14
  from pygeodesy.datums import _ellipsoidal_datum, _WGS84
14
15
  from pygeodesy.ellipsoidalBase import LatLonEllipsoidalBase as _LLEB
@@ -33,7 +34,7 @@ from pygeodesy.units import Azimuth, Degrees, Easting, Height, _heigHt, \
33
34
  # from math import fabs # from .karney
34
35
 
35
36
  __all__ = _ALL_LAZY.css
36
- __version__ = '24.11.06'
37
+ __version__ = '25.04.14'
37
38
 
38
39
 
39
40
  def _CS0(cs0):
@@ -76,7 +77,7 @@ class CassiniSoldner(_NamedBase):
76
77
 
77
78
  @raise CSSError: Invalid B{C{lat}} or B{C{lon}}.
78
79
  '''
79
- if datum not in (None, self._datum):
80
+ if not _isin(datum, None, self._datum):
80
81
  self._datum = _xellipsoidal(datum=_ellipsoidal_datum(datum, **name))
81
82
  if name:
82
83
  self.name = name
@@ -217,9 +218,10 @@ class CassiniSoldner(_NamedBase):
217
218
  @Property
218
219
  def geodesic(self):
219
220
  '''Get this projection's I{wrapped} U{geodesic.Geodesic
220
- <https://GeographicLib.SourceForge.io/Python/doc/code.html>}, provided
221
+ <https://GeographicLib.SourceForge.io/Python/doc/code.html>} from
221
222
  I{Karney}'s U{geographiclib<https://PyPI.org/project/geographiclib>}
222
- package is installed, otherwise an I{exact} L{GeodesicExact} instance.
223
+ package if installed, otherwise an I{exact} L{GeodesicExact
224
+ <pygeodesy.geodesicx.GeodesicExact>} instance.
223
225
  '''
224
226
  g = self._geodesic
225
227
  if g is None:
@@ -247,7 +249,8 @@ class CassiniSoldner(_NamedBase):
247
249
 
248
250
  @Property_RO
249
251
  def isExact(self):
250
- '''Return C{True} if this projection's geodesic is L{GeodesicExact}.
252
+ '''Return C{True} if this projection's geodesic is L{GeodesicExact
253
+ <pygeodesy.geodesicx.GeodesicExact>}.
251
254
  '''
252
255
  return isinstance(self.geodesic, _MODS.geodesicx.GeodesicExact)
253
256
 
@@ -306,8 +309,8 @@ class CassiniSoldner(_NamedBase):
306
309
 
307
310
  g = self.geodesic
308
311
  self._meridian = m = g.Line(Lat_(lat0=lat0, Error=CSSError),
309
- Lon_(lon0=lon0, Error=CSSError), _0_0,
310
- g.STANDARD | g.DISTANCE_IN | g.LINE_OFF)
312
+ Lon_(lon0=lon0, Error=CSSError),
313
+ _0_0, caps=g.STANDARD_LINE | g.LINE_OFF)
311
314
  self._latlon0 = LatLon2Tuple(m.lat1, m.lon1)
312
315
  s, c = _sincos2d(m.lat1) # == self.lat0 == self.LatitudeOrigin()
313
316
  self._sb0, self._cb0 = _norm2(s * g.f1, c)
pygeodesy/datums.py CHANGED
@@ -67,7 +67,7 @@ datum, q.v. U{"A Guide to Coordinate Systems in Great Britain", Section 6
67
67
  # make sure int/int division yields float quotient, see .basics
68
68
  from __future__ import division as _; del _ # PYCHOK semicolon
69
69
 
70
- from pygeodesy.basics import islistuple, map2, neg, _xinstanceof, _zip
70
+ from pygeodesy.basics import _isin, islistuple, map2, neg, _xinstanceof, _zip
71
71
  from pygeodesy.constants import R_M, _float as _F, _0_0, _1_0, _2_0, _8_0, _3600_0
72
72
  # from pygeodesy.ellipsoidalBase import CartesianEllipsoidalBase as _CEB, \
73
73
  # LatLonEllipsoidalBase as _LLEB # MODS
@@ -77,10 +77,10 @@ from pygeodesy.errors import _IsnotError, _TypeError, _xellipsoidall, _xkwds, _x
77
77
  from pygeodesy.fmath import fdot, fmean, Fmt, _operator
78
78
  from pygeodesy.internals import _passarg, _under
79
79
  from pygeodesy.interns import NN, _a_, _Airy1830_, _AiryModified_, _BAR_, _Bessel1841_, \
80
- _Clarke1866_, _Clarke1880IGN_, _COMMASPACE_, _DOT_, _earth_, \
81
- _ellipsoid_, _ellipsoidal_, _GRS80_, _Intl1924_, _MINUS_, \
82
- _Krassovski1940_, _Krassowsky1940_, _NAD27_, _NAD83_, _s_, \
83
- _PLUS_, _Sphere_, _spherical_, _transform_, _UNDER_, \
80
+ _Clarke1866_, _Clarke1880IGN_, _COMMASPACE_, _DMAIN_,_DOT_, \
81
+ _earth_, _ellipsoid_, _ellipsoidal_, _GRS80_, _Intl1924_, \
82
+ _MINUS_, _Krassovski1940_, _Krassowsky1940_, _NAD27_, _NAD83_, \
83
+ _s_, _PLUS_, _Sphere_, _spherical_, _transform_, _UNDER_, \
84
84
  _WGS72_, _WGS84_
85
85
  from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
86
86
  from pygeodesy.named import _lazyNamedEnumItem as _lazy, _name__, _name2__, _NamedEnum, \
@@ -94,7 +94,7 @@ from pygeodesy.units import _isRadius, Radius_, radians
94
94
  # import operator as _operator # from .fmath
95
95
 
96
96
  __all__ = _ALL_LAZY.datums
97
- __version__ = '24.10.12'
97
+ __version__ = '25.04.14'
98
98
 
99
99
  _a_ellipsoid_ = _UNDER_(_a_, _ellipsoid_)
100
100
  _BD72_ = 'BD72'
@@ -510,7 +510,7 @@ def _earth_datum(inst, a_earth, f=None, raiser=_a_ellipsoid_, **name): # in .ka
510
510
  E, n, D = _EnD3((a_earth, f), name)
511
511
  if raiser and not E:
512
512
  raise _TypeError(f=f, **{raiser: a_earth})
513
- elif a_earth in (_EWGS84, _WGS84, None) and inst._datum is _WGS84:
513
+ elif _isin(a_earth, None, _EWGS84, _WGS84) and inst._datum is _WGS84:
514
514
  return
515
515
  elif isinstance(a_earth, Datum):
516
516
  E, n, D = None, NN, a_earth
@@ -721,7 +721,7 @@ _WGS84 = Datums.WGS84
721
721
  assert _WGS84.ellipsoid is _EWGS84
722
722
  # assert _WGS84.transform.isunity
723
723
 
724
- if __name__ == '__main__':
724
+ if __name__ == _DMAIN_:
725
725
 
726
726
  from pygeodesy.interns import _COMMA_, _NL_, _NLATvar_
727
727
  from pygeodesy import printf
@@ -9,11 +9,11 @@ from pygeodesy.latlonBase import LatLonBase as _LatLonBase
9
9
  from pygeodesy.lazily import _ALL_DEPRECATED
10
10
 
11
11
  __all__ = _ALL_DEPRECATED.deprecated_bases
12
- __version__ = '23.11.25'
12
+ __version__ = '25.04.09'
13
13
 
14
14
 
15
15
  class LatLonHeightBase(_LatLonBase): # PYCHOK no cover
16
- ''''DEPRECATED on 2021.02.10, use (INTERNAL) class L{pygeodesy.latlonBase.LatLonBase}.'''
16
+ '''DEPRECATED on 2021.02.10, use (INTERNAL) class L{pygeodesy.latlonBase.LatLonBase}.'''
17
17
  pass
18
18
 
19
19
 
@@ -22,7 +22,7 @@ from pygeodesy.trf import TRFXform7Tuple as _TRFXform7Tuple
22
22
  from pygeodesy.units import Bearing, Int, Lamd, Lat, Lon, Meter, Phid
23
23
 
24
24
  __all__ = _ALL_DEPRECATED.deprecated_classes
25
- __version__ = '24.12.31'
25
+ __version__ = '25.04.11'
26
26
 
27
27
 
28
28
  class _Deprecated_NamedTuple(_NamedTuple):
@@ -349,7 +349,7 @@ class UtmUps4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover
349
349
 
350
350
 
351
351
  class XDist(ADict):
352
- '''DEPRECATED on 2024.07.02, use class L{XDict}.'''
352
+ '''DEPRECATED on 2024.07.02, use class L{ADict}.'''
353
353
  def __init__(self, *args, **kwds): # PYCHOK no cover
354
354
  deprecated_class(self.__class__)
355
355
  ADict.__init__(self, *args, **kwds)
@@ -9,21 +9,21 @@ from pygeodesy.lazily import _ALL_DEPRECATED
9
9
  from pygeodesy.units import Float, Int, Str
10
10
 
11
11
  __all__ = _ALL_DEPRECATED.deprecated_consterns
12
- __version__ = '23.11.24'
12
+ __version__ = '25.04.09'
13
13
 
14
14
 
15
15
  class _Deprecated_Float(Float):
16
- '''DEPRECATED on 2023.09.12, don't use.'''
16
+ '''DEPRECATED on 2023.09.12, I{don't use}.'''
17
17
  pass
18
18
 
19
19
 
20
20
  class _Deprecated_Int(Int):
21
- '''DEPRECATED on 2023.09.12, don't use.'''
21
+ '''DEPRECATED on 2023.09.12, I{don't use}.'''
22
22
  pass
23
23
 
24
24
 
25
25
  class _Deprecated_Str(Str):
26
- '''DEPRECATED on 2023.09.12, don't use.'''
26
+ '''DEPRECATED on 2023.09.12, I{don't use}.'''
27
27
  pass
28
28
 
29
29
 
pygeodesy/dms.py CHANGED
@@ -62,11 +62,11 @@ U{Vector-based geodesy<https://www.Movable-Type.co.UK/scripts/latlong-vectors.ht
62
62
  '''
63
63
 
64
64
  from pygeodesy.basics import copysign0, isLatLon, isodd, issequence, isstr, \
65
- neg as _neg # in .ups
65
+ neg as _neg, typename # in .ups
66
66
  from pygeodesy.constants import _umod_360, _0_0, _0_5, _60_0, _360_0, _3600_0
67
67
  from pygeodesy.errors import ParseError, RangeError, _TypeError, _ValueError, \
68
- _parseX, rangerrors, _xError, _xkwds, _getPYGEODESY
69
- # from pygeodesy.internals import _getPYGEODESY # from .errors
68
+ _parseX, rangerrors, _xError, _xkwds, _envPYGEODESY
69
+ # from pygeodesy.internals import _envPYGEODESY, typename # from .errors
70
70
  from pygeodesy.interns import NN, _COMMA_, _d_, _DASH_, _deg_, _degrees_, _DOT_, \
71
71
  _0_, _e_, _E_, _EW_, _f_, _F_, _g_, _MINUS_, _N_, \
72
72
  _NE_, _NS_, _NSEW_, _NW_, _PERCENTDOTSTAR_, _PLUS_, \
@@ -86,7 +86,7 @@ except ImportError: # Python 3+
86
86
  from string import ascii_letters as _LETTERS
87
87
 
88
88
  __all__ = _ALL_LAZY.dms
89
- __version__ = '24.10.18'
89
+ __version__ = '25.04.14'
90
90
 
91
91
  _beyond_ = 'beyond'
92
92
  _deg_min_ = 'deg+min'
@@ -100,7 +100,7 @@ F_D_, F_DM_, F_DMS_, F_DEG_, F_MIN_, F_SEC_, F_D60_, F__E_, F__F_, F__G
100
100
  F_D__, F_DM__, F_DMS__, F_DEG__, F_MIN__, F_SEC__, F_D60__, F__E__, F__F__, F__G__, F_RAD__ = (NN(
101
101
  _PLUS_, _) for _ in _F_s)
102
102
  del _F_s
103
- _F_DMS = _getPYGEODESY('FMT_FORM') or F_DMS
103
+ _F_DMS = _envPYGEODESY('FMT_FORM') or F_DMS
104
104
 
105
105
  _F_case = {F_D: F_D, F_DEG: F_D, _degrees_: F_D, # unsigned _F_s
106
106
  F_DM: F_DM, F_MIN: F_DM, _deg_min_: F_DM,
@@ -348,7 +348,7 @@ def compassPoint(bearing, prec=3):
348
348
  p = _MODS.units.Precision_(prec, low=1, high=4) \
349
349
  if prec != 3 else int(prec)
350
350
  m = 2 << p
351
- w = 32 // m # if m in (4, 8, 16, 32)
351
+ w = 32 // m # if _isin(m, 4, 8, 16, 32)
352
352
  # not round(b), half-even rounding in Python 3+, but
353
353
  # round-away-from-zero as int(b + copysign0(_0_5, b))
354
354
  w *= int(b * m / _360_0 + _0_5) % m
@@ -483,7 +483,7 @@ def _latlonDMS_sep2(where, sep=None, **kwds):
483
483
  i = _MODS.inters
484
484
  k = Fmt.EQUAL(sep=repr(sep))
485
485
  k = _SPACE_(i._keyword_, i._arg_, k, i._of_)
486
- n = where.__name__
486
+ n = typename(where)
487
487
  t = _latlonDMS_sep2.__doc__ % (sep, n)
488
488
  _MODS.props._throwarning(k, n, t)
489
489
  return sep, kwds
@@ -670,7 +670,7 @@ def _DDDMMSS6(t, S):
670
670
  # check [D]DDMMSS form and compass point
671
671
  X = _EW_ if isodd(n) else _NS_
672
672
  if not (P in X or (S in X and (P.isdigit() or P == _DOT_))):
673
- t = parseDDDMMSS.__name__[5 if isodd(n) else 6:]
673
+ t = typename(parseDDDMMSS)[(5 if isodd(n) else 6):]
674
674
  t = _SPACE_('form', t, 'applies', _DASH_.join(X))
675
675
  raise ParseError(t)
676
676
  else:
pygeodesy/ecef.py CHANGED
@@ -57,8 +57,8 @@ for conversion between geodetic and I{local cartesian} coordinates in a I{local
57
57
  plane} as opposed to I{geocentric} (ECEF) ones.
58
58
  '''
59
59
 
60
- from pygeodesy.basics import copysign0, isscalar, issubclassof, neg, map1, \
61
- _xinstanceof, _xsubclassof # _args_kwds_names
60
+ from pygeodesy.basics import copysign0, _isin, isscalar, issubclassof, neg, map1, \
61
+ _xinstanceof, _xsubclassof, typename # _args_kwds_names
62
62
  from pygeodesy.constants import EPS, EPS0, EPS02, EPS1, EPS2, EPS_2, INT0, PI, PI_2, \
63
63
  _0_0, _0_0001, _0_01, _0_5, _1_0, _1_0_1T, _N_1_0, \
64
64
  _2_0, _N_2_0, _3_0, _4_0, _6_0, _60_0, _90_0, _N_90_0, \
@@ -69,6 +69,7 @@ from pygeodesy.errors import _IndexError, LenError, _ValueError, _TypesError, \
69
69
  _xattr, _xdatum, _xkwds, _xkwds_get
70
70
  from pygeodesy.fmath import cbrt, fdot, Fpowers, hypot, hypot1, hypot2_, sqrt0
71
71
  from pygeodesy.fsums import Fsum, fsumf_, Fmt, unstr
72
+ # from pygeodesy.internals import typename # from .basics
72
73
  from pygeodesy.interns import NN, _a_, _C_, _datum_, _ellipsoid_, _f_, _height_, \
73
74
  _lat_, _lon_, _M_, _name_, _singular_, _SPACE_, \
74
75
  _x_, _xyz_, _y_, _z_
@@ -89,7 +90,7 @@ from pygeodesy.utily import atan1, atan1d, atan2, atan2d, degrees90, degrees180,
89
90
  from math import cos, degrees, fabs, radians, sqrt
90
91
 
91
92
  __all__ = _ALL_LAZY.ecef
92
- __version__ = '24.12.06'
93
+ __version__ = '25.04.24'
93
94
 
94
95
  _Ecef_ = 'Ecef'
95
96
  _prolate_ = 'prolate'
@@ -138,7 +139,7 @@ class _EcefBase(_NamedBase):
138
139
  else:
139
140
  raise ValueError() # _invalid_
140
141
 
141
- if E not in (_EWGS84, _WGS84):
142
+ if not _isin(E, _EWGS84, _WGS84):
142
143
  d = _ellipsoidal_datum(E, **name)
143
144
  E = d.ellipsoid
144
145
  if E.a < EPS or E.f > EPS1:
@@ -956,7 +957,7 @@ class EcefMatrix(_NamedTuple):
956
957
  # <https://GeographicLib.SourceForge.io/C++/doc/LocalCartesian_8cpp_source.html>
957
958
  # X = (fdot(self.column(r), *other.column(c)) for r in (0,1,2) for c in (0,1,2))
958
959
  X = (fdot(self[r::3], *other[c::3]) for r in range(3) for c in range(3))
959
- return _xnamed(EcefMatrix(*X), EcefMatrix.multiply.__name__)
960
+ return _xnamed(EcefMatrix(*X), typename(EcefMatrix.multiply))
960
961
 
961
962
  def rotate(self, xyz, *xyz0):
962
963
  '''Forward rotation M{M0' ⋅ ([x, y, z] - [x0, y0, z0])'}.
@@ -1141,6 +1142,8 @@ class Ecef9Tuple(_NamedTuple, _NamedLocal):
1141
1142
  '''
1142
1143
  return PhiLam2Tuple(radians(self.lat), self.lamVermeille, name=self.name)
1143
1144
 
1145
+ phiVermeille = phi
1146
+
1144
1147
  def toCartesian(self, Cartesian=None, **Cartesian_kwds):
1145
1148
  '''Return the geocentric C{(x, y, z)} coordinates as an ellipsoidal or spherical
1146
1149
  C{Cartesian}.
@@ -1157,7 +1160,7 @@ class Ecef9Tuple(_NamedTuple, _NamedLocal):
1157
1160
 
1158
1161
  @raise TypeError: Invalid B{C{Cartesian}} or B{C{Cartesian_kwds}} item.
1159
1162
  '''
1160
- if Cartesian in (None, Vector4Tuple):
1163
+ if _isin(Cartesian, None, Vector4Tuple):
1161
1164
  r = self.xyzh
1162
1165
  elif Cartesian is Vector3Tuple:
1163
1166
  r = self.xyz
@@ -1177,7 +1180,7 @@ class Ecef9Tuple(_NamedTuple, _NamedLocal):
1177
1180
  @raise TypeError: The B{C{datum2}} is not a L{Datum}.
1178
1181
  '''
1179
1182
  n = _name__(name, _or_nameof=self)
1180
- if self.datum in (None, datum2): # PYCHOK _Names_
1183
+ if _isin(self.datum, None, datum2): # PYCHOK _Names_
1181
1184
  r = self.copy(name=n)
1182
1185
  else:
1183
1186
  c = self._CartesianBase(self, datum=self.datum, name=n) # PYCHOK _Names_
pygeodesy/elevations.py CHANGED
@@ -21,11 +21,12 @@ U{USGS10mElev.py<https://Gist.GitHub.com/pyRobShrk>}.
21
21
  C{"/Applications/Python\\ X.Y/Install\\ Certificates.command"}
22
22
  '''
23
23
 
24
- from pygeodesy.basics import clips, ub2str
24
+ from pygeodesy.basics import clips, ub2str, typename
25
25
  from pygeodesy.errors import ParseError, _xkwds_get
26
- from pygeodesy.interns import NN, _AMPERSAND_, _COLONSPACE_, \
27
- _elevation_, _height_, _LCURLY_, \
28
- _n_a_, _no_, _RCURLY_, _SPACE_
26
+ # from pygeodesy.internals import typename # from .basics
27
+ from pygeodesy.interns import NN, _AMPERSAND_, _COLONSPACE_, _DMAIN_, \
28
+ _elevation_, _height_, _LCURLY_, _n_a_, \
29
+ _no_, _RCURLY_, _SPACE_
29
30
  from pygeodesy.lazily import _ALL_LAZY
30
31
  from pygeodesy.named import _NamedTuple
31
32
  from pygeodesy.streprs import fabs, Fmt, fstr, lrstrip
@@ -34,7 +35,7 @@ from pygeodesy.units import Lat, Lon, Meter, Scalar, Str
34
35
  # from math import fabs # from .karney
35
36
 
36
37
  __all__ = _ALL_LAZY.elevations
37
- __version__ = '24.06.11'
38
+ __version__ = '25.04.14'
38
39
 
39
40
  try:
40
41
  from urllib2 import urlopen # quote, urlcleanup
@@ -91,7 +92,7 @@ except ImportError:
91
92
  def _error(fun, lat, lon, e):
92
93
  '''(INTERNAL) Format an error
93
94
  '''
94
- return _COLONSPACE_(Fmt.PAREN(fun.__name__, fstr((lat, lon))), e)
95
+ return _COLONSPACE_(Fmt.PAREN(typename(fun), fstr((lat, lon))), e)
95
96
 
96
97
 
97
98
  def _qURL(url, timeout=2, **params):
@@ -243,14 +244,14 @@ def geoidHeight2(lat, lon, model=0, timeout=2.0):
243
244
  return GeoidHeight2Tuple(None, e)
244
245
 
245
246
 
246
- if __name__ == '__main__':
247
+ if __name__ == _DMAIN_:
247
248
 
248
249
  from pygeodesy import printf
249
250
  # <https://WikiPedia.org/wiki/Mount_Diablo>
250
251
  for f in (elevation2, # (1173.79, '3DEP 1/3 arc-second')
251
252
  geoidHeight2): # (-31.699, u'GEOID12B')
252
253
  t = f(37.8816, -121.9142)
253
- printf(_COLONSPACE_(f.__name__, t))
254
+ printf(_COLONSPACE_(typename(f), t))
254
255
 
255
256
  # **) MIT License
256
257
  #
@@ -12,30 +12,41 @@ and published under the same MIT Licence**, see for example U{latlon-ellipsoidal
12
12
  # make sure int/int division yields float quotient, see .basics
13
13
  from __future__ import division as _; del _ # PYCHOK semicolon
14
14
 
15
- # from pygeodesy.basics import _xinstanceof # from .datums
15
+ # from pygeodesy.azimuthal import EquidistantExact, EquidistantKarney # _MODS
16
+ from pygeodesy.basics import _isin, _xinstanceof
16
17
  from pygeodesy.constants import EPS, EPS0, EPS1, _0_0, _0_5
17
18
  from pygeodesy.cartesianBase import CartesianBase # PYCHOK used!
19
+ # from pygeodesy.css import toCss # _MODS
18
20
  from pygeodesy.datums import Datum, Datums, _earth_ellipsoid, _ellipsoidal_datum, \
19
- Transform, _WGS84, _EWGS84, _xinstanceof # _spherical_datum
21
+ Transform, _WGS84, _EWGS84 # _spherical_datum
22
+ # from pygeodesy.dms import parse3llh # _MODS
23
+ # from pygeodesy.elevations import elevation2, geoidHeight2 # _MODS
24
+ # from pygeodesy.ellipsoidalBaseDI import _intersect3, _intersections2, _nearestOn2 # _MODS
20
25
  # from pygeodesy.ellipsoids import _EWGS84 # from .datums
21
26
  from pygeodesy.errors import _IsnotError, RangeError, _TypeError, _xattr, _xellipsoidal, \
22
27
  _xellipsoids, _xError, _xkwds, _xkwds_not
28
+ # from pygeodesy.etm import etm, toEtm8 # _MODS
23
29
  # from pygeodesy.fmath import favg # _MODS
24
30
  from pygeodesy.interns import NN, _COMMA_, _ellipsoidal_
25
31
  from pygeodesy.latlonBase import LatLonBase, _trilaterate5, fabs, _Wrap
26
32
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
27
33
  # from pygeodesy.lcc import toLcc # _MODS
28
34
  # from pygeodesy.namedTuples import Vector3Tuple # _MODS
35
+ # from pygeodesy.osgr import toOsgr # _MODS
36
+ # from pygeodesy.points import isenclosedBy # _MODS
29
37
  from pygeodesy.props import deprecated_method, deprecated_property_RO, \
30
38
  Property_RO, property_doc_, property_RO, _update_all
31
- # from pygeodesy.trf import _eT0Ds4 # _MODS
39
+ # from pygeodesy.trf import RefFrame, _toRefFrame # _MODS
32
40
  from pygeodesy.units import Epoch, _isDegrees, Radius_, _1mm as _TOL_M
41
+ # from pygeodesy import ups, utm, utmups # MODS
42
+ # from pygeodesy.utmupsBase import _lowerleft # MODS
33
43
  # from pygeodesy.utily import _Wrap # from .latlonBase
44
+ # from pygeodesy.vector3d import _intersects2 # _MODS
34
45
 
35
46
  # from math import fabs # from .latlonBase
36
47
 
37
48
  __all__ = _ALL_LAZY.ellipsoidalBase
38
- __version__ = '24.12.04'
49
+ __version__ = '25.04.14'
39
50
 
40
51
 
41
52
  class CartesianEllipsoidalBase(CartesianBase):
@@ -246,7 +257,7 @@ class LatLonEllipsoidalBase(LatLonBase):
246
257
  @raise UnitError: Invalid B{C{lat}}, B{C{lon}} or B{C{height}}.
247
258
  '''
248
259
  LatLonBase.__init__(self, latlonh, lon=lon, height=height, wrap=wrap, **name)
249
- if datum not in (None, self._datum, _EWGS84):
260
+ if not _isin(datum, None, self._datum, _EWGS84):
250
261
  self.datum = _ellipsoidal_datum(datum, name=self.name)
251
262
  if reframe:
252
263
  self.reframe = reframe
@@ -738,7 +749,7 @@ class LatLonEllipsoidalBase(LatLonBase):
738
749
  n = Datums.NAD83.ellipsoid.rocGauss(self.lat)
739
750
  if n > EPS0:
740
751
  # use ratio, datum and NAD83 units may differ
741
- E = self.ellipsoid() if datum in (None, self.datum) else \
752
+ E = self.ellipsoid() if _isin(datum, None, self.datum) else \
742
753
  _earth_ellipsoid(datum)
743
754
  r = E.rocGauss(self.lat)
744
755
  if r > EPS0 and fabs(r - n) > EPS: # EPS1
@@ -1109,9 +1120,9 @@ class LatLonEllipsoidalBase(LatLonBase):
1109
1120
  def _lowerleft(utmups, center):
1110
1121
  '''(INTERNAL) Optionally I{un}-center C{utmups}.
1111
1122
  '''
1112
- if center in (False, 0, _0_0):
1123
+ if _isin(center, False, 0, _0_0):
1113
1124
  u = utmups
1114
- elif center in (True,):
1125
+ elif _isin(center, True):
1115
1126
  u = utmups._lowerleft
1116
1127
  else:
1117
1128
  u = _MODS.utmupsBase._lowerleft(utmups, center)
@@ -7,34 +7,36 @@ class C{LatLonEllipsoidalBaseDI} and functions.
7
7
  # make sure int/int division yields float quotient, see .basics
8
8
  from __future__ import division as _; del _ # PYCHOK semicolon
9
9
 
10
- from pygeodesy.basics import isLatLon, _xsubclassof
10
+ # from pygeodesy.azimuthal import _Equidistants # _MODS
11
+ from pygeodesy.basics import isLatLon, _xsubclassof, typename
11
12
  from pygeodesy.constants import EPS, MAX, PI, PI2, PI_4, isnear0, isnear1, \
12
13
  _EPSqrt as _TOL, _0_0, _0_01, _1_0, _1_5, _3_0
13
14
  # from pygeodesy.dms import F_DMS # _MODS
14
15
  from pygeodesy.ellipsoidalBase import LatLonEllipsoidalBase, _TOL_M, property_RO
15
- from pygeodesy.errors import _AssertionError, IntersectionError, _IsnotError, \
16
- _or, _ValueError, _xellipsoidal, _xError, _xkwds_not
16
+ from pygeodesy.errors import _AssertionError, IntersectionError, _IsnotError, _or, \
17
+ _ValueError, _xellipsoidal, _xError, _xkwds_not
17
18
  from pygeodesy.fmath import favg, fmean_
18
19
  from pygeodesy.fsums import Fmt, fsumf_
19
20
  from pygeodesy.formy import _isequalTo, opposing, _radical2
20
- from pygeodesy.interns import _antipodal_, _concentric_, _ellipsoidal_, \
21
- _exceed_PI_radians_, _low_, _near_, \
22
- _SPACE_, _too_
21
+ # from pygeodesy.geodesicw import _Intersecant2, _PlumbTo # _MODS
22
+ # from pygeodesy.internals import typename # from .basics
23
+ from pygeodesy.interns import _antipodal_, _concentric_, _ellipsoidal_, _low_, \
24
+ _exceed_PI_radians_, _near_, _SPACE_, _too_
23
25
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
24
- from pygeodesy.namedTuples import Bearing2Tuple, Destination2Tuple, \
25
- Intersection3Tuple, NearestOn2Tuple, \
26
- NearestOn8Tuple, _LL4Tuple
26
+ from pygeodesy.namedTuples import Bearing2Tuple, Destination2Tuple, Intersection3Tuple, \
27
+ NearestOn2Tuple, NearestOn8Tuple, _LL4Tuple
27
28
  # from pygeodesy.props import property_RO # from .ellipsoidalBase
29
+ # from pygeodesy.sphericalNvector import _intersects2 # _MODS
30
+ # from pygeodesy.sphericalTrigonometry import _intersect, LatLon # _MODS
28
31
  # from pygeodesy.streprs import Fmt # from .fsums
29
- from pygeodesy.units import _fi_j2, _isDegrees, _isHeight, _isRadius, \
30
- Radius_, Scalar
31
- from pygeodesy.utily import m2km, unroll180, _unrollon, _unrollon3, \
32
- _Wrap, wrap360
32
+ from pygeodesy.units import _fi_j2, _isDegrees, _isHeight, _isRadius, Radius_, Scalar
33
+ from pygeodesy.utily import m2km, unroll180, _unrollon, _unrollon3, _Wrap, wrap360
34
+ # from pygeodesy.vector3d import _intersects2, _intersect3d3, _nearestOn2, Vector3d # _MODS
33
35
 
34
36
  from math import degrees, radians
35
37
 
36
38
  __all__ = _ALL_LAZY.ellipsoidalBaseDI
37
- __version__ = '24.11.04'
39
+ __version__ = '25.04.21'
38
40
 
39
41
  _polar__ = 'polar?'
40
42
  _TRIPS = 33 # _intersect3, _intersects2, _nearestOn interations, 6..9 sufficient?
@@ -390,7 +392,7 @@ class LatLonEllipsoidalBaseDI(LatLonEllipsoidalBase):
390
392
 
391
393
  f, j = _fi_j2(f, len(Ps)) # like .vector3d.nearestOn6
392
394
 
393
- n = self.nearestOn8.__name__ # _DUNDER_nameof
395
+ n = typename(self)
394
396
  c.rename(n)
395
397
  if s is not c:
396
398
  s = s.copy(name=n)