pygeodesy 24.6.1__py2.py3-none-any.whl → 24.6.24__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 (89) hide show
  1. {PyGeodesy-24.6.1.dist-info → PyGeodesy-24.6.24.dist-info}/METADATA +2 -2
  2. PyGeodesy-24.6.24.dist-info/RECORD +117 -0
  3. pygeodesy/__init__.py +33 -32
  4. pygeodesy/albers.py +2 -2
  5. pygeodesy/auxilats/__init__.py +1 -1
  6. pygeodesy/auxilats/auxAngle.py +40 -39
  7. pygeodesy/auxilats/auxDLat.py +3 -2
  8. pygeodesy/auxilats/auxLat.py +16 -18
  9. pygeodesy/auxilats/auxily.py +1 -1
  10. pygeodesy/azimuthal.py +10 -10
  11. pygeodesy/basics.py +9 -1
  12. pygeodesy/booleans.py +53 -66
  13. pygeodesy/cartesianBase.py +143 -155
  14. pygeodesy/css.py +14 -18
  15. pygeodesy/datums.py +6 -6
  16. pygeodesy/deprecated/__init__.py +1 -1
  17. pygeodesy/deprecated/classes.py +16 -2
  18. pygeodesy/deprecated/datum.py +3 -3
  19. pygeodesy/deprecated/functions.py +6 -8
  20. pygeodesy/dms.py +23 -27
  21. pygeodesy/ecef.py +49 -55
  22. pygeodesy/elevations.py +4 -4
  23. pygeodesy/ellipsoidalBase.py +28 -70
  24. pygeodesy/ellipsoidalBaseDI.py +19 -23
  25. pygeodesy/ellipsoidalExact.py +3 -3
  26. pygeodesy/ellipsoidalGeodSolve.py +15 -23
  27. pygeodesy/ellipsoidalKarney.py +37 -60
  28. pygeodesy/ellipsoidalNvector.py +44 -50
  29. pygeodesy/ellipsoidalVincenty.py +11 -14
  30. pygeodesy/ellipsoids.py +107 -101
  31. pygeodesy/errors.py +101 -49
  32. pygeodesy/etm.py +32 -44
  33. pygeodesy/formy.py +55 -58
  34. pygeodesy/frechet.py +20 -23
  35. pygeodesy/fsums.py +4 -4
  36. pygeodesy/gars.py +3 -4
  37. pygeodesy/geodesici.py +909 -0
  38. pygeodesy/geodesicw.py +11 -13
  39. pygeodesy/geodesicx/__init__.py +4 -4
  40. pygeodesy/geodesicx/gx.py +18 -28
  41. pygeodesy/geodesicx/gxbases.py +20 -8
  42. pygeodesy/geodesicx/gxline.py +16 -22
  43. pygeodesy/geodsolve.py +102 -34
  44. pygeodesy/geohash.py +39 -60
  45. pygeodesy/geoids.py +28 -37
  46. pygeodesy/hausdorff.py +21 -23
  47. pygeodesy/heights.py +15 -28
  48. pygeodesy/internals.py +19 -12
  49. pygeodesy/interns.py +4 -10
  50. pygeodesy/iters.py +2 -2
  51. pygeodesy/karney.py +20 -4
  52. pygeodesy/ktm.py +13 -16
  53. pygeodesy/latlonBase.py +202 -191
  54. pygeodesy/lazily.py +96 -59
  55. pygeodesy/lcc.py +29 -32
  56. pygeodesy/ltp.py +43 -24
  57. pygeodesy/ltpTuples.py +190 -183
  58. pygeodesy/mgrs.py +35 -9
  59. pygeodesy/named.py +106 -72
  60. pygeodesy/namedTuples.py +43 -14
  61. pygeodesy/nvectorBase.py +23 -27
  62. pygeodesy/osgr.py +9 -9
  63. pygeodesy/points.py +7 -7
  64. pygeodesy/rhumb/__init__.py +1 -1
  65. pygeodesy/rhumb/aux_.py +5 -5
  66. pygeodesy/rhumb/bases.py +30 -31
  67. pygeodesy/rhumb/ekx.py +3 -4
  68. pygeodesy/rhumb/solve.py +8 -61
  69. pygeodesy/solveBase.py +22 -19
  70. pygeodesy/sphericalBase.py +26 -21
  71. pygeodesy/sphericalNvector.py +13 -13
  72. pygeodesy/sphericalTrigonometry.py +86 -97
  73. pygeodesy/streprs.py +8 -36
  74. pygeodesy/trf.py +3 -3
  75. pygeodesy/triaxials.py +117 -91
  76. pygeodesy/units.py +229 -321
  77. pygeodesy/unitsBase.py +116 -108
  78. pygeodesy/ups.py +26 -31
  79. pygeodesy/utily.py +12 -11
  80. pygeodesy/utm.py +35 -40
  81. pygeodesy/utmups.py +43 -46
  82. pygeodesy/utmupsBase.py +9 -10
  83. pygeodesy/vector3d.py +59 -62
  84. pygeodesy/vector3dBase.py +17 -15
  85. pygeodesy/webmercator.py +19 -21
  86. pygeodesy/wgrs.py +18 -20
  87. PyGeodesy-24.6.1.dist-info/RECORD +0 -116
  88. {PyGeodesy-24.6.1.dist-info → PyGeodesy-24.6.24.dist-info}/WHEEL +0 -0
  89. {PyGeodesy-24.6.1.dist-info → PyGeodesy-24.6.24.dist-info}/top_level.txt +0 -0
