pygeodesy 25.4.8__py2.py3-none-any.whl → 25.4.25__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pygeodesy/__init__.py +30 -27
- pygeodesy/__main__.py +3 -3
- pygeodesy/albers.py +29 -36
- pygeodesy/auxilats/_CX_4.py +2 -2
- pygeodesy/auxilats/_CX_6.py +2 -2
- pygeodesy/auxilats/_CX_8.py +2 -2
- pygeodesy/auxilats/_CX_Rs.py +9 -9
- pygeodesy/auxilats/__init__.py +3 -3
- pygeodesy/auxilats/__main__.py +8 -6
- pygeodesy/auxilats/auxAngle.py +2 -2
- pygeodesy/auxilats/auxLat.py +5 -5
- pygeodesy/auxilats/auxily.py +5 -3
- pygeodesy/azimuthal.py +7 -6
- pygeodesy/basics.py +31 -17
- pygeodesy/booleans.py +12 -10
- pygeodesy/cartesianBase.py +21 -20
- pygeodesy/clipy.py +11 -10
- pygeodesy/constants.py +11 -10
- pygeodesy/css.py +14 -11
- pygeodesy/datums.py +8 -8
- pygeodesy/deprecated/bases.py +2 -2
- pygeodesy/deprecated/classes.py +2 -2
- pygeodesy/deprecated/consterns.py +4 -4
- pygeodesy/dms.py +8 -8
- pygeodesy/ecef.py +10 -7
- pygeodesy/elevations.py +9 -8
- pygeodesy/ellipsoidalBase.py +19 -8
- pygeodesy/ellipsoidalBaseDI.py +17 -15
- pygeodesy/ellipsoidalNvector.py +6 -3
- pygeodesy/ellipsoidalVincenty.py +4 -1
- pygeodesy/ellipsoids.py +167 -138
- pygeodesy/elliptic.py +9 -9
- pygeodesy/errors.py +44 -43
- pygeodesy/etm.py +7 -7
- pygeodesy/fmath.py +10 -9
- pygeodesy/formy.py +11 -12
- pygeodesy/frechet.py +216 -109
- pygeodesy/fstats.py +5 -4
- pygeodesy/fsums.py +78 -77
- pygeodesy/gars.py +4 -3
- pygeodesy/geodesici.py +15 -14
- pygeodesy/geodesicw.py +34 -32
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/__main__.py +11 -9
- pygeodesy/geodesicx/gx.py +30 -33
- pygeodesy/geodesicx/gxarea.py +2 -2
- pygeodesy/geodesicx/gxline.py +5 -5
- pygeodesy/geodsolve.py +18 -17
- pygeodesy/geohash.py +5 -5
- pygeodesy/geoids.py +34 -31
- pygeodesy/hausdorff.py +17 -13
- pygeodesy/heights.py +2 -4
- pygeodesy/internals.py +28 -44
- pygeodesy/interns.py +10 -7
- pygeodesy/iters.py +8 -8
- pygeodesy/karney.py +68 -62
- pygeodesy/ktm.py +5 -5
- pygeodesy/latlonBase.py +14 -18
- pygeodesy/lazily.py +65 -63
- pygeodesy/lcc.py +11 -9
- pygeodesy/ltp.py +8 -7
- pygeodesy/ltpTuples.py +2 -2
- pygeodesy/mgrs.py +7 -6
- pygeodesy/named.py +47 -31
- pygeodesy/nvectorBase.py +7 -7
- pygeodesy/osgr.py +9 -8
- pygeodesy/points.py +12 -10
- pygeodesy/props.py +25 -25
- pygeodesy/resections.py +11 -10
- pygeodesy/rhumb/__init__.py +1 -1
- pygeodesy/rhumb/aux_.py +7 -7
- pygeodesy/rhumb/bases.py +22 -20
- pygeodesy/rhumb/ekx.py +6 -6
- pygeodesy/rhumb/solve.py +15 -15
- pygeodesy/solveBase.py +3 -3
- pygeodesy/sphericalBase.py +6 -6
- pygeodesy/sphericalNvector.py +6 -5
- pygeodesy/sphericalTrigonometry.py +8 -7
- pygeodesy/streprs.py +14 -14
- pygeodesy/trf.py +14 -12
- pygeodesy/triaxials.py +29 -26
- pygeodesy/units.py +5 -4
- pygeodesy/unitsBase.py +5 -4
- pygeodesy/ups.py +3 -3
- pygeodesy/utily.py +4 -4
- pygeodesy/utmups.py +4 -4
- pygeodesy/utmupsBase.py +88 -18
- pygeodesy/vector2d.py +18 -11
- pygeodesy/vector3d.py +7 -6
- pygeodesy/webmercator.py +6 -5
- pygeodesy/wgrs.py +6 -5
- {pygeodesy-25.4.8.dist-info → pygeodesy-25.4.25.dist-info}/METADATA +27 -23
- pygeodesy-25.4.25.dist-info/RECORD +118 -0
- pygeodesy-25.4.8.dist-info/RECORD +0 -118
- {pygeodesy-25.4.8.dist-info → pygeodesy-25.4.25.dist-info}/WHEEL +0 -0
- {pygeodesy-25.4.8.dist-info → pygeodesy-25.4.25.dist-info}/top_level.txt +0 -0
pygeodesy/lazily.py
CHANGED
|
@@ -30,13 +30,14 @@ and line number.
|
|
|
30
30
|
from pygeodesy import internals as _internals, interns as _interns, \
|
|
31
31
|
_isfrozen # DON'T _lazy_import2
|
|
32
32
|
# from pygeodesy.errors import _error_init, _xkwds_item2 # _ALL_MODS
|
|
33
|
-
from pygeodesy.internals import _caller3,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
from pygeodesy.internals import _caller3, _envPYGEODESY, _headof, printf, _tailof, \
|
|
34
|
+
typename, _versions # _getenv, _PYGEODESY_ENV, \
|
|
35
|
+
# _MODS_Base, _MODS.sys_version_info2
|
|
36
|
+
from pygeodesy.interns import _attribute_, _by_, _COLONSPACE_, _COMMASPACE_, _DALL_, \
|
|
37
|
+
_DMAIN_, _doesn_t_exist_, _DOT_, _EQUALSPACED_, _from_, \
|
|
38
|
+
_immutable_, _line_, _module_, NN, _no_, _not_, _or_, \
|
|
39
|
+
_pygeodesy_, _pygeodesy_abspath_, _SPACE_, _SUB_PACKAGES, \
|
|
40
|
+
_UNDER_, _version_, _sys, _intern # function, _1_, _HASH_
|
|
40
41
|
try:
|
|
41
42
|
from importlib import import_module
|
|
42
43
|
except ImportError as x: # Python 2.6-
|
|
@@ -45,12 +46,12 @@ except ImportError as x: # Python 2.6-
|
|
|
45
46
|
|
|
46
47
|
_a0 = () # PYCHOK empty tuple
|
|
47
48
|
_asSPACED_ = ' as '
|
|
48
|
-
_FOR_DOCS =
|
|
49
|
-
_init__all__ = _FOR_DOCS or
|
|
49
|
+
_FOR_DOCS = _envPYGEODESY('FOR_DOCS') # for epydoc ...
|
|
50
|
+
_init__all__ = _FOR_DOCS or _envPYGEODESY('_init__all__', _DALL_) == _DALL_ # PYCHOK exported
|
|
50
51
|
_lazily_ = 'lazily'
|
|
51
52
|
_PYTHON_X_DEV = getattr(_sys.flags, 'dev_mode', False) # PYCHOK Python 3.2+
|
|
52
53
|
_unlazy = _unLazy0 = _isfrozen or _internals._MODS.sys_version_info2 < (3, 7) # PYCHOK mod.__getattr__ 3.7+
|
|
53
|
-
_WARNINGS_X_DEV =
|
|
54
|
+
_WARNINGS_X_DEV = _envPYGEODESY('WARNINGS') and (_PYTHON_X_DEV or bool(_sys.warnoptions)) # PYCHOK .props
|
|
54
55
|
|
|
55
56
|
# @module_property[_RO?] <https://GitHub.com/jtushman/proxy_tools/> <https://discuss.Python.org/t/47379>
|
|
56
57
|
isLazy = None # see @var isLazy in .__init__
|
|
@@ -93,18 +94,18 @@ class _Dict(dict):
|
|
|
93
94
|
@raise AssertionError: The B{C{name}} already exists
|
|
94
95
|
with a different B{C{mod_}}.
|
|
95
96
|
'''
|
|
96
|
-
|
|
97
|
+
try:
|
|
97
98
|
sub = self[name] # duplicate OK
|
|
98
99
|
if sub != mod_ and sub not in subs:
|
|
99
100
|
t = _DOT_(self._name, name)
|
|
100
101
|
t = _COLONSPACE_(t, repr(sub))
|
|
101
102
|
t = _COMMASPACE_(t, _not_(repr(mod_)))
|
|
102
103
|
raise AssertionError(t)
|
|
103
|
-
|
|
104
|
+
except KeyError:
|
|
104
105
|
self[name] = mod_
|
|
105
106
|
|
|
106
107
|
def _NAME(self, which):
|
|
107
|
-
self._name = _intern(
|
|
108
|
+
self._name = _intern(typename(which).upper())
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
class _NamedEnum_RO(dict):
|
|
@@ -429,7 +430,7 @@ class _ALL_MODS(_internals._MODS_Base):
|
|
|
429
430
|
v = _lazy_dict[name] # package.__dict__
|
|
430
431
|
except KeyError:
|
|
431
432
|
v = _lazy_module(name) # package.__getattr__
|
|
432
|
-
if _tailof(
|
|
433
|
+
if _tailof(typename(v)) != name:
|
|
433
434
|
try:
|
|
434
435
|
v = getattr(v, _tailof(name))
|
|
435
436
|
except AttributeError:
|
|
@@ -463,7 +464,7 @@ class _ALL_MODS(_internals._MODS_Base):
|
|
|
463
464
|
|
|
464
465
|
@raise ImportError: Importing module B{C{name}} failed.
|
|
465
466
|
'''
|
|
466
|
-
if _headof(name) != parent and
|
|
467
|
+
if _headof(name) != parent and name != _DMAIN_:
|
|
467
468
|
name = _DOT_(parent, name)
|
|
468
469
|
try:
|
|
469
470
|
return _sys.modules[name]
|
|
@@ -475,14 +476,14 @@ class _ALL_MODS(_internals._MODS_Base):
|
|
|
475
476
|
'''
|
|
476
477
|
return _sys.modules.get(name, None)
|
|
477
478
|
|
|
478
|
-
def into(self, **
|
|
479
|
-
'''Lazily import module C{mod} into module C{
|
|
480
|
-
and set C{
|
|
479
|
+
def into(self, **mod_DNAME):
|
|
480
|
+
'''Lazily import module C{mod} into module C{_DNAME_}
|
|
481
|
+
and set C{_DNAME_._mod} to module C{mod}, I{once}.
|
|
481
482
|
'''
|
|
482
483
|
class _Into(object):
|
|
483
484
|
|
|
484
485
|
def __getattr__(unused, name):
|
|
485
|
-
mod, dun = self.errors._xkwds_item2(
|
|
486
|
+
mod, dun = self.errors._xkwds_item2(mod_DNAME)
|
|
486
487
|
_mod = _UNDER_(NN, mod)
|
|
487
488
|
d = self.getmodule(dun) # '__main__' OK
|
|
488
489
|
i = _getmodattr(d, _mod, dun)
|
|
@@ -509,14 +510,14 @@ class _ALL_MODS(_internals._MODS_Base):
|
|
|
509
510
|
_internals._MODS = _ALL_MODS = _ALL_MODS() # PYCHOK singleton
|
|
510
511
|
|
|
511
512
|
__all__ = _ALL_LAZY.lazily
|
|
512
|
-
__version__ = '25.
|
|
513
|
+
__version__ = '25.04.21'
|
|
513
514
|
|
|
514
515
|
|
|
515
516
|
def _ALL_OTHER(*objs):
|
|
516
517
|
'''(INTERNAL) Get class and function B{C{objs}} for __all__.
|
|
517
518
|
'''
|
|
518
519
|
def _interned(o): # intern'd base name
|
|
519
|
-
n = _tailof(
|
|
520
|
+
n = _tailof(typename(o))
|
|
520
521
|
i = NN(_UNDER_, n, _UNDER_) # intern'd
|
|
521
522
|
return getattr(_interns, i, n)
|
|
522
523
|
|
|
@@ -536,12 +537,12 @@ else:
|
|
|
536
537
|
|
|
537
538
|
|
|
538
539
|
def _all_deprecates():
|
|
539
|
-
'''(INTERNAL) Build C{dict} of all deprecated imports.
|
|
540
|
+
'''(INTERNAL) Build C{dict} of all deprecated imports and attributes.
|
|
540
541
|
'''
|
|
541
|
-
|
|
542
|
-
if not
|
|
543
|
-
_ALL_DEPRECATED.fill_D(
|
|
544
|
-
return
|
|
542
|
+
D = _ALL_DEPRECATES
|
|
543
|
+
if not D:
|
|
544
|
+
_ALL_DEPRECATED.fill_D(D, _all_deprecates) # see _all_imports()
|
|
545
|
+
return D
|
|
545
546
|
|
|
546
547
|
_ALL_DEPRECATES = _Dict() # PYCHOK _ALL_DEPRECATED.imports()
|
|
547
548
|
|
|
@@ -565,10 +566,10 @@ def _all_imports():
|
|
|
565
566
|
# from <module> import <attr> - [<attr>] = <module>
|
|
566
567
|
# from pygeodesy import <attr> - [<attr>] = <attr>
|
|
567
568
|
# from <module> import <attr> as <name> - [<name>] = <module>.<attr>.
|
|
568
|
-
|
|
569
|
-
if not
|
|
570
|
-
_ALL_LAZY.fill_D(
|
|
571
|
-
return
|
|
569
|
+
D = _ALL_IMPORTS
|
|
570
|
+
if not D:
|
|
571
|
+
_ALL_LAZY.fill_D(D, _all_imports) # see _all_deprecates()
|
|
572
|
+
return D
|
|
572
573
|
|
|
573
574
|
_ALL_IMPORTS = _Dict() # PYCHOK _ALL_LAZY.imports()
|
|
574
575
|
|
|
@@ -582,7 +583,7 @@ def _all_missing2(_all_):
|
|
|
582
583
|
_alzy = _Dict((a, a) for a in _ALL_INIT)
|
|
583
584
|
_alzy.update(_all_imports()) # without _all_backups!
|
|
584
585
|
return ((_DOT_(_lazily_, _all_imports.__name__), _diff(_all_, _alzy)),
|
|
585
|
-
(_DOT_(_pygeodesy_,
|
|
586
|
+
(_DOT_(_pygeodesy_, _DALL_), _diff(_alzy.keys(), _all_)))
|
|
586
587
|
|
|
587
588
|
|
|
588
589
|
def _getattras(attr_as): # test/testDeprecated
|
|
@@ -656,19 +657,16 @@ def _lazy_import2(pack): # MCCABE 14
|
|
|
656
657
|
|
|
657
658
|
@see: The original U{modutil<https://PyPI.org/project/modutil>},
|
|
658
659
|
U{PEP 562<https://www.Python.org/dev/peps/pep-0562>} and the
|
|
659
|
-
U{new way<https://Snarky.
|
|
660
|
+
U{new way<https://Snarky.CA/lazy-importing-in-python-3-7/>}.
|
|
660
661
|
'''
|
|
661
|
-
_DOT_ = _interns._DOT_
|
|
662
|
-
_SPACE_ = _interns._SPACE_
|
|
663
|
-
|
|
664
662
|
if pack != _pygeodesy_ or _unlazy: # Python 3.7+ # PYCHOK no cover
|
|
665
|
-
t = _DOT_(pack,
|
|
663
|
+
t = _DOT_(pack, typename(_lazy_import2))
|
|
666
664
|
raise LazyImportError(_no_(t), txt=_versions())
|
|
667
665
|
|
|
668
666
|
package, parent = _lazy_init2(pack) # _pygeodesy_
|
|
669
667
|
|
|
670
|
-
|
|
671
|
-
_lazily_imported_ = _SPACE_(_HASH_, _lazily_, 'imported', parent)
|
|
668
|
+
_DPACKAGE_ = '__package__'
|
|
669
|
+
_lazily_imported_ = _SPACE_(_interns._HASH_, _lazily_, 'imported', parent)
|
|
672
670
|
|
|
673
671
|
sub_packages = set((parent, NN) + tuple(
|
|
674
672
|
_DOT_(parent, s) for s in _SUB_PACKAGES))
|
|
@@ -687,13 +685,13 @@ def _lazy_import2(pack): # MCCABE 14
|
|
|
687
685
|
else: # from mod import name
|
|
688
686
|
attr = name
|
|
689
687
|
v = _getmodule(_DOT_(pack, mod), parent)
|
|
690
|
-
t = getattr(v,
|
|
688
|
+
t = getattr(v, _DPACKAGE_, None)
|
|
691
689
|
if t not in sub_packages: # invalid module package
|
|
692
|
-
raise LazyImportError(_DOT_(mod,
|
|
690
|
+
raise LazyImportError(_DOT_(mod, _DPACKAGE_), t)
|
|
693
691
|
if attr: # get mod.attr
|
|
694
692
|
v = _getmodattr(v, attr, mod)
|
|
695
693
|
|
|
696
|
-
elif name in (
|
|
694
|
+
elif name in (_DALL_,): # XXX _Ddir_, _Dmembers_?
|
|
697
695
|
v = _ALL_INIT + tuple(imports.keys())
|
|
698
696
|
else: # PYCHOK no cover
|
|
699
697
|
t = _no_(_module_, _or_, _attribute_)
|
|
@@ -722,18 +720,18 @@ def _lazy_import2(pack): # MCCABE 14
|
|
|
722
720
|
return package, __getattr__ # _lazy_import2
|
|
723
721
|
|
|
724
722
|
|
|
725
|
-
# def _lazy_import_all(
|
|
723
|
+
# def _lazy_import_all(Dname):
|
|
726
724
|
# '''(INTERNAL) Return a function mimicking C{from B{__name__} import *},
|
|
727
725
|
# of all items, see .deprecated.__init__
|
|
728
726
|
# '''
|
|
729
727
|
# if _unlazy:
|
|
730
|
-
# raise AssertionError(_COMMASPACE_(
|
|
728
|
+
# raise AssertionError(_COMMASPACE_(Dname, _not_(_DEPRECATED_)))
|
|
731
729
|
#
|
|
732
|
-
# _getattr = _lazy_attributes(
|
|
733
|
-
# _import_start = _lazy_import_star(
|
|
730
|
+
# _getattr = _lazy_attributes(Dname) # __name__.__getattr__
|
|
731
|
+
# _import_start = _lazy_import_star(Dname, ALL_=_ALL_IMPORTS)
|
|
734
732
|
#
|
|
735
733
|
# def _import_all(attr, *dflt):
|
|
736
|
-
# return _import_star(
|
|
734
|
+
# return _import_star(Dname) if attr == _DALL_ else \
|
|
737
735
|
# _getattr(attr, *dflt)
|
|
738
736
|
#
|
|
739
737
|
# return _import_all
|
|
@@ -799,15 +797,15 @@ def _lazy_init2(pack):
|
|
|
799
797
|
'''
|
|
800
798
|
global isLazy, _unLazy0
|
|
801
799
|
|
|
802
|
-
|
|
800
|
+
E = _internals._PYGEODESY_ENV('LAZY_IMPORT')
|
|
801
|
+
z = _internals._getenv(E, _interns._1_) # 1 default on 3.7+
|
|
803
802
|
z = z.strip() # like PYTHONVERBOSE et.al.
|
|
804
803
|
isLazy = int(z) if z.isdigit() else (1 if z else 0)
|
|
805
804
|
|
|
806
805
|
_unLazy0 = _unlazy or not isLazy # pre-3.7 or w/o lazy import
|
|
807
806
|
|
|
808
807
|
if isLazy < 1: # invalid, not enabled
|
|
809
|
-
|
|
810
|
-
raise LazyImportError(e, repr(z), txt_not_='enabled')
|
|
808
|
+
raise LazyImportError(E, repr(z), txt_not_='enabled')
|
|
811
809
|
if _sys.flags.verbose: # PYCHOK no cover
|
|
812
810
|
isLazy += 1
|
|
813
811
|
|
|
@@ -820,7 +818,7 @@ def _lazy_init2(pack):
|
|
|
820
818
|
|
|
821
819
|
except (AttributeError, ImportError) as x:
|
|
822
820
|
isLazy = False # failed
|
|
823
|
-
z =
|
|
821
|
+
z = typename(_lazy_init2)
|
|
824
822
|
raise LazyImportError(z, pack, cause=x)
|
|
825
823
|
|
|
826
824
|
return package, parent
|
|
@@ -837,23 +835,22 @@ def _lazy_module(name): # overwritten by _lazy_import2
|
|
|
837
835
|
return m
|
|
838
836
|
|
|
839
837
|
|
|
840
|
-
# def _lazy_subs(
|
|
841
|
-
# '''(INTERNAL) Return the names of a package's sub-packages
|
|
842
|
-
# update the package's C{__dict__} accordingly.
|
|
838
|
+
# def _lazy_subs(__name__, force=_FOR_DOCS, over=False):
|
|
839
|
+
# '''(INTERNAL) Return the names of a __name__ package's sub-packages
|
|
840
|
+
# and update the package's C{__dict__} accordingly.
|
|
843
841
|
# '''
|
|
844
842
|
# sm = dict()
|
|
845
|
-
# if force and
|
|
846
|
-
# nm = _tailof(
|
|
843
|
+
# if force and __name__ != _DMAIN_:
|
|
844
|
+
# nm = _tailof(__name__)
|
|
847
845
|
# _a = _ALL_MODS.getattr
|
|
848
846
|
# _m = _ALL_MODS.getmodule
|
|
849
|
-
# d = _a(
|
|
850
|
-
# for n in _a(
|
|
847
|
+
# d = _a(__name__, _DDICT_, {})
|
|
848
|
+
# for n in _a(__name__, _DALL_, ()):
|
|
851
849
|
# try: # n is a class name, get its mod name
|
|
852
|
-
# m = _a(
|
|
850
|
+
# m = _a(__name__, n).__module__
|
|
853
851
|
# n, s = m.split(_DOT_)[-2:]
|
|
854
852
|
# if n == nm and s not in sm:
|
|
855
|
-
# #
|
|
856
|
-
# m = _m(m)
|
|
853
|
+
# m = _m(m) # == import m as s
|
|
857
854
|
# sm[s] = m if over else d.get(s, m)
|
|
858
855
|
# except (AttributeError, ImportError, ValueError) as x:
|
|
859
856
|
# pass
|
|
@@ -861,9 +858,8 @@ def _lazy_module(name): # overwritten by _lazy_import2
|
|
|
861
858
|
#
|
|
862
859
|
# return _ALL_OTHER(*sm.values())
|
|
863
860
|
|
|
864
|
-
# del _a, _a0
|
|
865
861
|
|
|
866
|
-
if
|
|
862
|
+
if __name__ == _DMAIN_:
|
|
867
863
|
|
|
868
864
|
def _main():
|
|
869
865
|
from timeit import timeit
|
|
@@ -879,12 +875,18 @@ if _is_DUNDER_main(__name__): # PYCHOK no cover
|
|
|
879
875
|
|
|
880
876
|
t1 = timeit(t1, number=1000000)
|
|
881
877
|
t2 = timeit(t2, number=1000000)
|
|
882
|
-
A =
|
|
878
|
+
A = typename(_ALL_MODS)
|
|
883
879
|
v = _versions()
|
|
884
880
|
printf('%.6f import vs %.6f %s: %.2fX, %s', t1, t2, A, (t1 / t2), v)
|
|
885
881
|
|
|
886
882
|
_main()
|
|
887
883
|
|
|
884
|
+
# % python3.13 -W ignore -m pygeodesy.lazily
|
|
885
|
+
# 0.054235 import vs 0.052469 _ALL_MODS: 1.03X, pygeodesy 25.4.24 Python 3.13.3 64bit arm64 macOS 15.4
|
|
886
|
+
|
|
887
|
+
# % python2 -m pygeodesy.lazily
|
|
888
|
+
# 0.653715 import vs 0.321318 _ALL_MODS: 2.03X, pygeodesy 25.4.24 Python 2.7.18 64bit arm64_x86_64 macOS 10.16
|
|
889
|
+
|
|
888
890
|
# % python3.13 -W ignore -m pygeodesy.lazily
|
|
889
891
|
# 0.106602 import vs 0.078136 _ALL_MODS: 1.36X, pygeodesy 24.10.24 Python 3.13.0 64bit arm64 macOS 14.6.1
|
|
890
892
|
|
pygeodesy/lcc.py
CHANGED
|
@@ -24,15 +24,17 @@ and John P. Snyder U{'Map Projections - A Working Manual'<https://Pubs.USGS.gov/
|
|
|
24
24
|
# make sure int/int division yields float quotient, see .basics
|
|
25
25
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
26
26
|
|
|
27
|
-
from pygeodesy.basics import copysign0, _xinstanceof, _xsubclassof
|
|
27
|
+
from pygeodesy.basics import copysign0, _isin, _xinstanceof, _xsubclassof, \
|
|
28
|
+
typename
|
|
28
29
|
from pygeodesy.constants import EPS, EPS02, PI_2, _float as _F, _0_0, _0_5, \
|
|
29
30
|
_1_0, _2_0, _90_0
|
|
30
31
|
from pygeodesy.ellipsoidalBase import LatLonEllipsoidalBase as _LLEB
|
|
31
32
|
from pygeodesy.datums import Datums, _ellipsoidal_datum
|
|
32
33
|
from pygeodesy.errors import _IsnotError, _ValueError
|
|
33
34
|
from pygeodesy.fmath import hypot, _ALL_LAZY
|
|
34
|
-
from pygeodesy.
|
|
35
|
-
|
|
35
|
+
# from pygeodesy.internals import typename # from .basics
|
|
36
|
+
from pygeodesy.interns import NN, _COMMASPACE_, _DMAIN_, _ellipsoidal_, _GRS80_, \
|
|
37
|
+
_k0_, _lat0_, _lon0_, _m_, _NAD83_, _NTF_, _SPACE_, \
|
|
36
38
|
_WGS84_, _C_ # PYCHOK used!
|
|
37
39
|
# from pygeodesy.lazily import _ALL_LAZY # from .fmath
|
|
38
40
|
from pygeodesy.named import _lazyNamedEnumItem as _lazy, _name2__, _NamedBase, \
|
|
@@ -48,7 +50,7 @@ from pygeodesy.utily import atan1, degrees90, degrees180, sincos2, tanPI_2_2
|
|
|
48
50
|
from math import atan, fabs, log, radians, sin, sqrt
|
|
49
51
|
|
|
50
52
|
__all__ = _ALL_LAZY.lcc
|
|
51
|
-
__version__ = '
|
|
53
|
+
__version__ = '25.04.14'
|
|
52
54
|
|
|
53
55
|
_E0_ = 'E0'
|
|
54
56
|
_N0_ = 'N0'
|
|
@@ -348,7 +350,7 @@ class Conic(_NamedEnumItem):
|
|
|
348
350
|
return PI_2 - atan(t_x) * _2_0 # XXX + self._phi0
|
|
349
351
|
|
|
350
352
|
|
|
351
|
-
Conic._name = Conic
|
|
353
|
+
Conic._name = typename(Conic)
|
|
352
354
|
|
|
353
355
|
|
|
354
356
|
class Conics(_NamedEnum):
|
|
@@ -414,7 +416,7 @@ class Lcc(_NamedBase):
|
|
|
414
416
|
|
|
415
417
|
@raise TypeError: If B{C{conic}} is not L{Conic}.
|
|
416
418
|
'''
|
|
417
|
-
if
|
|
419
|
+
if not _isin(conic, None, Lcc._conic):
|
|
418
420
|
self.conic = conic
|
|
419
421
|
self._easting = Easting(e, falsed=conic.E0 > 0, Error=LCCError)
|
|
420
422
|
self._northing = Northing(n, falsed=conic.N0 > 0, Error=LCCError)
|
|
@@ -524,7 +526,7 @@ class Lcc(_NamedBase):
|
|
|
524
526
|
|
|
525
527
|
@raise TypeError: If B{C{datum}} is not ellipsoidal.
|
|
526
528
|
'''
|
|
527
|
-
if datum
|
|
529
|
+
if _isin(datum, None, self.conic.datum):
|
|
528
530
|
r = LatLonDatum3Tuple(self.latlon.lat,
|
|
529
531
|
self.latlon.lon,
|
|
530
532
|
self.conic.datum, name=self.name)
|
|
@@ -556,7 +558,7 @@ class Lcc(_NamedBase):
|
|
|
556
558
|
_xsubclassof(_LLEB, LatLon=LatLon)
|
|
557
559
|
|
|
558
560
|
c = self.conic
|
|
559
|
-
if
|
|
561
|
+
if not _isin(datum, None, self.conic.datum):
|
|
560
562
|
c = c.toDatum(datum)
|
|
561
563
|
|
|
562
564
|
e = self.easting - c._E0
|
|
@@ -648,7 +650,7 @@ def toLcc(latlon, conic=Conics.WRF_Lb, height=None, Lcc=Lcc,
|
|
|
648
650
|
return _xnamed(r, name) if name else r
|
|
649
651
|
|
|
650
652
|
|
|
651
|
-
if __name__ ==
|
|
653
|
+
if __name__ == _DMAIN_:
|
|
652
654
|
|
|
653
655
|
from pygeodesy.interns import _NL_, _NLATvar_
|
|
654
656
|
from pygeodesy.lazily import printf
|
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!
|
|
@@ -25,6 +25,7 @@ from pygeodesy.errors import _NotImplementedError, _ValueError, _xattr, \
|
|
|
25
25
|
_xkwds, _xkwds_get, _xkwds_pop2
|
|
26
26
|
from pygeodesy.fmath import fabs, 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__ = '
|
|
48
|
+
__version__ = '25.04.14'
|
|
48
49
|
|
|
49
50
|
_height0_ = _height_ + _0_
|
|
50
51
|
_narrow_ = 'narrow'
|
|
@@ -714,7 +715,7 @@ class _ChLV(object):
|
|
|
714
715
|
'''
|
|
715
716
|
if bool(M): # PYCHOK no cover
|
|
716
717
|
m = self.forward if fw else self.reverse # PYCHOK attr
|
|
717
|
-
n = _DOT_(self
|
|
718
|
+
n = _DOT_(*map1(typename, type(self), m))
|
|
718
719
|
raise _NotImplementedError(unstr(n, M=M), txt=None)
|
|
719
720
|
t = Y_X_h_lat_lon_h + (self, self._t0, None) # PYCHOK _t0
|
|
720
721
|
return ChLV9Tuple(t, name=name)
|
|
@@ -776,8 +777,8 @@ class _ChLV(object):
|
|
|
776
777
|
def _falsing2(LV95):
|
|
777
778
|
'''(INTERNAL) Get the C{LV95} or C{LV03} falsing.
|
|
778
779
|
'''
|
|
779
|
-
return _ChLV._95_falsing if LV95
|
|
780
|
-
_ChLV._03_falsing if LV95
|
|
780
|
+
return _ChLV._95_falsing if _isin(LV95, True, 95) else (
|
|
781
|
+
_ChLV._03_falsing if _isin(LV95, False, 3) else ChLVYX2Tuple(0, 0))
|
|
781
782
|
|
|
782
783
|
@staticmethod
|
|
783
784
|
def _llh2abh_3(lat, lon, h):
|
|
@@ -1079,7 +1080,7 @@ def _toLocal(inst, ltp, Xyz, Xyz_kwds):
|
|
|
1079
1080
|
def _toLtp(inst, Ecef, ecef9, name):
|
|
1080
1081
|
'''(INTERNAL) Helper for C{CartesianBase.toLtp}, C{ecef.toLtp} and C{latLonBase.toLtp}.
|
|
1081
1082
|
'''
|
|
1082
|
-
return inst._Ltp if (not name) and Ecef
|
|
1083
|
+
return inst._Ltp if (not name) and _isin(Ecef, None, inst.Ecef) else \
|
|
1083
1084
|
Ltp(ecef9, ecef=Ecef(inst.datum), name=inst._name__(name))
|
|
1084
1085
|
|
|
1085
1086
|
|
pygeodesy/ltpTuples.py
CHANGED
|
@@ -22,7 +22,7 @@ from pygeodesy.interns import NN, _4_, _azimuth_, _center_, _COMMASPACE_, \
|
|
|
22
22
|
_ltp_, _M_, _name_, _up_, _X_, _x_, _xyz_, \
|
|
23
23
|
_Y_, _y_, _z_
|
|
24
24
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
25
|
-
# from pygeodesy.ltp
|
|
25
|
+
# from pygeodesy.ltp Attitude, ChLV, ChLVa, ChLVe _Xltp # _MODS.into
|
|
26
26
|
from pygeodesy.named import _name__, _name1__, _name2__, _NamedBase, \
|
|
27
27
|
_NamedTuple, _Pass, _xnamed
|
|
28
28
|
from pygeodesy.namedTuples import LatLon2Tuple, PhiLam2Tuple, Vector3Tuple
|
|
@@ -176,7 +176,7 @@ class _Abc4Tuple(_NamedTuple):
|
|
|
176
176
|
elif Cls is Local9Tuple: # PYCHOK no cover
|
|
177
177
|
r = self.xyzLocal.toLocal9Tuple(**kwds)
|
|
178
178
|
else: # PYCHOK no cover
|
|
179
|
-
n = Abc.__name__[:3]
|
|
179
|
+
n = Abc.__name__[:3] # typename
|
|
180
180
|
raise _TypesError(n, Cls, Aer, Enu, Ned, XyzLocal)
|
|
181
181
|
return r
|
|
182
182
|
|
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_,
|
|
45
|
-
_northing_, _SPACE_, _W_, _Y_,
|
|
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__ = '
|
|
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
|
|
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__ ==
|
|
653
|
+
if __name__ == _DMAIN_:
|
|
653
654
|
|
|
654
655
|
def _main():
|
|
655
656
|
|