pygeodesy 24.6.1__py2.py3-none-any.whl → 24.6.9__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.
- {PyGeodesy-24.6.1.dist-info → PyGeodesy-24.6.9.dist-info}/METADATA +2 -2
- {PyGeodesy-24.6.1.dist-info → PyGeodesy-24.6.9.dist-info}/RECORD +43 -43
- pygeodesy/__init__.py +1 -1
- pygeodesy/booleans.py +52 -65
- pygeodesy/cartesianBase.py +138 -147
- pygeodesy/ecef.py +46 -52
- pygeodesy/ellipsoidalBase.py +6 -43
- pygeodesy/ellipsoidalNvector.py +7 -7
- pygeodesy/errors.py +2 -2
- pygeodesy/frechet.py +3 -4
- pygeodesy/fsums.py +2 -2
- pygeodesy/geodsolve.py +23 -25
- pygeodesy/geohash.py +14 -27
- pygeodesy/geoids.py +1 -1
- pygeodesy/hausdorff.py +6 -7
- pygeodesy/heights.py +14 -27
- pygeodesy/internals.py +13 -12
- pygeodesy/interns.py +3 -9
- pygeodesy/iters.py +2 -2
- pygeodesy/latlonBase.py +189 -176
- pygeodesy/lazily.py +90 -54
- pygeodesy/lcc.py +2 -2
- pygeodesy/ltp.py +37 -17
- pygeodesy/ltpTuples.py +124 -115
- pygeodesy/mgrs.py +28 -1
- pygeodesy/named.py +92 -67
- pygeodesy/namedTuples.py +43 -14
- pygeodesy/nvectorBase.py +19 -22
- pygeodesy/points.py +2 -2
- pygeodesy/rhumb/solve.py +8 -61
- pygeodesy/solveBase.py +22 -19
- pygeodesy/sphericalBase.py +17 -11
- pygeodesy/streprs.py +6 -4
- pygeodesy/trf.py +3 -3
- pygeodesy/triaxials.py +70 -49
- pygeodesy/units.py +40 -65
- pygeodesy/unitsBase.py +2 -2
- pygeodesy/utily.py +5 -4
- pygeodesy/utmupsBase.py +2 -2
- pygeodesy/vector3d.py +34 -36
- pygeodesy/vector3dBase.py +12 -9
- {PyGeodesy-24.6.1.dist-info → PyGeodesy-24.6.9.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.6.1.dist-info → PyGeodesy-24.6.9.dist-info}/top_level.txt +0 -0
pygeodesy/ltpTuples.py
CHANGED
|
@@ -13,7 +13,7 @@ L{ChLVYX2Tuple}, L{ChLVyx2Tuple} and L{Footprint5Tuple}.
|
|
|
13
13
|
|
|
14
14
|
# from pygeodesy.basics import issubclassof # from .units
|
|
15
15
|
from pygeodesy.constants import _0_0, _1_0, _90_0, _N_90_0
|
|
16
|
-
from pygeodesy.dms import F_D, toDMS
|
|
16
|
+
# from pygeodesy.dms import F_D, toDMS # _MODS
|
|
17
17
|
from pygeodesy.errors import _TypeError, _TypesError, _xattr, \
|
|
18
18
|
_xkwds, _xkwds_item2
|
|
19
19
|
from pygeodesy.fmath import hypot, hypot_
|
|
@@ -30,13 +30,13 @@ from pygeodesy.props import deprecated_method, deprecated_Property_RO, \
|
|
|
30
30
|
from pygeodesy.streprs import Fmt, fstr, strs, _xzipairs
|
|
31
31
|
from pygeodesy.units import Bearing, Degrees, Degrees_, Height, _isDegrees, \
|
|
32
32
|
_isMeter, Lat, Lon, Meter, Meter_, issubclassof
|
|
33
|
-
from pygeodesy.utily import atan2d, atan2b, sincos2_, sincos2d_
|
|
33
|
+
from pygeodesy.utily import atan2d, atan2b, sincos2_, sincos2d_, cos, radians
|
|
34
34
|
from pygeodesy.vector3d import Vector3d
|
|
35
35
|
|
|
36
|
-
from math import cos, radians
|
|
36
|
+
# from math import cos, radians # from .utily
|
|
37
37
|
|
|
38
38
|
__all__ = _ALL_LAZY.ltpTuples
|
|
39
|
-
__version__ = '24.
|
|
39
|
+
__version__ = '24.06.08'
|
|
40
40
|
|
|
41
41
|
_aer_ = 'aer'
|
|
42
42
|
_alt_ = 'alt'
|
|
@@ -44,6 +44,7 @@ _down_ = 'down'
|
|
|
44
44
|
_east_ = 'east'
|
|
45
45
|
_enu_ = 'enu'
|
|
46
46
|
_h__ = 'h_'
|
|
47
|
+
_ltp = _MODS.into(ltp=__name__)
|
|
47
48
|
_ned_ = 'ned'
|
|
48
49
|
_north_ = 'north'
|
|
49
50
|
_local_ = 'local'
|
|
@@ -61,6 +62,20 @@ def _er2gr(e, r):
|
|
|
61
62
|
return Meter_(groundrange=r * c)
|
|
62
63
|
|
|
63
64
|
|
|
65
|
+
def _init(inst, abc, ltp, name):
|
|
66
|
+
'''(INTERNAL) Complete C{__init__}.
|
|
67
|
+
'''
|
|
68
|
+
if abc is None:
|
|
69
|
+
n = _name__(**name)
|
|
70
|
+
else:
|
|
71
|
+
n = abc._name__(name)
|
|
72
|
+
ltp = _xattr(abc, ltp=ltp)
|
|
73
|
+
if ltp:
|
|
74
|
+
inst._ltp = _ltp._xLtp(ltp)
|
|
75
|
+
if n:
|
|
76
|
+
inst.name = n
|
|
77
|
+
|
|
78
|
+
|
|
64
79
|
def _toStr2(inst, prec=None, fmt=Fmt.SQUARE, sep=_COMMASPACE_):
|
|
65
80
|
'''(INTERNAL) Get attribute name and value strings, joined and bracketed.
|
|
66
81
|
'''
|
|
@@ -74,25 +89,6 @@ def _toStr2(inst, prec=None, fmt=Fmt.SQUARE, sep=_COMMASPACE_):
|
|
|
74
89
|
return a, t
|
|
75
90
|
|
|
76
91
|
|
|
77
|
-
def _4Tuple2Cls(inst, Cls, Cls_kwds):
|
|
78
|
-
'''(INTERNAL) Convert 4-Tuple to C{Cls} instance.
|
|
79
|
-
'''
|
|
80
|
-
if Cls is None:
|
|
81
|
-
return inst
|
|
82
|
-
elif issubclassof(Cls, Aer):
|
|
83
|
-
return inst.xyzLocal.toAer(Aer=Cls, **Cls_kwds)
|
|
84
|
-
elif issubclassof(Cls, Enu): # PYCHOK no cover
|
|
85
|
-
return inst.xyzLocal.toEnu(Enu=Cls, **Cls_kwds)
|
|
86
|
-
elif issubclassof(Cls, Ned):
|
|
87
|
-
return inst.xyzLocal.toNed(Ned=Cls, **Cls_kwds)
|
|
88
|
-
elif issubclassof(Cls, XyzLocal): # PYCHOK no cover
|
|
89
|
-
return inst.xyzLocal.toXyz(Xyz=Cls, **Cls_kwds)
|
|
90
|
-
elif Cls is Local9Tuple: # PYCHOK no cover
|
|
91
|
-
return inst.xyzLocal.toLocal9Tuple(**Cls_kwds)
|
|
92
|
-
n = inst.__class__.__name__[:3] # PYCHOK no cover
|
|
93
|
-
raise _TypesError(n, Cls, Aer, Enu, Ned, XyzLocal)
|
|
94
|
-
|
|
95
|
-
|
|
96
92
|
def _xyz2aer4(inst):
|
|
97
93
|
'''(INTERNAL) Convert C{(x, y, z}) to C{(A, E, R)}.
|
|
98
94
|
'''
|
|
@@ -115,10 +111,10 @@ def _xyzLocal(*Types, **name_inst):
|
|
|
115
111
|
raise _TypeError(n, inst, txt_not_=_local_)
|
|
116
112
|
|
|
117
113
|
|
|
118
|
-
class
|
|
114
|
+
class _AbcBase(_NamedBase):
|
|
119
115
|
'''(INTERNAL) Base class for classes C{Aer} and C{Ned}.
|
|
120
116
|
'''
|
|
121
|
-
_ltp =
|
|
117
|
+
_ltp = None # local tangent plane (C{Ltp}), origin
|
|
122
118
|
|
|
123
119
|
@Property_RO
|
|
124
120
|
def ltp(self):
|
|
@@ -205,7 +201,42 @@ class _NamedAerNed(_NamedBase):
|
|
|
205
201
|
return XyzLocal(self.xyz4, name=self.name)
|
|
206
202
|
|
|
207
203
|
|
|
208
|
-
class
|
|
204
|
+
class _Abc4Tuple(_NamedTuple):
|
|
205
|
+
'''(INTERNAL) Base class for C{Aer4Tuple}, C{Enu4Tuple},
|
|
206
|
+
C{Ned4Tuple} and C{Xyz4Tuple}.
|
|
207
|
+
'''
|
|
208
|
+
def _2Cls(self, Abc, Cls, Cls_kwds):
|
|
209
|
+
'''(INTERNAL) Convert 4-Tuple to C{Cls} instance.
|
|
210
|
+
'''
|
|
211
|
+
kwds = _name1__(Cls_kwds, _or_nameof=self)
|
|
212
|
+
_is = issubclassof
|
|
213
|
+
if Cls is None:
|
|
214
|
+
n, _ = _name2__(Cls_kwds)
|
|
215
|
+
r = self.copy(name=n) if n else self
|
|
216
|
+
elif _is(Cls, Abc):
|
|
217
|
+
r = Cls(*self, **kwds)
|
|
218
|
+
elif _is(Cls, Aer):
|
|
219
|
+
r = self.xyzLocal.toAer(**_xkwds(kwds, Aer=Cls))
|
|
220
|
+
elif _is(Cls, Enu): # PYCHOK no cover
|
|
221
|
+
r = self.xyzLocal.toEnu(**_xkwds(kwds, Enu=Cls))
|
|
222
|
+
elif _is(Cls, Ned):
|
|
223
|
+
r = self.xyzLocal.toNed(**_xkwds(kwds, Ned=Cls))
|
|
224
|
+
elif _is(Cls, XyzLocal): # PYCHOK no cover
|
|
225
|
+
r = self.xyzLocal.toXyz(**_xkwds(kwds, Xyz=Cls))
|
|
226
|
+
elif Cls is Local9Tuple: # PYCHOK no cover
|
|
227
|
+
r = self.xyzLocal.toLocal9Tuple(**kwds)
|
|
228
|
+
else: # PYCHOK no cover
|
|
229
|
+
n = Abc.__name__[:3]
|
|
230
|
+
raise _TypesError(n, Cls, Aer, Enu, Ned, XyzLocal)
|
|
231
|
+
return r
|
|
232
|
+
|
|
233
|
+
@property_RO
|
|
234
|
+
def xyzLocal(self): # PYCHOK no cover
|
|
235
|
+
'''I{Must be overloaded}.'''
|
|
236
|
+
self._notOverloaded()
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class Aer(_AbcBase):
|
|
209
240
|
'''Local C{Azimuth-Elevation-Range} (AER) in a I{local tangent plane}.
|
|
210
241
|
'''
|
|
211
242
|
_azimuth = _0_0 # bearing from North (C{degrees360})
|
|
@@ -236,22 +267,16 @@ class Aer(_NamedAerNed):
|
|
|
236
267
|
or B{C{slantrange}}.
|
|
237
268
|
'''
|
|
238
269
|
if _isDegrees(azimuth_aer):
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
270
|
+
aer = None
|
|
271
|
+
t = (Bearing(azimuth=azimuth_aer),
|
|
272
|
+
Degrees_(elevation=elevation, low=_N_90_0, high=_90_0),
|
|
273
|
+
Meter_(slantrange=slantrange), ltp)
|
|
243
274
|
else: # PYCHOK no cover
|
|
244
|
-
p
|
|
245
|
-
aer =
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
n = aer._name__(name)
|
|
250
|
-
|
|
251
|
-
if p:
|
|
252
|
-
self._ltp = _MODS.ltp._xLtp(p)
|
|
253
|
-
if n:
|
|
254
|
-
self.name = n
|
|
275
|
+
p = _xyzLocal(Aer, Aer4Tuple, Ned, azimuth_aer=azimuth_aer)
|
|
276
|
+
aer = p.toAer() if p else azimuth_aer
|
|
277
|
+
t = aer.aer4
|
|
278
|
+
self._azimuth, self._elevation, self._slantrange, _ = t
|
|
279
|
+
_init(self, aer, ltp, name)
|
|
255
280
|
|
|
256
281
|
@Property_RO
|
|
257
282
|
def aer4(self):
|
|
@@ -311,8 +336,9 @@ class Aer(_NamedAerNed):
|
|
|
311
336
|
|
|
312
337
|
@return: This AER as "[A:degrees360, E:degrees90, R:meter]" (C{str}).
|
|
313
338
|
'''
|
|
314
|
-
|
|
315
|
-
|
|
339
|
+
m = _MODS.dms
|
|
340
|
+
t = (m.toDMS(self.azimuth, form=m.F_D, prec=prec, ddd=0),
|
|
341
|
+
m.toDMS(self.elevation, form=m.F_D, prec=prec, ddd=0),
|
|
316
342
|
fstr( self.slantrange, prec=3 if prec is None else prec))
|
|
317
343
|
return _xzipairs(self._toStr.upper(), t, sep=sep, fmt=fmt)
|
|
318
344
|
|
|
@@ -364,7 +390,7 @@ class Aer(_NamedAerNed):
|
|
|
364
390
|
return self.xyz4.z
|
|
365
391
|
|
|
366
392
|
|
|
367
|
-
class Aer4Tuple(
|
|
393
|
+
class Aer4Tuple(_Abc4Tuple):
|
|
368
394
|
'''4-Tuple C{(azimuth, elevation, slantrange, ltp)},
|
|
369
395
|
all in C{meter} except C{ltp}.
|
|
370
396
|
'''
|
|
@@ -374,10 +400,7 @@ class Aer4Tuple(_NamedTuple):
|
|
|
374
400
|
def _toAer(self, Cls, Cls_kwds):
|
|
375
401
|
'''(INTERNAL) Return C{Cls(..., **Cls_kwds)} instance.
|
|
376
402
|
'''
|
|
377
|
-
|
|
378
|
-
return Cls(*self, **_xkwds(Cls_kwds, name=self.name))
|
|
379
|
-
else:
|
|
380
|
-
return _4Tuple2Cls(self, Cls, Cls_kwds)
|
|
403
|
+
return self._2Cls(Aer, Cls, Cls_kwds)
|
|
381
404
|
|
|
382
405
|
@Property_RO
|
|
383
406
|
def groundrange(self):
|
|
@@ -410,10 +433,10 @@ class Attitude4Tuple(_NamedTuple):
|
|
|
410
433
|
def tyr3d(self):
|
|
411
434
|
'''Get this attitude's (3-D) directional vector (L{Vector3d}).
|
|
412
435
|
'''
|
|
413
|
-
return
|
|
436
|
+
return _ltp.Attitude(self).tyr3d
|
|
414
437
|
|
|
415
438
|
|
|
416
|
-
class Ned(
|
|
439
|
+
class Ned(_AbcBase):
|
|
417
440
|
'''Local C{North-Eeast-Down} (NED) location in a I{local tangent plane}.
|
|
418
441
|
|
|
419
442
|
@see: L{Enu} and L{Ltp}.
|
|
@@ -445,21 +468,16 @@ class Ned(_NamedAerNed):
|
|
|
445
468
|
@raise UnitError: Invalid B{C{north_ned}}, B{C{east}} or B{C{down}}.
|
|
446
469
|
'''
|
|
447
470
|
if _isMeter(north_ned):
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
471
|
+
ned = None
|
|
472
|
+
t = (Meter(north=north_ned or _0_0),
|
|
473
|
+
Meter(east=east or _0_0),
|
|
474
|
+
Meter(down=down or _0_0), ltp)
|
|
452
475
|
else: # PYCHOK no cover
|
|
453
|
-
p
|
|
454
|
-
ned =
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
if p:
|
|
460
|
-
self._ltp = _MODS.ltp._xLtp(p)
|
|
461
|
-
if n:
|
|
462
|
-
self.name = n
|
|
476
|
+
p = _xyzLocal(Ned, Ned4Tuple, Aer, north_ned=north_ned)
|
|
477
|
+
ned = p.toNed() if p else north_ned
|
|
478
|
+
t = ned.ned4
|
|
479
|
+
self._north, self._east, self._down, _ = t
|
|
480
|
+
_init(self, ned, ltp, name)
|
|
463
481
|
|
|
464
482
|
@Property_RO
|
|
465
483
|
def aer4(self):
|
|
@@ -597,7 +615,7 @@ class Ned(_NamedAerNed):
|
|
|
597
615
|
return Meter(z=-self._down) # negated
|
|
598
616
|
|
|
599
617
|
|
|
600
|
-
class Ned4Tuple(
|
|
618
|
+
class Ned4Tuple(_Abc4Tuple):
|
|
601
619
|
'''4-Tuple C{(north, east, down, ltp)}, all in C{meter} except C{ltp}.
|
|
602
620
|
'''
|
|
603
621
|
_Names_ = (_north_, _east_, _down_, _ltp_)
|
|
@@ -606,10 +624,7 @@ class Ned4Tuple(_NamedTuple):
|
|
|
606
624
|
def _toNed(self, Cls, Cls_kwds):
|
|
607
625
|
'''(INTERNAL) Return C{Cls(..., **Cls_kwds)} instance.
|
|
608
626
|
'''
|
|
609
|
-
|
|
610
|
-
return Cls(*self, **_xkwds(Cls_kwds, name=self.name))
|
|
611
|
-
else:
|
|
612
|
-
return _4Tuple2Cls(self, Cls, Cls_kwds)
|
|
627
|
+
return self._2Cls(Ned, Cls, Cls_kwds)
|
|
613
628
|
|
|
614
629
|
@Property_RO
|
|
615
630
|
def xyzLocal(self):
|
|
@@ -679,20 +694,15 @@ class XyzLocal(_Vector3d):
|
|
|
679
694
|
@raise UnitError: Invalid scalar B{C{x_xyz}}, B{C{y}} or B{C{z}}.
|
|
680
695
|
'''
|
|
681
696
|
if _isMeter(x_xyz):
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
697
|
+
xyz = None
|
|
698
|
+
t = (Meter(x=x_xyz or _0_0),
|
|
699
|
+
Meter(y=y or _0_0),
|
|
700
|
+
Meter(z=z or _0_0), ltp)
|
|
686
701
|
else:
|
|
687
702
|
xyz = _xyzLocal(XyzLocal, Xyz4Tuple, Local9Tuple, x_xyz=x_xyz) or x_xyz
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
if p:
|
|
693
|
-
self._ltp = _MODS.ltp._xLtp(p)
|
|
694
|
-
if n:
|
|
695
|
-
self.name = n
|
|
703
|
+
t = xyz.xyz4 # xyz.x, xyz.y, xyz.z, xyz.ltp
|
|
704
|
+
self._x, self._y, self._z, _ = t
|
|
705
|
+
_init(self, xyz, ltp, name)
|
|
696
706
|
|
|
697
707
|
def __str__(self):
|
|
698
708
|
return self.toStr()
|
|
@@ -771,7 +781,7 @@ class XyzLocal(_Vector3d):
|
|
|
771
781
|
def _ltp_kwds_name3(self, ltp, kwds):
|
|
772
782
|
'''(INTERNAL) Helper for methods C{toCartesian} and C{toLatLon}.
|
|
773
783
|
'''
|
|
774
|
-
ltp =
|
|
784
|
+
ltp = _ltp._xLtp(ltp, self.ltp)
|
|
775
785
|
kwds = _name1__(kwds, _or_nameof=self)
|
|
776
786
|
kwds = _name1__(kwds, _or_nameof=ltp)
|
|
777
787
|
return ltp, kwds, kwds.get(_name_, NN)
|
|
@@ -795,7 +805,7 @@ class XyzLocal(_Vector3d):
|
|
|
795
805
|
return self.aer4.slantrange
|
|
796
806
|
|
|
797
807
|
def toAer(self, Aer=None, **name_Aer_kwds):
|
|
798
|
-
'''Get the local I{Azimuth, Elevation,
|
|
808
|
+
'''Get the local I{Azimuth, Elevation, slant Range} components.
|
|
799
809
|
|
|
800
810
|
@kwarg Aer: Class to return AER (L{Aer}) or C{None}.
|
|
801
811
|
@kwarg name_Aer_kwds: Optional C{B{name}=NN} (C{str}) and
|
|
@@ -832,9 +842,9 @@ class XyzLocal(_Vector3d):
|
|
|
832
842
|
t = ltp._local2ecef(self, nine=True)
|
|
833
843
|
r = _xnamed(t, n) if n else t
|
|
834
844
|
else:
|
|
835
|
-
kwds
|
|
836
|
-
|
|
837
|
-
r
|
|
845
|
+
kwds = _xkwds(kwds, datum=ltp.datum)
|
|
846
|
+
xyz = ltp._local2ecef(self) # [:3]
|
|
847
|
+
r = Cartesian(*xyz, **kwds)
|
|
838
848
|
return r
|
|
839
849
|
|
|
840
850
|
def toEnu(self, Enu=None, **name_Enu_kwds):
|
|
@@ -876,7 +886,7 @@ class XyzLocal(_Vector3d):
|
|
|
876
886
|
r = _xnamed(t, n) if n else t
|
|
877
887
|
else:
|
|
878
888
|
kwds = _xkwds(kwds, height=t.height, datum=t.datum)
|
|
879
|
-
r
|
|
889
|
+
r = LatLon(t.lat, t.lon, **kwds) # XXX ltp?
|
|
880
890
|
return r
|
|
881
891
|
|
|
882
892
|
def toLocal9Tuple(self, M=False, **name):
|
|
@@ -891,8 +901,9 @@ class XyzLocal(_Vector3d):
|
|
|
891
901
|
'''
|
|
892
902
|
ltp = self.ltp # see C{self.toLatLon}
|
|
893
903
|
t = ltp._local2ecef(self, nine=True, M=M)
|
|
894
|
-
return Local9Tuple(self.x, self.y, self.z,
|
|
895
|
-
|
|
904
|
+
return Local9Tuple(self.x, self.y, self.z,
|
|
905
|
+
t.lat, t.lon, t.height,
|
|
906
|
+
ltp, t, t.M, name=t._name__(name))
|
|
896
907
|
|
|
897
908
|
def toNed(self, Ned=None, **name_Ned_kwds):
|
|
898
909
|
'''Get the local I{North, East, Down} (Ned) components.
|
|
@@ -968,7 +979,7 @@ class XyzLocal(_Vector3d):
|
|
|
968
979
|
# return self._z
|
|
969
980
|
|
|
970
981
|
|
|
971
|
-
class Xyz4Tuple(
|
|
982
|
+
class Xyz4Tuple(_Abc4Tuple):
|
|
972
983
|
'''4-Tuple C{(x, y, z, ltp)}, all in C{meter} except C{ltp}.
|
|
973
984
|
'''
|
|
974
985
|
_Names_ = (_x_, _y_, _z_, _ltp_)
|
|
@@ -977,11 +988,13 @@ class Xyz4Tuple(_NamedTuple):
|
|
|
977
988
|
def _toXyz(self, Cls, Cls_kwds):
|
|
978
989
|
'''(INTERNAL) Return C{Cls(..., **Cls_kwds)} instance.
|
|
979
990
|
'''
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
991
|
+
return self._2Cls(XyzLocal, Cls, Cls_kwds)
|
|
992
|
+
|
|
993
|
+
@property_RO
|
|
994
|
+
def xyz4(self):
|
|
995
|
+
'''Get the C{(x, y, z, ltp)} components (L{Xyz4Tuple}).
|
|
996
|
+
'''
|
|
997
|
+
return self
|
|
985
998
|
|
|
986
999
|
@Property_RO
|
|
987
1000
|
def xyzLocal(self):
|
|
@@ -1049,7 +1062,7 @@ class Enu(XyzLocal):
|
|
|
1049
1062
|
|
|
1050
1063
|
n, kwds = _name2__(name_Uvw_kwds, _or_nameof=self)
|
|
1051
1064
|
return Uvw3Tuple(U, V, W, name=n) if Uvw is None else \
|
|
1052
|
-
|
|
1065
|
+
Uvw(U, V, W, name=n, **kwds)
|
|
1053
1066
|
|
|
1054
1067
|
@Property_RO
|
|
1055
1068
|
def xyzLocal(self):
|
|
@@ -1058,7 +1071,7 @@ class Enu(XyzLocal):
|
|
|
1058
1071
|
return XyzLocal(*self.xyz4, name=self.name)
|
|
1059
1072
|
|
|
1060
1073
|
|
|
1061
|
-
class Enu4Tuple(
|
|
1074
|
+
class Enu4Tuple(_Abc4Tuple):
|
|
1062
1075
|
'''4-Tuple C{(east, north, up, ltp)}, in C{meter} except C{ltp}.
|
|
1063
1076
|
'''
|
|
1064
1077
|
_Names_ = (_east_, _north_, _up_, _ltp_)
|
|
@@ -1067,11 +1080,7 @@ class Enu4Tuple(_NamedTuple):
|
|
|
1067
1080
|
def _toEnu(self, Cls, Cls_kwds):
|
|
1068
1081
|
'''(INTERNAL) Return C{Cls(..., **Cls_kwds)} instance.
|
|
1069
1082
|
'''
|
|
1070
|
-
|
|
1071
|
-
if issubclassof(Cls, XyzLocal):
|
|
1072
|
-
return Cls(*self, **kwds)
|
|
1073
|
-
else:
|
|
1074
|
-
return _4Tuple2Cls(self, Cls, kwds)
|
|
1083
|
+
return self._2Cls(Enu, Cls, Cls_kwds)
|
|
1075
1084
|
|
|
1076
1085
|
@Property_RO
|
|
1077
1086
|
def xyzLocal(self):
|
|
@@ -1335,7 +1344,7 @@ class Uvw(_Vector3d):
|
|
|
1335
1344
|
|
|
1336
1345
|
n, kwds = _name2__(name_Enu_kwds, _or_nameof=self)
|
|
1337
1346
|
return Enu4Tuple(E, N, U, name=n) if Enu is None else \
|
|
1338
|
-
|
|
1347
|
+
Enu(E, N, U, name=n, **kwds)
|
|
1339
1348
|
|
|
1340
1349
|
u = Vector3d.x
|
|
1341
1350
|
|
|
@@ -1382,7 +1391,7 @@ class Los(Aer):
|
|
|
1382
1391
|
'''Get this LOS' I{target} (UVW) components from a location.
|
|
1383
1392
|
|
|
1384
1393
|
@arg location: The geodetic (C{LatLon}) or geocentric (C{Cartesian},
|
|
1385
|
-
L{Vector3d}) location from where to cast
|
|
1394
|
+
L{Vector3d}) location from where to cast this LOS.
|
|
1386
1395
|
|
|
1387
1396
|
@see: Method L{Enu.toUvw} for further details.
|
|
1388
1397
|
'''
|
|
@@ -1414,7 +1423,7 @@ class ChLV9Tuple(Local9Tuple):
|
|
|
1414
1423
|
def EN2_LV95(self):
|
|
1415
1424
|
'''Get the I{falsed Swiss (E_LV95, N_LV95)} easting and northing (L{ChLVEN2Tuple}).
|
|
1416
1425
|
'''
|
|
1417
|
-
return ChLVEN2Tuple(*
|
|
1426
|
+
return ChLVEN2Tuple(*_ltp.ChLV.false2(self.Y, self.X, True), name=self.name)
|
|
1418
1427
|
|
|
1419
1428
|
@Property_RO
|
|
1420
1429
|
def h_LV03(self):
|
|
@@ -1432,19 +1441,19 @@ class ChLV9Tuple(Local9Tuple):
|
|
|
1432
1441
|
def isChLV(self):
|
|
1433
1442
|
'''Is this a L{ChLV}-generated L{ChLV9Tuple}?.
|
|
1434
1443
|
'''
|
|
1435
|
-
return self.ltp.__class__ is
|
|
1444
|
+
return self.ltp.__class__ is _ltp.ChLV
|
|
1436
1445
|
|
|
1437
1446
|
@property_RO
|
|
1438
1447
|
def isChLVa(self):
|
|
1439
1448
|
'''Is this a L{ChLVa}-generated L{ChLV9Tuple}?.
|
|
1440
1449
|
'''
|
|
1441
|
-
return self.ltp.__class__ is
|
|
1450
|
+
return self.ltp.__class__ is _ltp.ChLVa
|
|
1442
1451
|
|
|
1443
1452
|
@property_RO
|
|
1444
1453
|
def isChLVe(self):
|
|
1445
1454
|
'''Is this a L{ChLVe}-generated L{ChLV9Tuple}?.
|
|
1446
1455
|
'''
|
|
1447
|
-
return self.ltp.__class__ is
|
|
1456
|
+
return self.ltp.__class__ is _ltp.ChLVe
|
|
1448
1457
|
|
|
1449
1458
|
@Property_RO
|
|
1450
1459
|
def N_LV95(self):
|
|
@@ -1486,7 +1495,7 @@ class ChLV9Tuple(Local9Tuple):
|
|
|
1486
1495
|
def yx2_LV03(self):
|
|
1487
1496
|
'''Get the B{falsed} I{Swiss (y_LV03, x_LV03)} easting and northing (L{ChLVyx2Tuple}).
|
|
1488
1497
|
'''
|
|
1489
|
-
return ChLVyx2Tuple(*
|
|
1498
|
+
return ChLVyx2Tuple(*_ltp.ChLV.false2(self.Y, self.X, False), name=self.name)
|
|
1490
1499
|
|
|
1491
1500
|
@Property_RO
|
|
1492
1501
|
def z(self):
|
|
@@ -1507,7 +1516,7 @@ class ChLVYX2Tuple(_NamedTuple):
|
|
|
1507
1516
|
|
|
1508
1517
|
@see: Function L{ChLV.false2} for more information.
|
|
1509
1518
|
'''
|
|
1510
|
-
return
|
|
1519
|
+
return _ltp.ChLV.false2(*self, LV95=LV95, name=self.name)
|
|
1511
1520
|
|
|
1512
1521
|
|
|
1513
1522
|
class ChLVEN2Tuple(_NamedTuple):
|
|
@@ -1522,7 +1531,7 @@ class ChLVEN2Tuple(_NamedTuple):
|
|
|
1522
1531
|
|
|
1523
1532
|
@see: Function L{ChLV.unfalse2} for more information.
|
|
1524
1533
|
'''
|
|
1525
|
-
return
|
|
1534
|
+
return _ltp.ChLV.unfalse2(*self, LV95=True, name=self.name)
|
|
1526
1535
|
|
|
1527
1536
|
|
|
1528
1537
|
class ChLVyx2Tuple(_NamedTuple):
|
|
@@ -1537,7 +1546,7 @@ class ChLVyx2Tuple(_NamedTuple):
|
|
|
1537
1546
|
|
|
1538
1547
|
@see: Function L{ChLV.unfalse2} for more information.
|
|
1539
1548
|
'''
|
|
1540
|
-
return
|
|
1549
|
+
return _ltp.ChLV.unfalse2(*self, LV95=False, name=self.name)
|
|
1541
1550
|
|
|
1542
1551
|
|
|
1543
1552
|
class Footprint5Tuple(_NamedTuple):
|
|
@@ -1571,7 +1580,7 @@ class Footprint5Tuple(_NamedTuple):
|
|
|
1571
1580
|
|
|
1572
1581
|
@see: Methods L{XyzLocal.toLatLon} and L{Footprint5Tuple.xyzLocal5}.
|
|
1573
1582
|
'''
|
|
1574
|
-
ltp =
|
|
1583
|
+
ltp = _ltp._xLtp(ltp, self.center.ltp) # PYCHOK .center
|
|
1575
1584
|
kwds = _name1__(name_LatLon_kwds, _or_nameof=self)
|
|
1576
1585
|
kwds = _xkwds(kwds, ltp=ltp, LatLon=LatLon)
|
|
1577
1586
|
return Footprint5Tuple(t.toLatLon(**kwds) for t in self.xyzLocal5())
|
|
@@ -1589,12 +1598,12 @@ class Footprint5Tuple(_NamedTuple):
|
|
|
1589
1598
|
if ltp is None:
|
|
1590
1599
|
p = self
|
|
1591
1600
|
else:
|
|
1592
|
-
p =
|
|
1601
|
+
p = _ltp._xLtp(ltp)
|
|
1593
1602
|
p = tuple(Xyz4Tuple(t.x, t.y, t.z, p) for t in self)
|
|
1594
1603
|
return Footprint5Tuple(t.xyzLocal for t in p)
|
|
1595
1604
|
|
|
1596
1605
|
|
|
1597
|
-
__all__ += _ALL_DOCS(
|
|
1606
|
+
__all__ += _ALL_DOCS(_AbcBase)
|
|
1598
1607
|
|
|
1599
1608
|
# **) MIT License
|
|
1600
1609
|
#
|
pygeodesy/mgrs.py
CHANGED
|
@@ -55,7 +55,7 @@ from pygeodesy.utm import toUtm8, _to3zBlat, Utm, _UTM_ZONE_MAX, _UTM_ZONE_MIN
|
|
|
55
55
|
# from pygeodesy.utmupsBase import _UTM_ZONE_MAX, _UTM_ZONE_MIN # from .utm
|
|
56
56
|
|
|
57
57
|
__all__ = _ALL_LAZY.mgrs
|
|
58
|
-
__version__ = '24.
|
|
58
|
+
__version__ = '24.06.04'
|
|
59
59
|
|
|
60
60
|
_AN_ = 'AN' # default south pole grid tile and band B
|
|
61
61
|
_AtoPx_ = _AtoZnoIO_.tillP
|
|
@@ -699,6 +699,33 @@ if __name__ == '__main__':
|
|
|
699
699
|
p = e * 100.0 / n
|
|
700
700
|
printf('%6s: %s errors (%.2f%%)', n, (e if e else 'no'), p)
|
|
701
701
|
|
|
702
|
+
# % python3 -m pygeodesy.mgrs
|
|
703
|
+
# using: /opt/local/bin/GeoConvert -m ...
|
|
704
|
+
# 0: lat -90 ... OK
|
|
705
|
+
# 361: lat -89 ... OK
|
|
706
|
+
# 722: lat -88 ... OK
|
|
707
|
+
# 1083: lat -87 ... OK
|
|
708
|
+
# 1444: lat -86 ... OK
|
|
709
|
+
# 1805: lat -85 ... OK
|
|
710
|
+
# 2166: lat -84 ... OK
|
|
711
|
+
# 2527: lat -83 ... OK
|
|
712
|
+
# 2888: lat -82 ... OK
|
|
713
|
+
# 3249: lat -81 ... OK
|
|
714
|
+
# 3610: lat -80 ... OK
|
|
715
|
+
# ...
|
|
716
|
+
# 61370: lat 80 ... OK
|
|
717
|
+
# 61731: lat 81 ... OK
|
|
718
|
+
# 62092: lat 82 ... OK
|
|
719
|
+
# 62453: lat 83 ... OK
|
|
720
|
+
# 62814: lat 84 ... OK
|
|
721
|
+
# 63175: lat 85 ... OK
|
|
722
|
+
# 63536: lat 86 ... OK
|
|
723
|
+
# 63897: lat 87 ... OK
|
|
724
|
+
# 64258: lat 88 ... OK
|
|
725
|
+
# 64619: lat 89 ... OK
|
|
726
|
+
# 64980: lat 90 ... OK
|
|
727
|
+
# 65341: no errors (0.00%)
|
|
728
|
+
|
|
702
729
|
# **) MIT License
|
|
703
730
|
#
|
|
704
731
|
# Copyright (C) 2016-2024 -- mrJean1 at Gmail -- All Rights Reserved.
|