pygeodesy/geohash.py CHANGED
@@ -20,7 +20,7 @@ from pygeodesy.basics import isodd, isstr, map2
20
20
  from pygeodesy.constants import EPS, R_M, _floatuple, _0_0, _0_5, _180_0, \
21
21
  _360_0, _90_0, _N_90_0, _N_180_0 # PYCHOK used!
22
22
  from pygeodesy.dms import parse3llh # parseDMS2
23
- from pygeodesy.errors import _ValueError, _xkwds
23
+ from pygeodesy.errors import _ValueError, _xkwds, _xStrError
24
24
  from pygeodesy.fmath import favg
25
25
  # from pygeodesy import formy as _formy # _MODS
26
26
  from pygeodesy.interns import NN, _COMMA_, _DOT_, _E_, _N_, _NE_, _NW_, \
@@ -30,15 +30,16 @@ from pygeodesy.named import _name__, _NamedDict, _NamedTuple, nameof, _xnamed
30
30
  from pygeodesy.namedTuples import Bounds2Tuple, Bounds4Tuple, LatLon2Tuple, \
31
31
  PhiLam2Tuple
32
32
  from pygeodesy.props import deprecated_function, deprecated_method, \
33
- deprecated_property_RO, Property_RO, property_RO
33
+ deprecated_property_RO, Property_RO
34
34
  from pygeodesy.streprs import fstr
35
- from pygeodesy.units import Degrees_, Int, Lat, Lon, Precision_, Str, \
36
- _xStrError
35
+ from pygeodesy.units import Degrees_, Int, Lat, Lon, Precision_, Str
37
36
 
38
37
  from math import fabs, ldexp, log10, radians
39
38
 
40
39
  __all__ = _ALL_LAZY.geohash
41
- __version__ = '24.05.23'
40
+ __version__ = '24.06.15'
41
+
42
+ _formy = _MODS.into(formy=__name__)
42
43
 
43
44
 
44
45
  class _GH(object):
@@ -235,7 +236,7 @@ class Geohash(Str):
235
236
  @kwarg LatLon: Optional class to return I{bounds} (C{LatLon})
236
237
  or C{None}.
237
238
  @kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword
238
- arguments, ignored if B{C{LatLon}} is C{None}.
239
+ arguments, ignored if C{B{LatLon} is None}.
239
240
 
240
241
  @return: A L{Bounds2Tuple}C{(latlonSW, latlonNE)} of B{C{LatLon}}s
241
242
  or a L{Bounds4Tuple}C{(latS, lonW, latN, lonE)} if
@@ -298,16 +299,15 @@ class Geohash(Str):
298
299
 
299
300
  @arg other: The other geohash (L{Geohash}, C{LatLon} or C{str}).
300
301
  @kwarg radius: Mean earth radius, ellipsoid or datum (C{meter},
301
- L{Ellipsoid}, L{Ellipsoid2}, L{Datum} or
302
- L{a_f2Tuple}) or C{None}, see function
303
- L{pygeodesy.equirectangular}.
302
+ L{Ellipsoid}, L{Ellipsoid2}, L{Datum} or L{a_f2Tuple})
303
+ or C{None}, see function L{pygeodesy.equirectangular}.
304
304
  @kwarg adjust_limit_wrap: Optional keyword arguments for function
305
305
  L{pygeodesy.equirectangular4}, overriding defaults
306
306
  C{B{adjust}=False, B{limit}=None} and C{B{wrap}=False}.
307
307
 
308
- @return: Distance (C{meter}, same units as B{C{radius}} or the
309
- ellipsoid or datum axes or C{radians I{squared}} if
310
- B{C{radius}} is C{None} or C{0}).
308
+ @return: Distance (C{meter}, same units as B{C{radius}} or the ellipsoid
309
+ or datum axes or C{radians I{squared}} if B{C{radius} is None}
310
+ or C{0}).
311
311
 
312
312
  @raise TypeError: The B{C{other}} is not a L{Geohash}, C{LatLon} or
313
313
  C{str} or invalid B{C{radius}}.
@@ -317,9 +317,8 @@ class Geohash(Str):
317
317
  '''
318
318
  lls = self.latlon + _2Geohash(other).latlon
319
319
  kwds = _xkwds(adjust_limit_wrap, adjust=False, limit=None, wrap=False)
320
- m = self._formy
321
- return m.equirectangular( *lls, radius=radius, **kwds) if radius else \
322
- m.equirectangular4(*lls, **kwds).distance2
320
+ return _formy.equirectangular( *lls, radius=radius, **kwds) if radius else \
321
+ _formy.equirectangular4(*lls, **kwds).distance2
323
322
 
324
323
  def euclideanTo(self, other, **radius_adjust_wrap):
325
324
  '''Approximate the distance between this and an other geohash using
