pygeodesy 25.4.8__py2.py3-none-any.whl → 25.5.5__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 (97) hide show
  1. pygeodesy/__init__.py +36 -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 +9 -9
  8. pygeodesy/auxilats/__init__.py +3 -3
  9. pygeodesy/auxilats/__main__.py +8 -6
  10. pygeodesy/auxilats/auxAngle.py +2 -2
  11. pygeodesy/auxilats/auxLat.py +5 -5
  12. pygeodesy/auxilats/auxily.py +5 -3
  13. pygeodesy/azimuthal.py +7 -6
  14. pygeodesy/basics.py +32 -18
  15. pygeodesy/booleans.py +18 -16
  16. pygeodesy/cartesianBase.py +26 -24
  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 +22 -29
  26. pygeodesy/ecefLocals.py +186 -0
  27. pygeodesy/elevations.py +9 -8
  28. pygeodesy/ellipsoidalBase.py +19 -8
  29. pygeodesy/ellipsoidalBaseDI.py +17 -15
  30. pygeodesy/ellipsoidalNvector.py +6 -3
  31. pygeodesy/ellipsoidalVincenty.py +4 -1
  32. pygeodesy/ellipsoids.py +186 -164
  33. pygeodesy/elliptic.py +9 -9
  34. pygeodesy/errors.py +44 -43
  35. pygeodesy/etm.py +7 -7
  36. pygeodesy/fmath.py +30 -14
  37. pygeodesy/formy.py +11 -12
  38. pygeodesy/frechet.py +216 -109
  39. pygeodesy/fstats.py +5 -4
  40. pygeodesy/fsums.py +79 -78
  41. pygeodesy/gars.py +4 -3
  42. pygeodesy/geodesici.py +15 -14
  43. pygeodesy/geodesicw.py +34 -32
  44. pygeodesy/geodesicx/__init__.py +1 -1
  45. pygeodesy/geodesicx/__main__.py +11 -9
  46. pygeodesy/geodesicx/gx.py +30 -33
  47. pygeodesy/geodesicx/gxarea.py +2 -2
  48. pygeodesy/geodesicx/gxline.py +5 -5
  49. pygeodesy/geodsolve.py +18 -17
  50. pygeodesy/geohash.py +5 -5
  51. pygeodesy/geoids.py +34 -31
  52. pygeodesy/hausdorff.py +17 -13
  53. pygeodesy/heights.py +2 -4
  54. pygeodesy/internals.py +28 -44
  55. pygeodesy/interns.py +10 -7
  56. pygeodesy/iters.py +8 -8
  57. pygeodesy/karney.py +68 -62
  58. pygeodesy/ktm.py +5 -5
  59. pygeodesy/latlonBase.py +20 -21
  60. pygeodesy/lazily.py +104 -78
  61. pygeodesy/lcc.py +11 -9
  62. pygeodesy/ltp.py +56 -58
  63. pygeodesy/ltpTuples.py +35 -36
  64. pygeodesy/mgrs.py +7 -6
  65. pygeodesy/named.py +48 -177
  66. pygeodesy/nvectorBase.py +7 -7
  67. pygeodesy/osgr.py +9 -8
  68. pygeodesy/points.py +12 -10
  69. pygeodesy/props.py +25 -25
  70. pygeodesy/resections.py +83 -80
  71. pygeodesy/rhumb/__init__.py +1 -1
  72. pygeodesy/rhumb/aux_.py +7 -7
  73. pygeodesy/rhumb/bases.py +22 -20
  74. pygeodesy/rhumb/ekx.py +6 -6
  75. pygeodesy/rhumb/solve.py +15 -15
  76. pygeodesy/solveBase.py +3 -3
  77. pygeodesy/sphericalBase.py +6 -6
  78. pygeodesy/sphericalNvector.py +6 -5
  79. pygeodesy/sphericalTrigonometry.py +8 -7
  80. pygeodesy/streprs.py +14 -14
  81. pygeodesy/trf.py +14 -12
  82. pygeodesy/triaxials.py +29 -26
  83. pygeodesy/units.py +5 -4
  84. pygeodesy/unitsBase.py +5 -4
  85. pygeodesy/ups.py +3 -3
  86. pygeodesy/utily.py +4 -4
  87. pygeodesy/utmups.py +4 -4
  88. pygeodesy/utmupsBase.py +110 -18
  89. pygeodesy/vector2d.py +20 -13
  90. pygeodesy/vector3d.py +7 -6
  91. pygeodesy/webmercator.py +6 -5
  92. pygeodesy/wgrs.py +6 -5
  93. {pygeodesy-25.4.8.dist-info → pygeodesy-25.5.5.dist-info}/METADATA +30 -25
  94. pygeodesy-25.5.5.dist-info/RECORD +119 -0
  95. pygeodesy-25.4.8.dist-info/RECORD +0 -118
  96. {pygeodesy-25.4.8.dist-info → pygeodesy-25.5.5.dist-info}/WHEEL +0 -0
  97. {pygeodesy-25.4.8.dist-info → pygeodesy-25.5.5.dist-info}/top_level.txt +0 -0
