pygeodesy 24.10.24__py2.py3-none-any.whl → 24.12.12__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.10.24.dist-info → PyGeodesy-24.12.12.dist-info}/METADATA +6 -6
- PyGeodesy-24.12.12.dist-info/RECORD +118 -0
- {PyGeodesy-24.10.24.dist-info → PyGeodesy-24.12.12.dist-info}/WHEEL +1 -1
- pygeodesy/__init__.py +5 -5
- pygeodesy/__main__.py +1 -1
- pygeodesy/albers.py +5 -5
- pygeodesy/auxilats/_CX_4.py +1 -1
- pygeodesy/auxilats/_CX_6.py +1 -1
- pygeodesy/auxilats/_CX_8.py +1 -1
- pygeodesy/auxilats/_CX_Rs.py +1 -1
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/__main__.py +1 -1
- pygeodesy/auxilats/auxAngle.py +5 -5
- pygeodesy/auxilats/auxDLat.py +6 -6
- pygeodesy/auxilats/auxDST.py +2 -2
- pygeodesy/auxilats/auxLat.py +5 -5
- pygeodesy/auxilats/auxily.py +2 -2
- pygeodesy/azimuthal.py +55 -65
- pygeodesy/basics.py +35 -34
- pygeodesy/booleans.py +37 -37
- pygeodesy/cartesianBase.py +26 -65
- pygeodesy/clipy.py +1 -1
- pygeodesy/constants.py +7 -7
- pygeodesy/css.py +8 -9
- pygeodesy/datums.py +1 -1
- pygeodesy/deprecated/__init__.py +2 -2
- pygeodesy/deprecated/bases.py +1 -1
- pygeodesy/deprecated/classes.py +10 -10
- pygeodesy/deprecated/consterns.py +1 -1
- pygeodesy/deprecated/datum.py +1 -1
- pygeodesy/deprecated/functions.py +23 -13
- pygeodesy/deprecated/nvector.py +1 -1
- pygeodesy/deprecated/rhumbBase.py +1 -1
- pygeodesy/deprecated/rhumbaux.py +1 -1
- pygeodesy/deprecated/rhumbsolve.py +1 -1
- pygeodesy/deprecated/rhumbx.py +1 -1
- pygeodesy/dms.py +1 -1
- pygeodesy/ecef.py +63 -69
- pygeodesy/elevations.py +1 -1
- pygeodesy/ellipsoidalBase.py +106 -121
- pygeodesy/ellipsoidalBaseDI.py +115 -119
- pygeodesy/ellipsoidalExact.py +36 -38
- pygeodesy/ellipsoidalGeodSolve.py +1 -1
- pygeodesy/ellipsoidalKarney.py +1 -1
- pygeodesy/ellipsoidalNvector.py +1 -1
- pygeodesy/ellipsoidalVincenty.py +6 -5
- pygeodesy/ellipsoids.py +7 -8
- pygeodesy/elliptic.py +6 -6
- pygeodesy/epsg.py +1 -1
- pygeodesy/errors.py +25 -25
- pygeodesy/etm.py +84 -76
- pygeodesy/fmath.py +54 -51
- pygeodesy/formy.py +74 -106
- pygeodesy/frechet.py +1 -1
- pygeodesy/fstats.py +1 -1
- pygeodesy/fsums.py +82 -72
- pygeodesy/gars.py +1 -1
- pygeodesy/geodesici.py +4 -4
- pygeodesy/geodesicw.py +16 -15
- pygeodesy/geodesicx/_C4_24.py +2 -2
- pygeodesy/geodesicx/_C4_27.py +2 -2
- pygeodesy/geodesicx/_C4_30.py +2 -2
- pygeodesy/geodesicx/__init__.py +3 -3
- pygeodesy/geodesicx/__main__.py +1 -1
- pygeodesy/geodesicx/gx.py +6 -5
- pygeodesy/geodesicx/gxarea.py +2 -2
- pygeodesy/geodesicx/gxbases.py +2 -2
- pygeodesy/geodesicx/gxline.py +16 -12
- pygeodesy/geodsolve.py +8 -17
- pygeodesy/geohash.py +1 -1
- pygeodesy/geoids.py +6 -6
- pygeodesy/hausdorff.py +1 -1
- pygeodesy/heights.py +3 -3
- pygeodesy/internals.py +64 -80
- pygeodesy/interns.py +2 -3
- pygeodesy/iters.py +1 -1
- pygeodesy/karney.py +4 -4
- pygeodesy/ktm.py +20 -21
- pygeodesy/latlonBase.py +296 -346
- pygeodesy/lazily.py +15 -15
- pygeodesy/lcc.py +5 -5
- pygeodesy/ltp.py +55 -59
- pygeodesy/ltpTuples.py +208 -192
- pygeodesy/mgrs.py +9 -10
- pygeodesy/named.py +153 -3
- pygeodesy/namedTuples.py +58 -7
- pygeodesy/nvectorBase.py +122 -105
- pygeodesy/osgr.py +10 -13
- pygeodesy/points.py +1 -1
- pygeodesy/props.py +3 -3
- pygeodesy/resections.py +26 -26
- pygeodesy/rhumb/__init__.py +2 -2
- pygeodesy/rhumb/aux_.py +2 -2
- pygeodesy/rhumb/bases.py +2 -2
- pygeodesy/rhumb/ekx.py +4 -4
- pygeodesy/rhumb/solve.py +4 -4
- pygeodesy/simplify.py +291 -403
- pygeodesy/solveBase.py +1 -1
- pygeodesy/sphericalBase.py +1 -1
- pygeodesy/sphericalNvector.py +84 -127
- pygeodesy/sphericalTrigonometry.py +66 -71
- pygeodesy/streprs.py +10 -5
- pygeodesy/trf.py +1 -1
- pygeodesy/triaxials.py +23 -16
- pygeodesy/units.py +17 -17
- pygeodesy/unitsBase.py +1 -1
- pygeodesy/ups.py +4 -4
- pygeodesy/utily.py +202 -145
- pygeodesy/utm.py +10 -10
- pygeodesy/utmups.py +1 -1
- pygeodesy/utmupsBase.py +1 -1
- pygeodesy/vector2d.py +17 -17
- pygeodesy/vector3d.py +32 -23
- pygeodesy/vector3dBase.py +22 -19
- pygeodesy/webmercator.py +5 -5
- pygeodesy/wgrs.py +5 -5
- PyGeodesy-24.10.24.dist-info/RECORD +0 -118
- {PyGeodesy-24.10.24.dist-info → PyGeodesy-24.12.12.dist-info}/top_level.txt +0 -0
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.11.06'
|
|
59
59
|
|
|
60
60
|
_AN_ = 'AN' # default south pole grid tile and band B
|
|
61
61
|
_AtoPx_ = _AtoZnoIO_.tillP
|
|
@@ -594,15 +594,14 @@ def toMgrs(utmups, Mgrs=Mgrs, **name_Mgrs_kwds):
|
|
|
594
594
|
'''Convert a UTM or UPS coordinate to an MGRS grid reference.
|
|
595
595
|
|
|
596
596
|
@arg utmups: A UTM or UPS coordinate (L{Utm}, L{Etm} or L{Ups}).
|
|
597
|
-
@kwarg Mgrs: Optional class to return the MGRS grid reference
|
|
598
|
-
|
|
599
|
-
@kwarg name_Mgrs_kwds: Optional C{B{name}=NN} (C{str}) and
|
|
600
|
-
additional B{C{Mgrs}} keyword arguments, ignored if
|
|
601
|
-
|
|
597
|
+
@kwarg Mgrs: Optional class to return the MGRS grid reference (L{Mgrs})
|
|
598
|
+
or C{None}.
|
|
599
|
+
@kwarg name_Mgrs_kwds: Optional C{B{name}=NN} (C{str}) and optionally,
|
|
600
|
+
additional B{C{Mgrs}} keyword arguments, ignored if C{B{Mgrs}
|
|
601
|
+
is None}.
|
|
602
602
|
|
|
603
|
-
@return: The MGRS grid reference as B{C{Mgrs}} or if C{B{Mgrs} is
|
|
604
|
-
|
|
605
|
-
band, datum)}.
|
|
603
|
+
@return: The MGRS grid reference as B{C{Mgrs}} or if C{B{Mgrs} is None} as
|
|
604
|
+
an L{Mgrs6Tuple}C{(zone, EN, easting, northing, band, datum)}.
|
|
606
605
|
|
|
607
606
|
@raise MGRSError: Invalid B{C{utmups}}.
|
|
608
607
|
|
|
@@ -732,7 +731,7 @@ if __name__ == '__main__':
|
|
|
732
731
|
|
|
733
732
|
# **) MIT License
|
|
734
733
|
#
|
|
735
|
-
# Copyright (C) 2016-
|
|
734
|
+
# Copyright (C) 2016-2025 -- mrJean1 at Gmail -- All Rights Reserved.
|
|
736
735
|
#
|
|
737
736
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
738
737
|
# copy of this software and associated documentation files (the "Software"),
|
pygeodesy/named.py
CHANGED
|
@@ -15,6 +15,7 @@ standard Python C{namedtuple}s.
|
|
|
15
15
|
|
|
16
16
|
from pygeodesy.basics import isidentifier, iskeyword, isstr, itemsorted, len2, \
|
|
17
17
|
_xcopy, _xdup, _xinstanceof, _xsubclassof, _zip
|
|
18
|
+
# from pygeodesy.ecef import EcefKarney # _MODS
|
|
18
19
|
from pygeodesy.errors import _AssertionError, _AttributeError, _incompatible, \
|
|
19
20
|
_IndexError, _KeyError, LenError, _NameError, \
|
|
20
21
|
_NotImplementedError, _TypeError, _TypesError, \
|
|
@@ -28,14 +29,16 @@ from pygeodesy.interns import MISSING, NN, _AT_, _COLON_, _COLONSPACE_, _COMMA_,
|
|
|
28
29
|
_NL_, _NN_, _no_, _other_, _s_, _SPACE_, _std_, \
|
|
29
30
|
_UNDER_, _vs_
|
|
30
31
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
32
|
+
# from pygeodesy.ltp import Ltp, _toLocal, _toLtp # _MODS
|
|
33
|
+
# from pygeodesy.ltpTuples import Aer, Enu, Ned # _MODS
|
|
31
34
|
from pygeodesy.props import _allPropertiesOf_n, deprecated_method, _hasProperty, \
|
|
32
35
|
_update_all, property_doc_, Property_RO, property_RO, \
|
|
33
|
-
_update_attrs
|
|
36
|
+
_update_attrs, property_ROver
|
|
34
37
|
from pygeodesy.streprs import attrs, Fmt, lrstrip, pairs, reprs, unstr
|
|
35
38
|
# from pygeodesy.units import _toUnit # _MODS
|
|
36
39
|
|
|
37
40
|
__all__ = _ALL_LAZY.named
|
|
38
|
-
__version__ = '24.
|
|
41
|
+
__version__ = '24.12.05'
|
|
39
42
|
|
|
40
43
|
_COMMANL_ = _COMMA_ + _NL_
|
|
41
44
|
_COMMASPACEDOT_ = _COMMASPACE_ + _DOT_
|
|
@@ -141,6 +144,10 @@ class _Named(object):
|
|
|
141
144
|
_classnaming = False # prefixed (C{bool})
|
|
142
145
|
# _updates = 0 # OBSOLETE Property/property updates
|
|
143
146
|
|
|
147
|
+
def __format__(self, fmt): # PYCHOK no cover
|
|
148
|
+
'''Not implemented.'''
|
|
149
|
+
return _NotImplemented(self, fmt)
|
|
150
|
+
|
|
144
151
|
def __imatmul__(self, other): # PYCHOK no cover
|
|
145
152
|
'''Not implemented.'''
|
|
146
153
|
return _NotImplemented(self, other) # PYCHOK Python 3.5+
|
|
@@ -892,6 +899,148 @@ class _NamedEnumItem(_NamedBase):
|
|
|
892
899
|
raise _AssertionError(t)
|
|
893
900
|
|
|
894
901
|
|
|
902
|
+
class _NamedLocal(object):
|
|
903
|
+
'''(INTERNAL) Base class for C{CartesianBase}, C{Ecef9Tuple} and C{LatLonBase}.
|
|
904
|
+
'''
|
|
905
|
+
|
|
906
|
+
@property_ROver
|
|
907
|
+
def Ecef(self):
|
|
908
|
+
'''Get the ECEF I{class} (L{EcefKarney}), I{once}.
|
|
909
|
+
'''
|
|
910
|
+
return _MODS.ecef.EcefKarney
|
|
911
|
+
|
|
912
|
+
@property_RO
|
|
913
|
+
def _ecef9(self):
|
|
914
|
+
'''I{Must be overloaded}.'''
|
|
915
|
+
notOverloaded(self)
|
|
916
|
+
|
|
917
|
+
@Property_RO
|
|
918
|
+
def _Ltp(self):
|
|
919
|
+
'''(INTERNAL) Cache this instance' LTP (L{Ltp}).
|
|
920
|
+
'''
|
|
921
|
+
return self._ltp.Ltp(self._ecef9, ecef=self.Ecef(self.datum), name=self.name)
|
|
922
|
+
|
|
923
|
+
@property_ROver
|
|
924
|
+
def _ltp(self):
|
|
925
|
+
'''(INTERNAL) Get module L{pygeodesy.ltp}, I{once}.
|
|
926
|
+
'''
|
|
927
|
+
return _MODS.ltp
|
|
928
|
+
|
|
929
|
+
def _ltp_toLocal(self, ltp, Cls_and_kwds, **nam_Cls): # overloaded in C{Ecef9Tuple}
|
|
930
|
+
'''(INTERNAL) Invoke C{ltp._toLocal}.
|
|
931
|
+
'''
|
|
932
|
+
Cls, kwds = self._ltp_toLocal2(Cls_and_kwds, **nam_Cls)
|
|
933
|
+
return self._ltp._toLocal(self, ltp, Cls, kwds) # self._ecef9
|
|
934
|
+
|
|
935
|
+
def _ltp_toLocal2(self, Cls_and_kwds, _None=None, **nam_Cls):
|
|
936
|
+
'''(INTERNAL) Return 2-tuple C{(Cls, kwds)}.
|
|
937
|
+
'''
|
|
938
|
+
Cls, kwds = _xkwds_pop2(Cls_and_kwds, **nam_Cls)
|
|
939
|
+
if Cls is not _None: # validate Cls
|
|
940
|
+
n, LoC = _xkwds_item2(nam_Cls)
|
|
941
|
+
if LoC is not Cls:
|
|
942
|
+
_xsubclassof(LoC, **{n: Cls})
|
|
943
|
+
return Cls, kwds
|
|
944
|
+
|
|
945
|
+
@property_ROver
|
|
946
|
+
def _ltpTuples(self):
|
|
947
|
+
'''(INTERNAL) Get module L{pygeodesy.ltpTuples}, I{once}.
|
|
948
|
+
'''
|
|
949
|
+
return _MODS.ltpTuples
|
|
950
|
+
|
|
951
|
+
def toAer(self, ltp=None, **Aer_and_kwds):
|
|
952
|
+
'''Convert this instance to I{local} I{Azimuth, Elevation, slant Range} (AER) components.
|
|
953
|
+
|
|
954
|
+
@kwarg ltp: The I{local tangent plane} (LTP) to use (L{Ltp}), overriding this
|
|
955
|
+
instance' L{LTP<pygeodesy.named._NamedLocal.toLtp>}.
|
|
956
|
+
@kwarg Aer_and_kwds: Optional AER class C{B{Aer}=}L{Aer<pygeodesy.ltpTuples.Aer>}
|
|
957
|
+
to use and optionally, additional B{C{Aer}} keyword arguments.
|
|
958
|
+
|
|
959
|
+
@return: An B{C{Aer}} instance.
|
|
960
|
+
|
|
961
|
+
@raise TypeError: Invalid B{C{ltp}}.
|
|
962
|
+
|
|
963
|
+
@see: Method L{toLocal<pygeodesy.named._NamedLocal.toLocal>}.
|
|
964
|
+
'''
|
|
965
|
+
return self._ltp_toLocal(ltp, Aer_and_kwds, Aer=self._ltpTuples.Aer)
|
|
966
|
+
|
|
967
|
+
def toEnu(self, ltp=None, **Enu_and_kwds):
|
|
968
|
+
'''Convert this instance to I{local} I{East, North, Up} (ENU) components.
|
|
969
|
+
|
|
970
|
+
@kwarg ltp: The I{local tangent plane} (LTP) to use (L{Ltp}), overriding this
|
|
971
|
+
instance' L{LTP<pygeodesy.named._NamedLocal.toLtp>}.
|
|
972
|
+
@kwarg Enu_and_kwds: Optional ENU class C{B{Enu}=}L{Enu<pygeodesy.ltpTuples.Enu>}
|
|
973
|
+
to use and optionally, additional B{C{Enu}} keyword arguments.
|
|
974
|
+
|
|
975
|
+
@return: An B{C{Enu}} instance.
|
|
976
|
+
|
|
977
|
+
@raise TypeError: Invalid B{C{ltp}}.
|
|
978
|
+
|
|
979
|
+
@see: Method L{toLocal<pygeodesy.named._NamedLocal.toLocal>}.
|
|
980
|
+
'''
|
|
981
|
+
return self._ltp_toLocal(ltp, Enu_and_kwds, Enu=self._ltpTuples.Enu)
|
|
982
|
+
|
|
983
|
+
def toLocal(self, Xyz=None, ltp=None, **Xyz_kwds):
|
|
984
|
+
'''Convert this instance to I{local} components in a I{local tangent plane} (LTP)
|
|
985
|
+
|
|
986
|
+
@kwarg Xyz: Optional I{local} components class (L{XyzLocal}, L{Aer},
|
|
987
|
+
L{Enu}, L{Ned}) or C{None}.
|
|
988
|
+
@kwarg ltp: The I{local tangent plane} (LTP) to use (L{Ltp}), overriding this
|
|
989
|
+
cartesian's L{LTP<pygeodesy.named._NamedLocal.toLtp>}.
|
|
990
|
+
@kwarg Xyz_kwds: Optionally, additional B{C{Xyz}} keyword arguments, ignored
|
|
991
|
+
if C{B{Xyz} is None}.
|
|
992
|
+
|
|
993
|
+
@return: An B{C{Xyz}} instance or a L{Local9Tuple}C{(x, y, z, lat, lon,
|
|
994
|
+
height, ltp, ecef, M)} if C{B{Xyz} is None} (with C{M=None}).
|
|
995
|
+
|
|
996
|
+
@raise TypeError: Invalid B{C{ltp}}.
|
|
997
|
+
'''
|
|
998
|
+
return self._ltp_toLocal(ltp, Xyz_kwds, Xyz=Xyz, _None=Xyz)
|
|
999
|
+
|
|
1000
|
+
def toLtp(self, Ecef=None, **name):
|
|
1001
|
+
'''Return the I{local tangent plane} (LTP) for this instance.
|
|
1002
|
+
|
|
1003
|
+
@kwarg Ecef: Optional ECEF I{class} (L{EcefKarney}, ... L{EcefYou}), overriding
|
|
1004
|
+
this instance' L{Ecef<pygeodesy.named._NamedLocal.Ecef>}.
|
|
1005
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
1006
|
+
|
|
1007
|
+
@return: An B{C{Ltp}} instance.
|
|
1008
|
+
'''
|
|
1009
|
+
return self._ltp._toLtp(self, Ecef, self._ecef9, name) # needs self.Ecef and self._Ltp
|
|
1010
|
+
|
|
1011
|
+
def toNed(self, ltp=None, **Ned_and_kwds):
|
|
1012
|
+
'''Convert this instance to I{local} I{North, East, Down} (NED) components.
|
|
1013
|
+
|
|
1014
|
+
@kwarg ltp: The I{local tangent plane} (LTP) to use (L{Ltp}), overriding this
|
|
1015
|
+
instance' L{LTP<pygeodesy.named._NamedLocal.toLtp>}.
|
|
1016
|
+
@kwarg Ned_and_kwds: Optional NED class C{B{Ned}=}L{Ned<pygeodesy.ltpTuples.Ned>}
|
|
1017
|
+
to use and optionally, additional B{C{Ned}} keyword arguments.
|
|
1018
|
+
|
|
1019
|
+
@return: An B{C{Ned}} instance.
|
|
1020
|
+
|
|
1021
|
+
@raise TypeError: Invalid B{C{ltp}}.
|
|
1022
|
+
|
|
1023
|
+
@see: Method L{toLocal<pygeodesy.named._NamedLocal.toLocal>}.
|
|
1024
|
+
'''
|
|
1025
|
+
return self._ltp_toLocal(ltp, Ned_and_kwds, Ned=self._ltpTuples.Ned)
|
|
1026
|
+
|
|
1027
|
+
def toXyz(self, ltp=None, **Xyz_and_kwds):
|
|
1028
|
+
'''Convert this instance to I{local} I{X, Y, Z} (XYZ) components.
|
|
1029
|
+
|
|
1030
|
+
@kwarg ltp: The I{local tangent plane} (LTP) to use (L{Ltp}), overriding this
|
|
1031
|
+
instance' L{LTP<pygeodesy.named._NamedLocal.toLtp>}.
|
|
1032
|
+
@kwarg Xyz_and_kwds: Optional XYZ class C{B{Xyz}=}L{Xyz<pygeodesy.ltpTuples.XyzLocal>}
|
|
1033
|
+
to use and optionally, additional B{C{Xyz}} keyword arguments.
|
|
1034
|
+
|
|
1035
|
+
@return: An B{C{Xyz}} instance.
|
|
1036
|
+
|
|
1037
|
+
@raise TypeError: Invalid B{C{ltp}}.
|
|
1038
|
+
|
|
1039
|
+
@see: Method L{toLocal<pygeodesy.named._NamedLocal.toLocal>}.
|
|
1040
|
+
'''
|
|
1041
|
+
return self._ltp_toLocal(ltp, Xyz_and_kwds, Xyz=self._ltpTuples.XyzLocal)
|
|
1042
|
+
|
|
1043
|
+
|
|
895
1044
|
# from pygeodesy.props import _NamedProperty
|
|
896
1045
|
|
|
897
1046
|
|
|
@@ -1446,11 +1595,12 @@ def _xvalid(name, underOK=False):
|
|
|
1446
1595
|
__all__ += _ALL_DOCS(_Named,
|
|
1447
1596
|
_NamedBase, # _NamedDict,
|
|
1448
1597
|
_NamedEnum, _NamedEnumItem,
|
|
1598
|
+
_NamedLocal,
|
|
1449
1599
|
_NamedTuple)
|
|
1450
1600
|
|
|
1451
1601
|
# **) MIT License
|
|
1452
1602
|
#
|
|
1453
|
-
# Copyright (C) 2016-
|
|
1603
|
+
# Copyright (C) 2016-2025 -- mrJean1 at Gmail -- All Rights Reserved.
|
|
1454
1604
|
#
|
|
1455
1605
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
1456
1606
|
# copy of this software and associated documentation files (the "Software"),
|
pygeodesy/namedTuples.py
CHANGED
|
@@ -8,10 +8,11 @@ are all instances of some C{Named...Tuple} class, all sub-classes
|
|
|
8
8
|
of C{_NamedTuple} defined in C{pygeodesy.named}.
|
|
9
9
|
'''
|
|
10
10
|
|
|
11
|
-
from pygeodesy.basics import isinstanceof, map1, _xinstanceof
|
|
11
|
+
from pygeodesy.basics import isinstanceof, issubclassof, map1, _xinstanceof
|
|
12
|
+
# from pygeodesy.cartesianBase import CartesianBase # _MODS
|
|
12
13
|
# from pygeodesy.constants import INT0 # from .units
|
|
13
14
|
# from pygeodesy.dms import toDMS # _MODS
|
|
14
|
-
from pygeodesy.errors import _xattr, _xkwds, _xkwds_not
|
|
15
|
+
from pygeodesy.errors import _TypeError, _xattr, _xkwds, _xkwds_not
|
|
15
16
|
from pygeodesy.interns import NN, _1_, _2_, _a_, _A_, _area_, _angle_, _b_, _B_, \
|
|
16
17
|
_band_, _c_, _C_, _D_, _datum_, _distance_, _E_, \
|
|
17
18
|
_easting_, _end_, _fi_, _gamma_, _h_, _height_, \
|
|
@@ -19,8 +20,8 @@ from pygeodesy.interns import NN, _1_, _2_, _a_, _A_, _area_, _angle_, _b_, _B_,
|
|
|
19
20
|
_n_, _northing_, _number_, _outside_, _phi_, \
|
|
20
21
|
_point_, _precision_, _points_, _radius_, _scale_, \
|
|
21
22
|
_start_, _x_, _y_, _z_, _zone_
|
|
22
|
-
# from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .
|
|
23
|
-
from pygeodesy.named import _NamedTuple, _Pass
|
|
23
|
+
# from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .named
|
|
24
|
+
from pygeodesy.named import _NamedTuple, _Pass, _ALL_LAZY, _MODS
|
|
24
25
|
from pygeodesy.props import deprecated_property_RO, property_RO
|
|
25
26
|
from pygeodesy.units import Band, Bearing, Degrees, Degrees2, Easting, FIx, \
|
|
26
27
|
Height, Int, Lam, Lat, Lon, Meter, Meter2, \
|
|
@@ -28,7 +29,7 @@ from pygeodesy.units import Band, Bearing, Degrees, Degrees2, Easting, FIx, \
|
|
|
28
29
|
Radius, Scalar, Str, INT0
|
|
29
30
|
|
|
30
31
|
__all__ = _ALL_LAZY.namedTuples
|
|
31
|
-
__version__ = '24.
|
|
32
|
+
__version__ = '24.11.22'
|
|
32
33
|
|
|
33
34
|
# __DUNDER gets mangled in class
|
|
34
35
|
_closest_ = 'closest'
|
|
@@ -636,6 +637,17 @@ class Vector2Tuple(_NamedTuple):
|
|
|
636
637
|
_Names_ = (_x_, _y_)
|
|
637
638
|
_Units_ = ( Scalar, Scalar)
|
|
638
639
|
|
|
640
|
+
def toCartesian(self, Cartesian, **Cartesian_kwds):
|
|
641
|
+
'''Return this C{Vector2Tuple} as a C{Cartesian}.
|
|
642
|
+
|
|
643
|
+
@arg Cartesian: The C{Cartesian} class to use.
|
|
644
|
+
@kwarg Cartesian_kwds: Optional, additional C{Cartesian}
|
|
645
|
+
keyword arguments.
|
|
646
|
+
|
|
647
|
+
@return: The C{B{Cartesian}} instance with C{z=0}.
|
|
648
|
+
'''
|
|
649
|
+
return _v2Cls(self.xyz, Cartesian, Cartesian_kwds)
|
|
650
|
+
|
|
639
651
|
def to3Tuple(self, z=INT0, **name):
|
|
640
652
|
'''Extend this L{Vector2Tuple} to a L{Vector3Tuple}.
|
|
641
653
|
|
|
@@ -649,6 +661,18 @@ class Vector2Tuple(_NamedTuple):
|
|
|
649
661
|
'''
|
|
650
662
|
return self._xtend(Vector3Tuple, z, **name)
|
|
651
663
|
|
|
664
|
+
@property_RO
|
|
665
|
+
def xyz(self):
|
|
666
|
+
'''Get X, Y and Z=0 components (C{Vector3Tuple}).
|
|
667
|
+
'''
|
|
668
|
+
return Vector3Tuple(*self.xyz3)
|
|
669
|
+
|
|
670
|
+
@property_RO
|
|
671
|
+
def xyz3(self):
|
|
672
|
+
'''Get X, Y and Z=0 components as C{3-tuple}.
|
|
673
|
+
'''
|
|
674
|
+
return self.x, self.y, INT0
|
|
675
|
+
|
|
652
676
|
|
|
653
677
|
class Vector3Tuple(_NamedTuple):
|
|
654
678
|
'''3-Tuple C{(x, y, z)} of (geocentric) components, all in
|
|
@@ -657,6 +681,17 @@ class Vector3Tuple(_NamedTuple):
|
|
|
657
681
|
_Names_ = (_x_, _y_, _z_)
|
|
658
682
|
_Units_ = ( Scalar, Scalar, Scalar)
|
|
659
683
|
|
|
684
|
+
def toCartesian(self, Cartesian, **Cartesian_kwds):
|
|
685
|
+
'''Return this C{Vector3Tuple} as a C{Cartesian}.
|
|
686
|
+
|
|
687
|
+
@arg Cartesian: The C{Cartesian} class to use.
|
|
688
|
+
@kwarg Cartesian_kwds: Optional, additional C{Cartesian}
|
|
689
|
+
keyword arguments.
|
|
690
|
+
|
|
691
|
+
@return: The C{B{Cartesian}} instance.
|
|
692
|
+
'''
|
|
693
|
+
return _v2Cls(self, Cartesian, Cartesian_kwds)
|
|
694
|
+
|
|
660
695
|
def to4Tuple(self, h=INT0, **name):
|
|
661
696
|
'''Extend this L{Vector3Tuple} to a L{Vector4Tuple}.
|
|
662
697
|
|
|
@@ -690,6 +725,17 @@ class Vector4Tuple(_NamedTuple): # .nvector.py
|
|
|
690
725
|
_Names_ = (_x_, _y_, _z_, _h_)
|
|
691
726
|
_Units_ = ( Scalar, Scalar, Scalar, Height)
|
|
692
727
|
|
|
728
|
+
def toCartesian(self, Cartesian, **Cartesian_kwds):
|
|
729
|
+
'''Return this C{Vector4Tuple} as a C{Cartesian}.
|
|
730
|
+
|
|
731
|
+
@arg Cartesian: The C{Cartesian} class to use.
|
|
732
|
+
@kwarg Cartesian_kwds: Optional, additional C{Cartesian}
|
|
733
|
+
keyword arguments.
|
|
734
|
+
|
|
735
|
+
@return: The C{B{Cartesian}} instance.
|
|
736
|
+
'''
|
|
737
|
+
return _v2Cls(self, Cartesian, Cartesian_kwds)
|
|
738
|
+
|
|
693
739
|
def to3Tuple(self):
|
|
694
740
|
'''Reduce this L{Vector4Tuple} to a L{Vector3Tuple}.
|
|
695
741
|
|
|
@@ -701,7 +747,7 @@ class Vector4Tuple(_NamedTuple): # .nvector.py
|
|
|
701
747
|
def xyz(self):
|
|
702
748
|
'''Get X, Y and Z components (L{Vector3Tuple}).
|
|
703
749
|
'''
|
|
704
|
-
return Vector3Tuple(*self
|
|
750
|
+
return Vector3Tuple(*self.xyz)
|
|
705
751
|
|
|
706
752
|
@property_RO
|
|
707
753
|
def xyz3(self):
|
|
@@ -710,9 +756,14 @@ class Vector4Tuple(_NamedTuple): # .nvector.py
|
|
|
710
756
|
return tuple(self[:3])
|
|
711
757
|
|
|
712
758
|
|
|
759
|
+
def _v2Cls(v, Cls, Cartesian_kwds): # in .vector3d
|
|
760
|
+
if issubclassof(Cls, _MODS.cartesianBase.CartesianBase): # _MODS.vector3d.Vector3d)
|
|
761
|
+
return Cls(v, **Cartesian_kwds)
|
|
762
|
+
raise _TypeError(Cartesian=Cls, **Cartesian_kwds)
|
|
763
|
+
|
|
713
764
|
# **) MIT License
|
|
714
765
|
#
|
|
715
|
-
# Copyright (C) 2016-
|
|
766
|
+
# Copyright (C) 2016-2025 -- mrJean1 at Gmail -- All Rights Reserved.
|
|
716
767
|
#
|
|
717
768
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
718
769
|
# copy of this software and associated documentation files (the "Software"),
|