@@ -335,14 +334,7 @@ class Geohash(Str):
335
334
  @raise TypeError: The B{C{other}} is not a L{Geohash}, C{LatLon}
336
335
  or C{str} or invalid B{C{radius}}.
337
336
  '''
338
- return self._distanceTo(self._formy.euclidean, other, **radius_adjust_wrap)
339
-
340
- @property_RO
341
- def _formy(self):
342
- '''(INTERNAL) Get the C{.formy} module, I{once}.
343
- '''
344
- Geohash._formy = f = _MODS.formy # overwrite property_RO
345
- return f
337
+ return self._distanceTo(_formy.euclidean, other, **radius_adjust_wrap)
346
338
 
347
339
  def haversineTo(self, other, **radius_wrap):
348
340
  '''Compute the distance between this and an other geohash using
@@ -358,7 +350,7 @@ class Geohash(Str):
358
350
  @raise TypeError: The B{C{other}} is not a L{Geohash}, C{LatLon}
359
351
  or C{str} or invalid B{C{radius}}.
360
352
  '''
361
- return self._distanceTo(self._formy.haversine, other, **radius_wrap)
353
+ return self._distanceTo(_formy.haversine, other, **radius_wrap)
362
354
 
363
355
  @Property_RO
364
356
  def latlon(self):
@@ -404,13 +396,11 @@ class Geohash(Str):
404
396
  as an instance of the supplied C{LatLon} class.
405
397
 
406
398
  @arg LatLon: Class to use (C{LatLon}) or C{None}.
407
- @kwarg LatLon_kwds: Optional, additional B{C{LatLon}}
408
- keyword arguments, ignored if
409
- C{B{LatLon} is None}.
399
+ @kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword
400
+ arguments, ignored if C{B{LatLon} is None}.
410
401
 
411
- @return: This geohash location (B{C{LatLon}}) or a
412
- L{LatLon2Tuple}C{(lat, lon)} if B{C{LatLon}}
413
- is C{None}.
402
+ @return: This geohash location (B{C{LatLon}}) or if C{B{LatLon}
403
+ is None}, a L{LatLon2Tuple}C{(lat, lon)}.
414
404
 
415
405
  @raise TypeError: Invalid B{C{LatLon}} or B{C{LatLon_kwds}}.
416
406
  '''
@@ -431,7 +421,7 @@ class Geohash(Str):
431
421
  @raise TypeError: The B{C{other}} is not a L{Geohash}, C{LatLon}
432
422
  or C{str} or invalid B{C{radius}}.
433
423
  '''
434
- return self._distanceTo(self._formy.vincentys, other, **radius_wrap)
424
+ return self._distanceTo(_formy.vincentys, other, **radius_wrap)
435
425
 
436
426
  @Property_RO
437
427
  def N(self):
@@ -506,19 +496,17 @@ _Neighbors8Defaults = dict(zip(Neighbors8Dict._Keys_, (None,) *
506
496
  def bounds(geohash, LatLon=None, **LatLon_kwds):
507
497
  '''Returns the lower-left SW and upper-right NE corners of a geohash.
508
498
 
509
- @arg geohash: To be bound (L{Geohash}).
510
- @kwarg LatLon: Optional class to return the bounds (C{LatLon})
511
- or C{None}.
512
- @kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword
513
- arguments, ignored if C{B{LatLon} is None}.
499
+ @arg geohash: To be "bound" (L{Geohash}).
500
+ @kwarg LatLon: Optional class to return the bounds (C{LatLon}) or C{None}.
501
+ @kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword arguments,
502
+ ignored if C{B{LatLon} is None}.
514
503
 
515
- @return: A L{Bounds2Tuple}C{(latlonSW, latlonNE)} of B{C{LatLon}}s
516
- or if B{C{LatLon}} is C{None}, a L{Bounds4Tuple}C{(latS,
517
- lonW, latN, lonE)}.
504
+ @return: A L{Bounds2Tuple}C{(latlonSW, latlonNE)}, each a B{C{LatLon}}
505
+ or if C{B{LatLon} is None}, a L{Bounds4Tuple}C{(latS, lonW,
506
+ latN, lonE)}.
518
507
 
519
- @raise TypeError: The B{C{geohash}} is not a L{Geohash}, C{LatLon}
520
- or C{str} or invalid B{C{LatLon}} or invalid
521
- B{C{LatLon_kwds}}.
508
+ @raise TypeError: The B{C{geohash}} is not a L{Geohash}, C{LatLon} or
509
+ C{str} or invalid B{C{LatLon}} or invalid B{C{LatLon_kwds}}.
522
510
 
523
511
  @raise GeohashError: Invalid or C{null} B{C{geohash}}.