pygeodesy/ltp.py CHANGED
@@ -13,8 +13,8 @@ and L{ChLVe} and L{Ltp}, L{ChLV}, L{LocalError}, L{Attitude} and L{Frustum}.
13
13
  # make sure int/int division yields float quotient, see .basics
14
14
  from __future__ import division as _; del _ # PYCHOK semicolon
15
15
 
16
- from pygeodesy.basics import _args_kwds_names, map1, map2, _xinstanceof, \
17
- _xsubclassof # .datums
16
+ from pygeodesy.basics import _args_kwds_names, _isin, map1, map2, _xinstanceof, \
17
+ _xsubclassof, typename # .datums
18
18
  from pygeodesy.constants import EPS, INT0, _umod_360, _0_0, _0_01, _0_5, _1_0, \
19
19
  _2_0, _60_0, _90_0, _100_0, _180_0, _3600_0, \
20
20
  _N_1_0 # PYCHOK used!
@@ -23,8 +23,9 @@ from pygeodesy.ecef import _EcefBase, EcefKarney, Ecef9Tuple, _llhn4, \
23
23
  _xyzn4, _WGS84
24
24
  from pygeodesy.errors import _NotImplementedError, _ValueError, _xattr, \
25
25
  _xkwds, _xkwds_get, _xkwds_pop2
26
- from pygeodesy.fmath import fabs, fdot, fdot_, Fhorner
26
+ from pygeodesy.fmath import fabs, fdot, Fdot_, fdot_, Fhorner
27
27
  from pygeodesy.fsums import _floor, fsumf_
28
+ # from pygeodesy.internals import typename # from .basics
28
29
  from pygeodesy.interns import _0_, _COMMASPACE_, _DOT_, _ecef_, _height_, _M_, \
29
30
  _invalid_, _lat0_, _lon0_, _name_, _too_
30
31
  # from pygeodesy.lazily import _ALL_LAZY # from vector3d
@@ -44,7 +45,7 @@ from pygeodesy.vector3d import _ALL_LAZY, Vector3d
44
45
  # from math import fabs, floor as _floor # from .fmath, .fsums
45
46
 
46
47
  __all__ = _ALL_LAZY.ltp
47
- __version__ = '24.12.12'
48
+ __version__ = '25.05.01'
48
49
 
49
50
  _height0_ = _height_ + _0_
50
51
  _narrow_ = 'narrow'
@@ -62,15 +63,18 @@ class Attitude(_NamedBase):
62
63
  def __init__(self, alt_attitude=INT0, tilt=INT0, yaw=INT0, roll=INT0, **name):
63
64
  '''New L{Attitude}.
64
65
 
65
- @kwarg alt_attitude: Altitude (C{meter}) above earth or previous attitude
66
+ @kwarg alt_attitude: Altitude (C{meter}) above earth or a previous attitude
66
67
  (L{Attitude} or L{Attitude4Tuple}) with the C{B{alt}itude},
67
68
  B{C{tilt}}, B{C{yaw}} and B{C{roll}}.
68
69
  @kwarg tilt: Pitch, elevation from horizontal (C{degrees180}), negative down
69
- (clockwise rotation along and around the x- or East axis).
70
+ (clockwise rotation along and around the x- or East axis), iff
71
+ B{C{alt_attitude}} is C{meter}, ignored otherwise.
70
72
  @kwarg yaw: Bearing, heading (compass C{degrees360}), clockwise from North
71
- (counter-clockwise rotation along and around the z- or Up axis).
73
+ (counter-clockwise rotation along and around the z- or Up axis)
74
+ iff B{C{alt_attitude}} is C{meter}, ignored otherwise.
72
75
  @kwarg roll: Roll, bank (C{degrees180}), positive to the right and down
73
- (clockwise rotation along and around the y- or North axis).
76
+ (clockwise rotation along and around the y- or North axis), iff
77
+ B{C{alt_attitude}} is C{meter}, ignored otherwise.
74
78
  @kwarg name: Optional C{B{name}=NN} C{str}).
75
79
 
76
80
  @raise AttitudeError: Invalid B{C{alt_attitude}}, B{C{tilt}}, B{C{yaw}} or
@@ -145,8 +149,10 @@ class Attitude(_NamedBase):
145
149
 
146
150
  @arg x_xyz: X component of vector (C{scalar}) or (3-D) vector (C{Cartesian},
147
151
  L{Vector3d} or L{Vector3Tuple}).
148
- @kwarg y: Y component of vector (C{scalar}), same units as B{C{x}}.
149
- @kwarg z: Z component of vector (C{scalar}), same units as B{C{x}}.
152
+ @kwarg y: Y component of vector (C{scalar}), same units as C{scalar} B{C{x}},
153
+ ignored otherwise.
154
+ @kwarg z: Z component of vector (C{scalar}), same units as C{sclar} B{C{x}},
155
+ ignored otherwise.
150
156
  @kwarg Vector: Class to return transformed point (C{Cartesian}, L{Vector3d}
151
157
  or C{Vector3Tuple}) or C{None}.
152
158
  @kwarg name_Vector_kwds: Optional C{B{name}=NN} (C{str}) and optionally,
@@ -222,7 +228,7 @@ class Attitude(_NamedBase):
222
228
  _update_all(self)
223
229
  self._yaw = y
224
230
 
225
- bearing = heading = yaw
231
+ bearing = heading = yaw # azimuth
226
232
 
227
233
 
228
234
  class AttitudeError(_ValueError):
@@ -270,11 +276,14 @@ class Frustum(_NamedBase):
270
276
  an attitude (L{Attitude} or L{Attitude4Tuple}) with the
271
277
  C{B{alt}itude}, B{C{tilt}}, B{C{yaw}} and B{C{roll}}.
272
278
  @kwarg tilt: Pitch, elevation from horizontal (C{degrees}), negative down
273
- (clockwise rotation along and around the x- or East axis).
279
+ (clockwise rotation along and around the x- or East axis) iff
280
+ B{C{alt_attitude}} is C{meter}, ignored otherwise.
274
281
  @kwarg yaw: Bearing, heading (compass C{degrees}), clockwise from North
275
- (counter-clockwise rotation along and around the z- or Up axis).
282
+ (counter-clockwise rotation along and around the z- or Up axis)
283
+ iff B{C{alt_attitude}} is C{meter}, ignored otherwise.
276
284
  @kwarg roll: Roll, bank (C{degrees}), positive to the right and down
277
- (clockwise rotation along and around the y- or North axis).
285
+ (clockwise rotation along and around the y- or North axis) iff
286
+ B{C{alt_attitude}} is C{meter}, ignored otherwise.
278
287
  @kwarg z: Optional height of the footprint (C{meter}) above I{local tangent plane}.
279
288
  @kwarg ltp: The I{local tangent plane} (L{Ltp}), overriding this
280
289
  frustum's C{ltp}.
@@ -462,7 +471,7 @@ class LocalCartesian(_NamedBase):
462
471
  '''