524
512
  '''
@@ -803,18 +791,11 @@ def precision(res1, res2=None):
803
791
  <https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1Geohash.html>}.
804
792
  '''
805
793
  r = Degrees_(res1=res1, low=_0_0, Error=GeohashError)
806
- if res2 is None:
807
- t = r, r
808
- for p in range(1, _MaxPrec):
809
- if resolution2(p, None) <= t:
810
- return p
811
-
812
- else:
813
- t = r, Degrees_(res2=res2, low=_0_0, Error=GeohashError)
814
- for p in range(1, _MaxPrec):
815
- if resolution2(p, p) <= t:
816
- return p
817
-
794
+ N = res2 is None
795
+ t = r, (r if N else Degrees_(res2=res2, low=_0_0, Error=GeohashError))
796
+ for p in range(1, _MaxPrec):
797
+ if resolution2(p, (None if N else p)) <= t:
798
+ return p
818
799
  return _MaxPrec
819
800
 
820
801
 
@@ -860,14 +841,12 @@ def resolution2(prec1, prec2=None):
860
841
  def sizes(geohash):
861
842
  '''Return the lat- and longitudinal size of this L{Geohash} cell.
862
843
 
863
- @arg geohash: Cell for which size are required (L{Geohash} or
864
- C{str}).
844
+ @arg geohash: Cell for which size are required (L{Geohash} or C{str}).
865
845
 
866
- @return: A L{LatLon2Tuple}C{(lat, lon)} with the latitudinal
867
- height and longitudinal width in (C{meter}).
846
+ @return: A L{LatLon2Tuple}C{(lat, lon)} with the latitudinal height and
847
+ longitudinal width in (C{meter}).
868
848
 
869
- @raise TypeError: The B{C{geohash}} is not a L{Geohash},
870
- C{LatLon} or C{str}.
849
+ @raise TypeError: The B{C{geohash}} is not a L{Geohash}, C{LatLon} or C{str}.
871
850
  '''
872
851
  return _2Geohash(geohash).sizes
873
852
 
pygeodesy/geoids.py CHANGED
@@ -118,7 +118,7 @@ except ImportError: # Python 3+
118
118
  from io import BytesIO as _BytesIO # PYCHOK expected
119
119
 
120
120
  __all__ = _ALL_LAZY.geoids
121
- __version__ = '24.05.23'
121
+ __version__ = '24.06.11'
122
122
 
123
123
  _assert_ = 'assert'
124
124
  _bHASH_ = b'#'
@@ -323,10 +323,9 @@ class _GeoidBase(_HeightsBase):
323
323
  @kwarg LatLon: Optional class to return the location and height
324
324
  (C{LatLon}) or C{None}.
325
325
 
326
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
327
- lon, height)} otherwise a B{C{LatLon}} instance
328
- with the lat-, longitude and geoid height of the
329
- center grid location.
326
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon,
327
+ height)} otherwise a B{C{LatLon}} instance with the lat-,
328
+ longitude and geoid height of the center grid location.
330
329
  '''
331
330
  return self._llh3LL(self._center, LatLon)
332
331
 
@@ -437,10 +436,9 @@ class _GeoidBase(_HeightsBase):
437
436
  @kwarg LatLon: Optional class to return the location and height
438
437
  (C{LatLon}) or C{None}.
439
438
 
440
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
441
- lon, height)} otherwise a B{C{LatLon}} instance
442
- with the lat-, longitude and geoid height of the
443
- highest grid location.
439
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon,
440
+ height)} otherwise a B{C{LatLon}} instance with the lat-,
441
+ longitude and geoid height of the highest grid location.
444
442
  '''
445
443
  return self._llh3LL(self._highest, LatLon)
446
444
 
@@ -513,10 +511,9 @@ class _GeoidBase(_HeightsBase):
513
511
  @kwarg LatLon: Optional class to return the location
514
512
  (C{LatLon}) and height or C{None}.
515
513
 
516
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
517
- lon, height)} otherwise a B{C{LatLon}} instance
518
- with the lat-, longitude and geoid height of the
519
- lower-left, SW grid corner.
514
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon, height)}
515
+ otherwise a B{C{LatLon}} instance with the lat-, longitude and
516
+ geoid height of the lower-left, SW grid corner.
520
517
  '''
521
518
  return self._llh3LL(self._lowerleft, LatLon)
522
519
 
@@ -532,10 +529,9 @@ class _GeoidBase(_HeightsBase):
532
529
  @kwarg LatLon: Optional class to return the location and height
533
530
  (C{LatLon}) or C{None}.
534
531
 
535
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
536
- lon, height)} otherwise a B{C{LatLon}} instance
537
- with the lat-, longitude and geoid height of the
538
- lower-right, SE grid corner.
532
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon, height)}
533
+ otherwise a B{C{LatLon}} instance with the lat-, longitude and
534
+ geoid height of the lower-right, SE grid corner.
539
535
  '''
540
536
 
541
537
  return self._llh3LL(self._loweright, LatLon)
@@ -554,10 +550,9 @@ class _GeoidBase(_HeightsBase):
554
550
  @kwarg LatLon: Optional class to return the location and height
555
551
  (C{LatLon}) or C{None}.
556
552
 
557
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
558
- lon, height)} otherwise a B{C{LatLon}} instance
559
- with the lat-, longitude and geoid height of the
560
- lowest grid location.
553
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon,
554
+ height)} otherwise a B{C{LatLon}} instance with the lat-,
555
+ longitude and geoid height of the lowest grid location.
561
556
  '''
562
557
  return self._llh3LL(self._lowest, LatLon)
563
558
 
@@ -701,10 +696,9 @@ class _GeoidBase(_HeightsBase):
701
696
  @kwarg LatLon: Optional class to return the location and height
702
697
  (C{LatLon}) or C{None}.
703
698
 
704
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
705
- lon, height)} otherwise a B{C{LatLon}} instance
706
- with the lat-, longitude and geoid height of the
707
- upper-left, NW grid corner.
699
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon, height)}
700
+ otherwise a B{C{LatLon}} instance with the lat-, longitude and
701
+ geoid height of the upper-left, NW grid corner.
708
702
  '''
709
703
  return self._llh3LL(self._upperleft, LatLon)
710
704
 
@@ -720,10 +714,9 @@ class _GeoidBase(_HeightsBase):
720
714
  @kwarg LatLon: Optional class to return the location and height
721
715
  (C{LatLon}) or C{None}.
722
716
 
723
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
724
- lon, height)} otherwise a B{C{LatLon}} instance
725
- with the lat-, longitude and geoid height of the
726
- upper-right, NE grid corner.
717
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon, height)}
718
+ otherwise a B{C{LatLon}} instance with the lat-, longitude and
719
+ geoid height of the upper-right, NE grid corner.
727
720
  '''
728
721
  return self._llh3LL(self._upperright, LatLon)
729
722
 
@@ -1169,10 +1162,9 @@ class GeoidKarney(_GeoidBase):
1169
1162
  (C{LatLon}) or C{None}.
1170
1163
  @kwarg full: Search the full or limited latitude range (C{bool}).
1171
1164
 
1172
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
1173
- lon, height)} otherwise a B{C{LatLon}} instance
1174
- with the lat-, longitude and geoid height at the
1175
- highest grid location.
1165
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon,
1166
+ height)} otherwise a B{C{LatLon}} instance with the lat-,
1167
+ longitude and geoid height of the highest grid location.
1176
1168
  '''
1177
1169
  llh = self._highest if full or self.cropped else self._highest_ltd
1178
1170
  return self._llh3LL(llh, LatLon)
@@ -1223,10 +1215,9 @@ class GeoidKarney(_GeoidBase):
1223
1215
  (C{LatLon}) or C{None}.
1224
1216
  @kwarg full: Search the full or limited latitude range (C{bool}).
1225
1217
 
1226
- @return: If B{C{LatLon}} is C{None}, a L{LatLon3Tuple}C{(lat,
1227
- lon, height)} otherwise a B{C{LatLon}} instance
1228
- with the lat-, longitude and geoid height of the
1229
- lowest grid location.
1218
+ @return: If C{B{LatLon} is None}, a L{LatLon3Tuple}C{(lat, lon,
1219
+ height)} otherwise a B{C{LatLon}} instance with the lat-,
1220
+ longitude and geoid height of the lowest grid location.
1230
1221
  '''
1231
1222
  llh = self._lowest if full or self.cropped else self._lowest_ltd
1232
1223
  return self._llh3LL(llh, LatLon)
pygeodesy/hausdorff.py CHANGED
@@ -72,21 +72,20 @@ from pygeodesy.datums import _ellipsoidal_datum, _WGS84
72
72
  from pygeodesy.errors import PointsError, _xattr, _xcallable, _xkwds, _xkwds_get
73
73
  import pygeodesy.formy as _formy
74
74
  from pygeodesy.interns import NN, _i_, _j_, _units_
75
- # from pygeodesy.iters import points2 # from .points
75
+ # from pygeodesy.iters import points2 as _points # from .points
76
76
  from pygeodesy.lazily import _ALL_LAZY, _FOR_DOCS
77
77
  from pygeodesy.named import _name2__, _Named, _NamedTuple, _Pass
78
78
  # from pygeodesy.namedTuples import PhiLam2Tuple # from .points
79
- from pygeodesy.points import _distanceTo, points2 as _points2, PhiLam2Tuple, radians
79
+ from pygeodesy.points import _distanceTo, PhiLam2Tuple, points2 as _points2, radians
80
80
  from pygeodesy.props import Property, Property_RO, property_doc_, property_RO
81
- from pygeodesy.units import Float, Number_, _xUnit, _xUnits
82
- from pygeodesy.unitsBase import _Str_degrees, _Str_degrees2, _Str_meter, _Str_NN, \
83
- _Str_radians, _Str_radians2
81
+ from pygeodesy.units import Float, Number_
82
+ from pygeodesy import unitsBase as _unitsBase # _Str_..., _xUnit, _xUnits
84
83
 
85
84
  # from math import radians # from .points
86
85
  from random import Random
87
86
 
88
87
  __all__ = _ALL_LAZY.hausdorff
89
- __version__ = '24.05.26'
88
+ __version__ = '24.06.15'
90
89
 
91
90
 
92
91
  class HausdorffError(PointsError):
@@ -104,7 +103,7 @@ class Hausdorff(_Named):
104
103
  _kwds = {} # func_ options
105
104
  _model = ()
106
105
  _seed = None
107
- _units = _Str_NN # XXX Str to _Pass and for backward compatibility
106
+ _units = _unitsBase._Str_NN # XXX Str to _Pass and for backward compatibility
108
107
 
109
108
  def __init__(self, point1s, seed=None, units=NN, **name__kwds):
110
109
  '''New C{Hausdorff...} calculator.