463
472
  return self._ecef
464
473
 
465
- def _ecef2local(self, ecef, Xyz, name_Xyz_kwds):
474
+ def _ecef2local(self, ecef, Xyz, name_Xyz_kwds): # in _EcefLocal._Ltp_ecef2local
466
475
  '''(INTERNAL) Convert geocentric/geodetic to local, like I{forward}.
467
476
 
468
477
  @arg ecef: Geocentric (and geodetic) (L{Ecef9Tuple}).
@@ -503,10 +512,11 @@ class LocalCartesian(_NamedBase):
503
512
 
504
513
  @arg latlonh: Either a C{LatLon}, L{Ltp}, L{Ecef9Tuple} or C{scalar}
505
514
  (geodetic) latitude (C{degrees}).
506
- @kwarg lon: Optional C{scalar} (geodetic) longitude for C{scalar}
507
- B{C{latlonh}} (C{degrees}).
515
+ @kwarg lon: Optional C{scalar} (geodetic) longitude (C{degrees}) iff
516
+ B{C{latlonh}} is C{scalar}, ignored otherwise.
508
517
  @kwarg height: Optional height (C{meter}, conventionally) perpendicular
509
- to and above (or below) the ellipsoid's surface.
518
+ to and above (or below) the ellipsoid's surface, iff
519
+ B{C{latlonh}} is C{scalar}, ignored othewrise.
510
520
  @kwarg M: Optionally, return the I{concatenated} rotation L{EcefMatrix},
511
521
  iff available (C{bool}).
512
522
  @kwarg name: Optional C{B{name}=NN} (C{str}).
@@ -590,7 +600,7 @@ class LocalCartesian(_NamedBase):
590
600
  return self._t0.M
591
601
 
592
602
  def reset(self, latlonh0=INT0, lon0=INT0, height0=INT0, ecef=None, **lon00_name):
593
- '''Reset this converter, see L{LocalCartesian.__init__} for more details.
603
+ '''Reset this converter, see L{LocalCartesian.__init__} for further details.
594
604
  '''
595
605
  _, name = _xkwds_pop2(lon00_name, lon00=None) # PYCHOK get **name
596
606
  if isinstance(latlonh0, LocalCartesian):
@@ -620,8 +630,10 @@ class LocalCartesian(_NamedBase):
620
630
 
621
631
  @arg xyz: A I{local} (L{XyzLocal}, L{Enu}, L{Ned}, L{Aer}, L{Local9Tuple}) or
622
632
  local C{x} coordinate (C{scalar}).
623
- @kwarg y: Local C{y} coordinate for C{scalar} B{C{xyz}} and B{C{z}} (C{meter}).
624
- @kwarg z: Local C{z} coordinate for C{scalar} B{C{xyz}} and B{C{y}} (C{meter}).
633
+ @kwarg y: Local C{y} coordinate (C{meter}), iff B{C{xyz}} is C{scalar},
634
+ ignored otherwise.
635
+ @kwarg z: Local C{z} coordinate (C{meter}), iff B{C{xyz}} is C{scalar},
636
+ ignored otherwise.
625
637
  @kwarg M: Optionally, return the I{concatenated} rotation L{EcefMatrix}, iff
626
638
  available (C{bool}).
627
639
  @kwarg lon00_name: Optional C{B{name}=NN} (C{str}) and keyword argument