@@ -261,7 +260,7 @@ class Hausdorff(_Named):
261
260
 
262
261
  @raise TypeError: Invalid B{C{units}}.
263
262
  '''
264
- self._units = _xUnits(units, Base=Float)
263
+ self._units = _unitsBase._xUnits(units, Base=Float)
265
264
 
266
265
  @Property_RO
267
266
  def wrap(self):
@@ -274,7 +273,7 @@ class HausdorffDegrees(Hausdorff):
274
273
  '''L{Hausdorff} base class for distances from C{LatLon}
275
274
  points in C{degrees}.
276
275
  '''
277
- _units = _Str_degrees
276
+ _units = _unitsBase._Str_degrees
278
277
 
279
278
  if _FOR_DOCS:
280
279
  __init__ = Hausdorff.__init__
@@ -290,7 +289,7 @@ class HausdorffRadians(Hausdorff):
290
289
  '''L{Hausdorff} base class for distances from C{LatLon}
291
290
  points converted from C{degrees} to C{radians}.
292
291
  '''
293
- _units = _Str_radians
292
+ _units = _unitsBase._Str_radians
294
293
 
295
294
  if _FOR_DOCS:
296
295
  __init__ = Hausdorff.__init__
@@ -318,8 +317,8 @@ class _HausdorffMeterRadians(Hausdorff):
318
317
  the optional keyword arguments supplied at instantiation
319
318
  of the C{Hausdorff*} sub-class.
320
319
  '''
321
- _units = _Str_meter
322
- _units_ = _Str_radians
320
+ _units = _unitsBase._Str_meter
321
+ _units_ = _unitsBase._Str_radians
323
322
 
324
323
  def directed(self, point2s, early=True):
325
324
  '''Overloaded method L{Hausdorff.directed} to determine
@@ -426,7 +425,7 @@ class HausdorffDistanceTo(Hausdorff):
426
425
  '''Compute the C{Hausdorff} distance based on the distance from the
427
426
  points' C{LatLon.distanceTo} method, conventionally in C{meter}.
428
427
  '''
429
- _units = _Str_meter
428
+ _units = _unitsBase._Str_meter
430
429
 
431
430
  def __init__(self, point1s, **seed_name__distanceTo_kwds):
432
431
  '''New L{HausdorffDistanceTo} calculator.
@@ -464,7 +463,7 @@ class HausdorffEquirectangular(Hausdorff):
464
463
  '''Compute the C{Hausdorff} distance based on the C{equirectangular} distance
465
464
  in C{radians squared} like function L{pygeodesy.equirectangular}.
466
465
  '''
467
- _units = _Str_degrees2
466
+ _units = _unitsBase._Str_degrees2
468
467
 
469
468
  def __init__(self, point1s, **seed_name__adjust_limit_wrap):
470
469
  '''New L{HausdorffEquirectangular} calculator.
@@ -513,7 +512,7 @@ class HausdorffExact(Hausdorff):
513
512
  '''Compute the C{Hausdorff} distance based on the I{angular}
514
513
  distance in C{degrees} from method L{GeodesicExact}C{.Inverse}.
515
514
  '''
516
- _units = _Str_degrees
515
+ _units = _unitsBase._Str_degrees
517
516
 
518
517
  def __init__(self, point1s, datum=None, **seed_name__wrap):
519
518
  '''New L{HausdorffKarney} calculator.
@@ -543,7 +542,7 @@ class HausdorffFlatLocal(_HausdorffMeterRadians):
543
542
  '''Compute the C{Hausdorff} distance based on the I{angular} distance in
544
543
  C{radians squared} like function L{pygeodesy.flatLocal_}/L{pygeodesy.hubeny_}.
545
544
  '''
546
- _units = _Str_radians2
545
+ _units = _unitsBase._Str_radians2
547
546
 
548
547
  def __init__(self, point1s, **seed_name__datum_scaled_wrap):
549
548
  '''New L{HausdorffFlatLocal}/L{HausdorffHubeny} calculator.
@@ -634,7 +633,7 @@ class HausdorffKarney(Hausdorff):
634
633
  <https://GeographicLib.SourceForge.io/Python/doc/code.html>}
635
634
  Inverse method.
636
635
  '''
637
- _units = _Str_degrees
636
+ _units = _unitsBase._Str_degrees
638
637
 
639
638
  def __init__(self, point1s, datum=None, **seed_name__wrap):
640
639
  '''New L{HausdorffKarney} calculator.
@@ -819,14 +818,13 @@ class Hausdorff6Tuple(_NamedTuple):
819
818
  _Names_ = ('hd', _i_, _j_, 'mn', 'md', _units_)
820
819
  _Units_ = (_Pass, Number_, Number_, Number_, _Pass, _Pass)
821
820
 
822
- def toUnits(self, **Error): # PYCHOK expected
821
+ def toUnits(self, **Error_name): # PYCHOK expected
823
822
  '''Overloaded C{_NamedTuple.toUnits} for C{hd} and C{md} units.
824
823
  '''
825
- U = _xUnit(self.units, Float) # PYCHOK expected
826
- M = _Pass if self.md is None else U # PYCHOK expected
827
- self._Units_ = (U,) + Hausdorff6Tuple._Units_[1:4] \
828
- + (M,) + Hausdorff6Tuple._Units_[5:]
829
- return _NamedTuple.toUnits(self, **Error)
824
+ u = list(Hausdorff6Tuple._Units_)
825
+ u[0] = U = _unitsBase._xUnit(self.units, Float) # PYCHOK expected
826
+ u[4] = _Pass if self.md is None else U # PYCHOK expected
827
+ return _NamedTuple.toUnits(self.reUnit(*u), **Error_name) # PYCHOK self
830
828
 
831
829
 
832
830
  def randomrangenerator(seed):
pygeodesy/heights.py CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
- u'''Height interpolations at C{LatLon} points from C{knots}.
4
+ u'''Height interpolations at C{LatLon} points from known C{knots}.
5
5
 
6
6
  Classes L{HeightCubic}, L{HeightIDWcosineAndoyerLambert},
7
7
  L{HeightIDWcosineForsytheAndoyerLambert}, L{HeightIDWcosineLaw},
@@ -76,7 +76,7 @@ from pygeodesy.errors import _AssertionError, LenError, PointsError, \
76
76
  # from pygeodesy.fmath import fidw # _MODS
77
77
  # from pygeodesy.formy import cosineAndoyerLambert, cosineForsytheAndoyerLambert, \
78
78
  # cosineLaw, equirectangular4, euclidean, flatLocal, \
79
- # flatPolar, haversine, thomas, vincentys # _MODS
79
+ # flatPolar, haversine, thomas, vincentys # _MODS.into
80
80
  # from pygeodesy.internals import _version2 # _MODS
81
81
  from pygeodesy.interns import NN, _COMMASPACE_, _cubic_, _insufficient_, _linear_, \
82
82
  _NOTEQUAL_, _PLUS_, _scipy_, _SPACE_, _STAR_
@@ -91,9 +91,10 @@ from pygeodesy.units import _isDegrees, Float_, Int_
91
91
  # from math import radians # from .points
92
92
 
93
93
  __all__ = _ALL_LAZY.heights
94
- __version__ = '24.05.25'
94
+ __version__ = '24.06.22'
95
95
 
96
96
  _error_ = 'error'
97
+ _formy = _MODS.into(formy=__name__)
97
98
  _llis_ = 'llis'
98
99
  _smoothing_ = 'smoothing'
99
100
 
@@ -693,20 +694,6 @@ class _HeightIDW(_HeightBase):
693
694
  i = Fmt.INDEX(knots=i)
694
695
  raise HeightError(i, k, cause=e)
695
696
 
696
- @property_RO
697
- def _fmath(self):
698
- '''(INTERNAL) Get module C{fmath}, I{once}.
699
- '''
700
- _HeightIDW._fmath = f = _MODS.fmath # overwrite property_RO
701
- return f
702
-
703
- @property_RO
704
- def _formy(self):
705
- '''(INTERNAL) Get module C{formy}, I{once}.
706
- '''
707
- _HeightIDW._formy = f = _MODS.formy # overwrite property_RO
708
- return f
709
-
710
697
  def height(self, lats, lons, **wrap):
711
698
  '''Interpolate the height for one or several lat-/longitudes.
712
699
 
@@ -735,7 +722,7 @@ class _HeightIDW(_HeightBase):
735
722
  '''
736
723
  ds, hs = self._distances(x, y), self._heights
737
724
  try:
738
- return self._fmath.fidw(hs, ds, beta=self.beta)
725
+ return _MODS.fmath.fidw(hs, ds, beta=self.beta)
739
726
  except (TypeError, ValueError) as e:
740
727
  raise HeightError(x=x, y=y, cause=e)
741
728
 
@@ -798,7 +785,7 @@ class HeightIDWcosineAndoyerLambert(_HeightIDW):
798
785
  @see: L{Here<_HeightIDW.__init__>} for further details.
799
786
  '''