@@ -714,7 +726,7 @@ class _ChLV(object):
714
726
  '''
715
727
  if bool(M): # PYCHOK no cover
716
728
  m = self.forward if fw else self.reverse # PYCHOK attr
717
- n = _DOT_(self.__class__.__name__, m.__name__)
729
+ n = _DOT_(*map1(typename, type(self), m))
718
730
  raise _NotImplementedError(unstr(n, M=M), txt=None)
719
731
  t = Y_X_h_lat_lon_h + (self, self._t0, None) # PYCHOK _t0
720
732
  return ChLV9Tuple(t, name=name)
@@ -733,18 +745,18 @@ class _ChLV(object):
733
745
  '''Convert WGS84 geodetic to I{Swiss} projection coordinates. I{Must be overloaded}.
734
746
 
735
747
  @arg latlonh: Either a C{LatLon}, L{Ltp} or C{scalar} (geodetic) latitude (C{degrees}).
736
- @kwarg lon: Optional, C{scalar} (geodetic) longitude for C{scalar} B{C{latlonh}} (C{degrees}).
748
+ @kwarg lon: Optional, C{scalar} (geodetic) longitude (C{degrees}) iff B{C{latlonh}} is
749
+ C{scalar}, ignored otherwise.
737
750
  @kwarg height: Optional, height, vertically above (or below) the surface of the ellipsoid
738
- (C{meter}) for C{scalar} B{C{latlonh}} and B{C{lon}}.
751
+ (C{meter}) iff B{C{latlonh}} and B{C{lon}} are C{scalar}, ignored otherwise.
739
752
  @kwarg M: If C{True}, return the I{concatenated} rotation L{EcefMatrix} iff available
740
- for C{ChLV} only, C{None} otherwise (C{bool}).
753
+ and for C{ChLV} only, C{None} otherwise (C{bool}).
741
754
  @kwarg name: Optional C{B{name}=NN} (C{str}).
742
755
 
743
756
  @return: A L{ChLV9Tuple}C{(Y, X, h_, lat, lon, height, ltp, ecef, M)} with the unfalsed
744
757
  I{Swiss Y, X} coordinates, I{Swiss h_} height, the given I{geodetic} C{lat},
745
- C{lon} and C{height}, this C{ChLV*} instance and C{ecef} (L{Ecef9Tuple}) at
746
- I{Bern, Ch} and rotation matrix C{M}. The returned C{ltp} is this C{ChLV},
747
- C{ChLVa} or C{ChLVe} instance.
758
+ C{lon} and C{height}, C{ecef} (L{Ecef9Tuple}) at I{Bern, Ch}, rotation matrix
759
+ C{M} and C{ltp} this C{ChLV}, C{ChLVa} or C{ChLVe} instance.
748
760
 
749
761
  @raise LocalError: Invalid or non-C{scalar} B{C{latlonh}}, B{C{lon}} or B{C{height}}.
750
762
  '''
@@ -755,18 +767,18 @@ class _ChLV(object):
755
767
 
756
768
  @arg enh_: A Swiss projection (L{ChLV9Tuple}) or the C{scalar}, falsed I{Swiss E_LV95}
757
769
  or I{y_LV03} easting (C{meter}).
758
- @kwarg n: Falsed I{Swiss N_LV85} or I{x_LV03} northing for C{scalar} B{C{enh_}} and
759
- B{C{h_}} (C{meter}).
760
- @kwarg h_: I{Swiss h'} height for C{scalar} B{C{enh_}} and B{C{n}} (C{meter}).
770
+ @kwarg n: Falsed I{Swiss N_LV85} or I{x_LV03} northing (C{meter}) iff B{C{enh_}} is
771
+ C{scalar}, ignored otherwise.
772
+ @kwarg h_: I{Swiss h'} height (C{meter}) iff B{C{enh_}} and B{C{n}} are C{scalar},
773
+ ignored otherwise.
761
774
  @kwarg M: If C{True}, return the I{concatenated} rotation L{EcefMatrix} iff available
762
- for C{ChLV} only, C{None} otherwise (C{bool}).
775
+ and for C{ChLV} only, C{None} otherwise (C{bool}).
763
776
  @kwarg name: Optional C{B{name}=NN} (C{str}).
764
777
 
765
778
  @return: A L{ChLV9Tuple}C{(Y, X, h_, lat, lon, height, ltp, ecef, M)} with the unfalsed
766
779
  I{Swiss Y, X} coordinates, I{Swiss h_} height, the given I{geodetic} C{lat},
767
- C{lon} and C{height}, this C{ChLV*} instance and C{ecef} (L{Ecef9Tuple}) at
768
- I{Bern, Ch} and rotation matrix C{M}. The returned C{ltp} is this C{ChLV},
769
- C{ChLVa} or C{ChLVe} instance.
780
+ C{lon} and C{height}, C{ecef} (L{Ecef9Tuple}) at I{Bern, Ch}, rotation matrix
781
+ C{M} and C{ltp} this C{ChLV}, C{ChLVa} or C{ChLVe} instance.
770
782
 
771
783
  @raise LocalError: Invalid or non-C{scalar} B{C{enh_}}, B{C{n}} or B{C{h_}}.
772
784
  '''
@@ -776,8 +788,8 @@ class _ChLV(object):
776
788
  def _falsing2(LV95):
777
789
  '''(INTERNAL) Get the C{LV95} or C{LV03} falsing.
778
790
  '''