800
787
  _HeightIDW.__init__(self, knots, beta=beta, **name__datum_wrap)
801
- self._func = self._formy.cosineAndoyerLambert
788
+ self._func = _formy.cosineAndoyerLambert
802
789
 
803
790
  if _FOR_DOCS:
804
791
  __call__ = _HeightIDW.__call__
@@ -821,7 +808,7 @@ class HeightIDWcosineForsytheAndoyerLambert(_HeightIDW):
821
808
  @see: L{Here<_HeightIDW.__init__>} for further details.
822
809
  '''
823
810
  _HeightIDW.__init__(self, knots, beta=beta, **name__datum_wrap)
824
- self._func = self._formy.cosineForsytheAndoyerLambert
811
+ self._func = _formy.cosineForsytheAndoyerLambert
825
812
 
826
813
  if _FOR_DOCS:
827
814
  __call__ = _HeightIDW.__call__
@@ -845,7 +832,7 @@ class HeightIDWcosineLaw(_HeightIDW):
845
832
  @see: L{Here<_HeightIDW.__init__>} for further details.
846
833
  '''
847
834
  _HeightIDW.__init__(self, knots, beta=beta, **name__radius_wrap)
848
- self._func = self._formy.cosineLaw
835
+ self._func = _formy.cosineLaw
849
836
 
850
837
  if _FOR_DOCS:
851
838
  __call__ = _HeightIDW.__call__
@@ -914,7 +901,7 @@ class HeightIDWequirectangular(_HeightIDW):
914
901
  def _distances(self, x, y):
915
902
  '''(INTERNAL) Yield distances to C{(x, y)}.
916
903
  '''
917
- _f, kwds = self._formy.equirectangular4, self._kwds
904
+ _f, kwds = _formy.equirectangular4, self._kwds
918
905
  try:
919
906
  for i, k in enumerate(self._knots):
920
907
  yield _f(y, x, k.lat, k.lon, **kwds).distance2
@@ -942,7 +929,7 @@ class HeightIDWeuclidean(_HeightIDW):
942
929
  @see: L{Here<_HeightIDW.__init__>} for further details.
943
930
  '''
944
931
  _HeightIDW.__init__(self, knots, beta=beta, **name__adjust_radius_wrap)
945
- self._func = self._formy.euclidean
932
+ self._func = _formy.euclidean
946
933
 
947
934
  if _FOR_DOCS:
948
935
  __call__ = _HeightIDW.__call__
@@ -995,7 +982,7 @@ class HeightIDWflatLocal(_HeightIDW):
995
982
  '''
996
983
  _HeightIDW.__init__(self, knots, beta=beta,
997
984
  **name__datum_hypot_scaled_wrap)
998
- self._func = self._formy.flatLocal
985
+ self._func = _formy.flatLocal
999
986
 
1000
987
  if _FOR_DOCS:
1001
988
  __call__ = _HeightIDW.__call__
@@ -1018,7 +1005,7 @@ class HeightIDWflatPolar(_HeightIDW):
1018
1005
  @see: L{Here<_HeightIDW.__init__>} for further details.
1019
1006
  '''
1020
1007
  _HeightIDW.__init__(self, knots, beta=beta, **name__radius_wrap)
1021
- self._func = self._formy.flatPolar
1008
+ self._func = _formy.flatPolar
1022
1009
 
1023
1010
  if _FOR_DOCS:
1024
1011
  __call__ = _HeightIDW.__call__
@@ -1042,7 +1029,7 @@ class HeightIDWhaversine(_HeightIDW):
1042
1029
  @see: L{Here<_HeightIDW.__init__>} for further details.
1043
1030
  '''
1044
1031
  _HeightIDW.__init__(self, knots, beta=beta, **name__radius_wrap)
1045
- self._func = self._formy.haversine
1032
+ self._func = _formy.haversine
1046
1033
 
1047
1034
  if _FOR_DOCS:
1048
1035
  __call__ = _HeightIDW.__call__
@@ -1106,7 +1093,7 @@ class HeightIDWthomas(_HeightIDW):
1106
1093
  @see: L{Here<_HeightIDW.__init__>} for further details.
1107
1094
  '''
1108
1095
  _HeightIDW.__init__(self, knots, beta=beta, **name__datum_wrap)
1109
- self._func = self._formy.thomas
1096
+ self._func = _formy.thomas
1110
1097
 
1111
1098
  if _FOR_DOCS:
1112
1099
  __call__ = _HeightIDW.__call__
@@ -1130,7 +1117,7 @@ class HeightIDWvincentys(_HeightIDW):
1130
1117
  @see: L{Here<_HeightIDW.__init__>} for further details.
1131
1118
  '''
1132
1119
  _HeightIDW.__init__(self, knots, beta=beta, **name__radius_wrap)
1133
- self._func = self._formy.vincentys
1120
+ self._func = _formy.vincentys
1134
1121
 
1135
1122
  if _FOR_DOCS:
1136
1123
  __call__ = _HeightIDW.__call__