779
- return _ChLV._95_falsing if LV95 in (True, 95) else (
780
- _ChLV._03_falsing if LV95 in (False, 3) else ChLVYX2Tuple(0, 0))
791
+ return _ChLV._95_falsing if _isin(LV95, True, 95) else (
792
+ _ChLV._03_falsing if _isin(LV95, False, 3) else ChLVYX2Tuple(0, 0))
781
793
 
782
794
  @staticmethod
783
795
  def _llh2abh_3(lat, lon, h):
@@ -817,7 +829,7 @@ class _ChLV(object):
817
829
  def _YXh_n4(self, enh_, n, h_, **name):
818
830
  '''(INTERNAL) Helper for C{ChLV*.reverse}.
819
831
  '''
820
- Y, X, h_, name = _xyzn4(enh_, n, h_, ChLV9Tuple,
832
+ Y, X, h_, name = _xyzn4(enh_, n, h_, (ChLV9Tuple,),
821
833
  _xyz_y_z_names=self._enh_n_h, **name)
822
834
  if isinstance(enh_, ChLV9Tuple):
823
835
  Y, X = enh_.Y, enh_.X
@@ -973,15 +985,15 @@ class ChLVa(_ChLV, LocalCartesian):
973
985
  a, b, h = _ChLV._YXh_2abh3(Y, X, h_)
974
986
  ab_d, a2, b2 = ChLV._ab_d, a**2, b**2
975
987
 
976
- lat = fdot_(3.238272, b,
988
+ lat = Fdot_(3.238272, b,
977
989
  -0.270978, a2,
978
990
  -0.002528, b2,
979
991
  -0.0447, a2 * b,
980
- -0.014, b2 * b, start=16.9023892) / ab_d
981
- lon = fdot_(4.728982, a,
992
+ -0.014, b2 * b, start=16.9023892).fover(ab_d)
993
+ lon = Fdot_(4.728982, a,
982
994
  0.791484, a * b,
983
995
  0.1306, a * b2,
984
- -0.0436, a * a2, start=2.6779094) / ab_d
996
+ -0.0436, a * a2, start=2.6779094).fover(ab_d)
985
997
  return self._ChLV9Tuple(False, M, n, Y, X, h_, lat, lon, h)
986
998
 
987
999
 
@@ -996,8 +1008,8 @@ class ChLVe(_ChLV, LocalCartesian):
996
1008
  argument C{B{gamma}=False} to approximate the I{meridian convergence}.
997
1009
  If C{B{gamma}=True} a 2-tuple C{(t, gamma)} is returned with C{t} the
998
1010
  usual result (C{ChLV9Tuple}) and C{gamma}, the I{meridian convergence}
999
- (decimal C{degrees}). To convert C{gamma} to C{grades} or C{gons},
1000
- use function L{pygeodesy.degrees2grades}.
1011
+ (decimal C{degrees}). To convert C{gamma} to C{grades} or C{gons}, use
1012
+ function L{pygeodesy.degrees2grades}.
1001
1013
 
1002
1014
  @see: Older U{references<https://GitHub.com/alphasldiallo/Swisstopo-WGS84-LV03>}.
1003
1015
  '''
@@ -1069,20 +1081,6 @@ def _fov_2(**fov):
1069
1081
  raise LocalError(txt=t, **fov)
1070
1082
 
1071
1083
 
1072
- def _toLocal(inst, ltp, Xyz, Xyz_kwds):
1073
- '''(INTERNAL) Helper for C{CartesianBase.toAer}, C{CartesianBase.toEnu},
1074
- C{CartesianBase.toLocal}, C{CartesianBase.toNed} and C{latLonBase.toLocal}.
1075
- '''
1076
- return _xLtp(ltp, inst._Ltp)._ecef2local(inst._ecef9, Xyz, Xyz_kwds)
1077
-
1078
-
1079
- def _toLtp(inst, Ecef, ecef9, name):
1080
- '''(INTERNAL) Helper for C{CartesianBase.toLtp}, C{ecef.toLtp} and C{latLonBase.toLtp}.
1081
- '''
1082
- return inst._Ltp if (not name) and Ecef in (None, inst.Ecef) else \
1083
- Ltp(ecef9, ecef=Ecef(inst.datum), name=inst._name__(name))
1084
-
1085
-
1086
1084
  def tyr3d(tilt=INT0, yaw=INT0, roll=INT0, Vector=Vector3d, **name_Vector_kwds):
1087
1085
  '''Convert an attitude pose into a (3-D) direction vector.
1088
1086
 
pygeodesy/ltpTuples.py CHANGED
@@ -11,18 +11,19 @@ L{ChLVYX2Tuple}, L{ChLVyx2Tuple} and L{Footprint5Tuple}.
11
11
  @see: References in module L{ltp}.
12
12
  '''
13
13
 
14
- # from pygeodesy.basics import issubclassof # _MODS
14
+ from pygeodesy.basics import issubclassof, typename
15
15
  from pygeodesy.constants import _0_0, _1_0, _90_0, _N_90_0
16
16
  # from pygeodesy.dms import F_D, toDMS # _MODS
17
17
  from pygeodesy.errors import _TypeError, _TypesError, _xattr, _xkwds, \
18
18
  _xkwds_item2
19
19
  from pygeodesy.fmath import fdot_, hypot, hypot_
20
+ # rom pygeodesy.internals import typename # from .basics
20
21
  from pygeodesy.interns import NN, _4_, _azimuth_, _center_, _COMMASPACE_, \
21
22
  _ecef_, _elevation_, _height_, _lat_, _lon_, \
22
23
  _ltp_, _M_, _name_, _up_, _X_, _x_, _xyz_, \
23
24
  _Y_, _y_, _z_
24
25
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
25
- # from pygeodesy.ltp import Attitude, ChLV, ChLVa, ChLVe, _xLtp # _MODS
26
+ # from pygeodesy.ltp Attitude, ChLV, ChLVa, ChLVe _Xltp # _MODS.into
26
27
  from pygeodesy.named import _name__, _name1__, _name2__, _NamedBase, \
27
28
  _NamedTuple, _Pass, _xnamed
28
29
  from pygeodesy.namedTuples import LatLon2Tuple, PhiLam2Tuple, Vector3Tuple
@@ -37,7 +38,7 @@ from pygeodesy.vector3d import Vector3d
37
38
  # from math import cos, radians # from .utily
38
39
 
39
40
  __all__ = _ALL_LAZY.ltpTuples
40
- __version__ = '24.12.06'
41
+ __version__ = '25.05.01'
41
42
 
42
43
  _aer_ = 'aer'
43
44
  _alt_ = 'alt'
@@ -48,6 +49,7 @@ _h__ = 'h_'
48
49
  _ned_ = 'ned'
49
50
  _north_ = 'north'
50
51
  _local_ = 'local'
52
+ _ltp = _MODS.into(ltp=__name__)
51
53
  _roll_ = 'roll'
52
54
  _slantrange_ = 'slantrange'
53
55
  _tilt_ = 'tilt'
@@ -158,25 +160,25 @@ class _Abc4Tuple(_NamedTuple):
158
160
  def _2Cls(self, Abc, Cls, Cls_kwds):
159
161
  '''(INTERNAL) Convert 4-Tuple to C{Cls} instance.
160
162
  '''
163
+ _isc = issubclassof
161
164
  kwds = _name1__(Cls_kwds, _or_nameof=self)
162
- _is = _MODS.basics.issubclassof
163
165
  if Cls is None:
164
166
  n, _ = _name2__(Cls_kwds)
165
167
  r = self.copy(name=n) if n else self
166
- elif _is(Cls, Abc):
168
+ elif _isc(Cls, Abc):
167
169
  r = Cls(*self, **kwds)
168
- elif _is(Cls, Aer):
170
+ elif _isc(Cls, Aer):
169
171
  r = self.xyzLocal.toAer(**_xkwds(kwds, Aer=Cls))
170
- elif _is(Cls, Enu): # PYCHOK no cover
172
+ elif _isc(Cls, Enu): # PYCHOK no cover
171
173
  r = self.xyzLocal.toEnu(**_xkwds(kwds, Enu=Cls))
172
- elif _is(Cls, Ned):
174
+ elif _isc(Cls, Ned):
173
175
  r = self.xyzLocal.toNed(**_xkwds(kwds, Ned=Cls))
174
- elif _is(Cls, XyzLocal): # PYCHOK no cover
176
+ elif _isc(Cls, XyzLocal): # PYCHOK no cover
175
177
  r = self.xyzLocal.toXyz(**_xkwds(kwds, Xyz=Cls))
176
178
  elif Cls is Local9Tuple: # PYCHOK no cover
177
179
  r = self.xyzLocal.toLocal9Tuple(**kwds)
178
180
  else: # PYCHOK no cover
179
- n = Abc.__name__[:3]
181
+ n = typename(Abc)[:3]
180
182
  raise _TypesError(n, Cls, Aer, Enu, Ned, XyzLocal)
181
183
  return r
182
184
 
@@ -383,7 +385,7 @@ class Attitude4Tuple(_NamedTuple):
383
385
  def tyr3d(self):
384
386
  '''Get this attitude's (3-D) directional vector (L{Vector3d}).
385
387
  '''
386
- return _MODS.ltp.Attitude(self).tyr3d
388
+ return _ltp.Attitude(self).tyr3d
387
389
 
388
390
 
389
391
  class Ned(_AbcBase):
@@ -731,7 +733,7 @@ class XyzLocal(_Vector3d):
731
733
  def _ltp_kwds_name3(self, ltp, kwds):
732
734
  '''(INTERNAL) Helper for methods C{toCartesian} and C{toLatLon}.
733
735
  '''
734
- ltp = _xLtp(ltp, self.ltp)
736
+ ltp = _ltp._xLtp(ltp, self.ltp)
735
737
  kwds = _name1__(kwds, _or_nameof=self)
736
738
  kwds = _name1__(kwds, _or_nameof=ltp)
737
739
  return ltp, kwds, kwds.get(_name_, NN)
@@ -965,10 +967,11 @@ class Enu(XyzLocal):
965
967
  I{local} instance (L{Enu}, L{Enu4Tuple}, L{Aer},
966
968
  L{Aer4Tuple}, L{Local9Tuple}, L{Ned}, L{Ned4Tuple},
967
969
  L{XyzLocal} or L{Xyz4Tuple}).
968
- @kwarg north: Scalar North component (C{meter}) only used with
969
- scalar B{C{east_enu}}.
970
- @kwarg up: Scalar Up component only used with scalar B{C{east_enu}},
971
- normal from the surface of the ellipsoid or sphere (C{meter}).
970
+ @kwarg north: Scalar North component (C{meter}), iff B{C{east_enu}}
971
+ is C{meter}, ignored otherwise.
972
+ @kwarg up: Scalar Up component (C{meter}, normal from the surface
973
+ of the ellipsoid or sphere), iff B{C{east_enu}} is
974
+ C{meter}, ignored otherwise.
972
975
  @kwarg ltp: The I{local tangent plane}, (geodetic) origin (L{Ltp},
973
976
  L{LocalCartesian}).
974
977
  @kwarg name: Optional C{B{name}=NN} (C{str}).
@@ -1249,10 +1252,12 @@ class Uvw(_Vector3d):
1249
1252
  def __init__(self, u_uvw, v=0, w=0, **name):
1250
1253
  '''New L{Uvw}.
1251
1254
 
1252
- @arg u_uvw: Scalar U component (C{meter}) or a previous instance
1253
- (L{Uvw}, L{Uvw3Tuple}, L{Vector3d}).
1254
- @kwarg v: V component (C{meter}) only used with scalar B{C{u_uvw}}.
1255
- @kwarg w: W component (C{meter}) only used with scalar B{C{u_uvw}}.
1255
+ @arg u_uvw: Scalar U component (C{meter}) or a previous instance (L{Uvw},
1256
+ L{Uvw3Tuple}, L{Vector3d}).
1257
+ @kwarg v: V component (C{meter}), iff B{C{u_uvw}} is C{meter}, ignored
1258
+ otherwise.
1259
+ @kwarg w: W component (C{meter}), iff B{C{u_uvw}} is C{meter}, ignored
1260
+ otherwise.
1256
1261
  @kwarg name: Optional C{B{name}=NN} (C{str}).
1257
1262
 
1258
1263
  @raise TypeError: Invalid B{C{east_enu}}.
@@ -1323,8 +1328,8 @@ class Los(Aer):
1323
1328
  or a previous instance (L{Aer}, L{Aer4Tuple}, L{Enu},
1324
1329
  L{Enu4Tuple} or L{Los}).
1325
1330
  @kwarg elevation: Scalar angle I{above} the horizon (C{degrees}, horizon
1326
- is 0, zenith +90, nadir -90), only used with scalar
1327
- B{C{azimuth_aer}}.
1331
+ is 0, zenith +90, nadir -90), if B{C{azimuth_aer}} is
1332
+ C{degrees}, ignored otherwise.
1328
1333
  @kwarg name: Optional C{B{name}=NN} (C{str}).
1329
1334
 
1330
1335
  @raise TypeError: Invalid B{C{azimuth_aer}}.
@@ -1388,19 +1393,19 @@ class ChLV9Tuple(Local9Tuple):
1388
1393
  def isChLV(self):
1389
1394
  '''Is this a L{ChLV}-generated L{ChLV9Tuple}?.
1390
1395
  '''
1391
- return self.ltp.__class__ is _MODS.ltp.ChLV
1396
+ return self.ltp.__class__ is _ltp.ChLV
1392
1397
 
1393
1398
  @property_RO
1394
1399
  def isChLVa(self):
1395
1400
  '''Is this a L{ChLVa}-generated L{ChLV9Tuple}?.
1396
1401
  '''
1397
- return self.ltp.__class__ is _MODS.ltp.ChLVa
1402
+ return self.ltp.__class__ is _ltp.ChLVa
1398
1403
 
1399
1404
  @property_RO
1400
1405
  def isChLVe(self):
1401
1406
  '''Is this a L{ChLVe}-generated L{ChLV9Tuple}?.
1402
1407
  '''
1403
- return self.ltp.__class__ is _MODS.ltp.ChLVe
1408
+ return self.ltp.__class__ is _ltp.ChLVe
1404
1409
 
1405
1410
  @Property_RO
1406
1411
  def N_LV95(self):
@@ -1526,7 +1531,7 @@ class Footprint5Tuple(_NamedTuple):
1526
1531
 
1527
1532
  @see: Methods L{XyzLocal.toLatLon} and L{Footprint5Tuple.xyzLocal5}.
1528
1533
  '''
1529
- ltp = _xLtp(ltp, self.center.ltp) # PYCHOK .center
1534
+ ltp = _ltp._xLtp(ltp, self.center.ltp) # PYCHOK .center
1530
1535
  kwds = _name1__(name_LatLon_kwds, _or_nameof=self)
1531
1536
  kwds = _xkwds(kwds, ltp=ltp, LatLon=LatLon)
1532
1537
  return Footprint5Tuple(t.toLatLon(**kwds) for t in self.xyzLocal5())
@@ -1544,7 +1549,7 @@ class Footprint5Tuple(_NamedTuple):
1544
1549
  if ltp is None:
1545
1550
  p = self
1546
1551
  else:
1547
- p = _xLtp(ltp)
1552
+ p = _ltp._xLtp(ltp)
1548
1553
  p = tuple(Xyz4Tuple(t.x, t.y, t.z, p) for t in self)
1549
1554
  return Footprint5Tuple(t.xyzLocal for t in p)
1550
1555
 
@@ -1552,13 +1557,13 @@ class Footprint5Tuple(_NamedTuple):
1552
1557
  def _ChLV_false2(Y, X, **LV95_name):
1553
1558
  '''(INTERNAL) Invoke static method C{ltp.ChLV.false2}.
1554
1559
  '''
1555
- return _MODS.ltp.ChLV.false2(Y, X, **LV95_name)
1560
+ return _ltp.ChLV.false2(Y, X, **LV95_name)
1556
1561
 
1557
1562
 
1558
1563
  def _ChLV_unfalse2(e, n, **LV95_name):
1559
1564
  '''(INTERNAL) Invoke static method C{ltp.ChLV.unfalse2}.
1560
1565
  '''
1561
- return _MODS.ltp.ChLV.unfalse2(e, n, **LV95_name)
1566
+ return _ltp.ChLV.unfalse2(e, n, **LV95_name)
1562
1567
 
1563
1568
 
1564
1569
  def _er2gr(e, r):
@@ -1577,7 +1582,7 @@ def _init(inst, abc, ltp, name):
1577
1582
  n = abc._name__(name)
1578
1583
  ltp = _xattr(abc, ltp=ltp)
1579
1584
  if ltp:
1580
- inst._ltp = _xLtp(ltp)
1585
+ inst._ltp = _ltp._xLtp(ltp)
1581
1586
  if n:
1582
1587
  inst.name = n
1583
1588
 
@@ -1595,12 +1600,6 @@ def _toStr2(inst, prec=None, fmt=Fmt.SQUARE, sep=_COMMASPACE_):
1595
1600
  return a, t
1596
1601
 
1597
1602
 
1598
- def _xLtp(ltp, *dflt):
1599
- '''(INTERNAL) Invoke C{ltp._xLtp}.
1600
- '''
1601
- return _MODS.ltp._xLtp(ltp, *dflt)
1602
-
1603
-
1604
1603
  def _xyz2aer4(inst):
1605
1604
  '''(INTERNAL) Convert C{(x, y, z}) to C{(A, E, R)}.
1606
1605
  '''
pygeodesy/mgrs.py CHANGED
@@ -35,14 +35,15 @@ and compare the MGRS results with those from I{Karney}'s utility U{GeoConvert
35
35
  <https://GeographicLib.sourceforge.io/C++/doc/GeoConvert.1.html>}.
36
36
  '''
37
37
 
38
- from pygeodesy.basics import halfs2, _splituple, _xinstanceof
38
+ from pygeodesy.basics import halfs2, _isin, _splituple, _xinstanceof
39
39
  # from pygeodesy.constants import _0_5 # from .units
40
40
  from pygeodesy.datums import _ellipsoidal_datum, _WGS84
41
41
  from pygeodesy.errors import _AssertionError, MGRSError, _parseX, \
42
42
  _ValueError, _xkwds
43
43
  from pygeodesy.interns import NN, _0_, _A_, _AtoZnoIO_, _band_, _B_, \
44
- _COMMASPACE_, _datum_, _easting_, _invalid_, \
45
- _northing_, _SPACE_, _W_, _Y_, _Z_, _zone_
44
+ _COMMASPACE_, _datum_, _DMAIN_, _easting_, \
45
+ _invalid_, _northing_, _SPACE_, _W_, _Y_, \
46
+ _Z_, _zone_
46
47
  from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
47
48
  from pygeodesy.named import _name2__, _NamedBase, _NamedTuple, _Pass
48
49
  from pygeodesy.namedTuples import EasNor2Tuple, UtmUps5Tuple
@@ -55,7 +56,7 @@ from pygeodesy.utm import toUtm8, _to3zBlat, Utm, _UTM_ZONE_MAX, _UTM_ZONE_MIN
55
56
  # from pygeodesy.utmupsBase import _UTM_ZONE_MAX, _UTM_ZONE_MIN # from .utm
56
57
 
57
58
  __all__ = _ALL_LAZY.mgrs
58
- __version__ = '24.11.06'
59
+ __version__ = '25.04.14'
59
60
 
60
61
  _AN_ = 'AN' # default south pole grid tile and band B
61
62
  _AtoPx_ = _AtoZnoIO_.tillP
@@ -128,7 +129,7 @@ class Mgrs(_NamedBase):
128
129
 
129
130
  self._easting = Easting(easting, Error=MGRSError)
130
131
  self._northing = Northing(northing, Error=MGRSError)
131
- if datum not in (None, Mgrs._datum):
132
+ if not _isin(datum, None, Mgrs._datum):
132
133
  self._datum = _ellipsoidal_datum(datum, name=name) # XXX raiser=_datum_
133
134
 
134
135
  if resolution:
@@ -649,7 +650,7 @@ def _um100km2(m):
649
650
  return int(M), m
650
651
 
651
652
 
652
- if __name__ == '__main__':
653
+ if __name__ == _DMAIN_:
653
654
 
654
655
  def _main():
655
656