pygeodesy 24.5.6__py2.py3-none-any.whl → 24.5.15__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 (51) hide show
  1. {PyGeodesy-24.5.6.dist-info → PyGeodesy-24.5.15.dist-info}/METADATA +4 -4
  2. {PyGeodesy-24.5.6.dist-info → PyGeodesy-24.5.15.dist-info}/RECORD +51 -50
  3. pygeodesy/__init__.py +18 -14
  4. pygeodesy/__main__.py +9 -10
  5. pygeodesy/albers.py +2 -2
  6. pygeodesy/auxilats/__main__.py +7 -10
  7. pygeodesy/auxilats/auxLat.py +2 -1
  8. pygeodesy/basics.py +161 -165
  9. pygeodesy/booleans.py +4 -4
  10. pygeodesy/constants.py +8 -6
  11. pygeodesy/datums.py +9 -8
  12. pygeodesy/ecef.py +5 -4
  13. pygeodesy/elevations.py +2 -2
  14. pygeodesy/ellipsoidalBaseDI.py +7 -5
  15. pygeodesy/elliptic.py +10 -7
  16. pygeodesy/errors.py +6 -6
  17. pygeodesy/etm.py +3 -2
  18. pygeodesy/fmath.py +14 -13
  19. pygeodesy/fstats.py +281 -219
  20. pygeodesy/fsums.py +133 -104
  21. pygeodesy/geodesicw.py +14 -14
  22. pygeodesy/geodesicx/__main__.py +4 -4
  23. pygeodesy/geodesicx/gxarea.py +4 -4
  24. pygeodesy/geodsolve.py +3 -2
  25. pygeodesy/geoids.py +6 -6
  26. pygeodesy/heights.py +4 -4
  27. pygeodesy/internals.py +571 -0
  28. pygeodesy/interns.py +5 -202
  29. pygeodesy/iters.py +3 -2
  30. pygeodesy/karney.py +4 -4
  31. pygeodesy/ktm.py +7 -7
  32. pygeodesy/lazily.py +139 -217
  33. pygeodesy/mgrs.py +3 -2
  34. pygeodesy/named.py +13 -10
  35. pygeodesy/nvectorBase.py +4 -3
  36. pygeodesy/osgr.py +14 -12
  37. pygeodesy/points.py +5 -5
  38. pygeodesy/props.py +7 -7
  39. pygeodesy/rhumb/bases.py +3 -2
  40. pygeodesy/rhumb/solve.py +2 -2
  41. pygeodesy/solveBase.py +3 -2
  42. pygeodesy/streprs.py +5 -4
  43. pygeodesy/trf.py +4 -4
  44. pygeodesy/units.py +15 -17
  45. pygeodesy/ups.py +7 -6
  46. pygeodesy/utily.py +4 -4
  47. pygeodesy/utm.py +5 -4
  48. pygeodesy/utmupsBase.py +4 -3
  49. pygeodesy/vector3dBase.py +2 -1
  50. {PyGeodesy-24.5.6.dist-info → PyGeodesy-24.5.15.dist-info}/WHEEL +0 -0
  51. {PyGeodesy-24.5.6.dist-info → PyGeodesy-24.5.15.dist-info}/top_level.txt +0 -0
pygeodesy/interns.py CHANGED
@@ -5,14 +5,11 @@ modules and function L{pygeodesy.machine}.
5
5
  '''
6
6
  import sys as _sys
7
7
  try:
8
- _intern = intern # PYCHOK in .lazily
8
+ _intern = intern # PYCHOK in .lazily, .trf
9
9
  except NameError: # Python 3+
10
10
  _intern = _sys.intern
11
11
 
12
12
  _COMMASPACE_ = ', ' # overriden below
13
- _pf2List = [] # cached _platform2 list
14
- _Py3List = [] # cached _pythonarchine list
15
-
16
13
  _sub_packages = 'auxilats', 'deprecated', 'geodesicx', 'rhumb' # PYCHOK in .lazily,
17
14
  # ... make._dist, MANIFEST, setup.setup, test.bases, test.testModules
18
15
 
@@ -332,6 +329,7 @@ _null_ = 'null' # PYCHOK OK
332
329
  _number_ = 'number' # PYCHOK OK
333
330
  _numpy_ = 'numpy' # PYCHOK OK
334
331
  _Nv00_ = 'Nv00' # PYCHOK OK
332
+ _odd_ = 'odd' # PYCHOK OK
335
333
  _of_ = 'of' # PYCHOK OK
336
334
  _on_ = 'on' # PYCHOK OK
337
335
  _opposite_ = 'opposite' # PYCHOK OK
@@ -450,204 +448,9 @@ _LR_PAIRS = {_LANGLE_: _RANGLE_,
450
448
  _LPAREN_: _RPAREN_,
451
449
  _LSQUARE_: _RSQUARE_} # PYCHOK OK
452
450
 
453
-
454
- def _dunder_nameof(inst, *dflt):
455
- '''(INTERNAL) Get the double_underscore __name__ attr.
456
- '''
457
- try:
458
- return inst.__name__
459
- except AttributeError:
460
- pass
461
- return dflt[0] if dflt else inst.__class__.__name__
462
-
463
-
464
- def _enquote(strs, quote=_QUOTE2_, white=NN): # in .basics, .solveBase
465
- '''(INTERNAL) Enquote a string containing whitespace or replace
466
- whitespace by C{white} if specified.
467
- '''
468
- if strs:
469
- t = strs.split()
470
- if len(t) > 1:
471
- strs = white.join(t if white else (quote, strs, quote))
472
- return strs
473
-
474
-
475
- def _headof(name):
476
- '''(INTERNAL) Get the head name of qualified C{name} or the C{name}.
477
- '''
478
- i = name.find(_DOT_)
479
- return name if i < 0 else name[:i]
480
-
481
-
482
- def _is(a, b): # PYCHOK no cover
483
- '''(INTERNAL) C{a is b}? in C{PyPy}
484
- '''
485
- return (a == b) if _isPyPy() else (a is b)
486
-
487
-
488
- def _isPyPy():
489
- '''(INTERNAL) Is this C{PyPy}?
490
- '''
491
- # platform.python_implementation() == 'PyPy'
492
- return _pythonarchine()[0].startswith(_PyPy__)
493
-
494
-
495
- def _load_lib(name):
496
- '''(INTERNAL) Load a C{dylib}, B{C{name}} must startwith('lib').
497
- '''
498
- # macOS 11+ (aka 10.16) no longer provides direct loading of
499
- # system libraries. As a result, C{ctypes.util.find_library}
500
- # will not find any library, unless previously installed by a
501
- # low-level dlopen(name) call (with the library base C{name}).
502
- from ctypes import CDLL
503
- from ctypes.util import find_library
504
-
505
- ns = find_library(name), name
506
- if _sys.platform[:6] == 'darwin': # and os.name == 'posix'
507
- from ctypes import _dlopen, DEFAULT_MODE
508
- from os.path import join
509
- ns += (_DOT_(name, 'dylib'),
510
- _DOT_(name, 'framework'), join(
511
- _DOT_(name, 'framework'), name))
512
- else: # non-macOS
513
- DEFAULT_MODE = 0
514
-
515
- def _dlopen(*unused):
516
- return True
517
-
518
- for n in ns:
519
- try:
520
- if n and _dlopen(n, DEFAULT_MODE): # pre-load handle
521
- lib = CDLL(n) # == ctypes.cdll.LoadLibrary(n)
522
- if lib._name: # has a qualified name
523
- return lib
524
- except (AttributeError, OSError):
525
- pass
526
-
527
- return None # raise OSError
528
-
529
-
530
- def machine():
531
- '''Return standard C{platform.machine}, but distinguishing Intel I{native}
532
- from Intel I{emulation} on Apple Silicon (on macOS only).
533
-
534
- @return: Machine C{'arm64'} for Apple Silicon I{native}, C{'x86_64'}
535
- for Intel I{native}, C{"arm64_x86_64"} for Intel I{emulation},
536
- etc. (C{str} with C{comma}s replaced by C{underscore}s).
537
- '''
538
- return _platform2()[1]
539
-
540
-
541
- def _platform2(sep=NN):
542
- '''(INTERNAL) Get platform architecture and machine as C{2-list} or C{str}.
543
- '''
544
- L = _pf2List
545
- if not L:
546
- import platform
547
- m = platform.machine() # ARM64, arm64, x86_64, iPhone13,2, etc.
548
- m = m.replace(_COMMA_, _UNDER_)
549
- if m.lower() == 'x86_64': # on Intel or Rosetta2 ...
550
- v = platform.mac_ver() # ... and only on macOS ...
551
- if v and _version2(v[0]) > (10, 15): # ... 11+ aka 10.16
552
- # <https://Developer.Apple.com/forums/thread/659846>
553
- if _sysctl_uint('sysctl.proc_translated') == 1: # and \
554
- # _sysctl_uint('hw.optional.arm64') == 1: # PYCHOK indent
555
- m = _UNDER_('arm64', m) # Apple Si emulating Intel x86-64
556
- L[:] = [platform.architecture()[0], # bits
557
- m] # arm64, arm64_x86_64, x86_64, etc.
558
- return sep.join(L) if sep else L # 2-list()
559
-
560
-
561
- def _pythonarchine(sep=NN): # in test/bases.py versions
562
- '''(INTERNAL) Get PyPy and Python versions and C{_platform2} as C{3- or 4-list} or C{str}.
563
- '''
564
- L = _Py3List
565
- if not L:
566
- v = _sys.version
567
- L[:] = [_Python_(v)] + _platform2()
568
- pypy = _PyPy__(v)
569
- if pypy:
570
- L.insert(0, pypy)
571
- return sep.join(L) if sep else L # 3- or 4-list
572
-
573
-
574
- def _sysctl_uint(name):
575
- '''(INTERNAL) Get an unsigned int sysctl item by name, use on macOS ONLY!
576
- '''
577
- libc = _load_lib('libc')
578
- if libc: # <https://StackOverflow.com/questions/759892/python-ctypes-and-sysctl>
579
- from ctypes import byref, c_char_p, c_size_t, c_uint, sizeof # get_errno
580
- n = name if str is bytes else bytes(name, _utf_8_) # PYCHOK isPython2 = str is bytes
581
- u = c_uint(0)
582
- z = c_size_t(sizeof(u))
583
- r = libc.sysctlbyname(c_char_p(n), byref(u), byref(z), None, c_size_t(0))
584
- else: # could find or load 'libc'
585
- r = -2
586
- return int(r if r else u.value) # -1 ENOENT error, -2 no libc
587
-
588
-
589
- def _tailof(name):
590
- '''(INTERNAL) Get the base name of qualified C{name} or the C{name}.
591
- '''
592
- i = name.rfind(_DOT_) + 1
593
- return name[i:] if i > 0 else name
594
-
595
-
596
- def _under(name): # PYCHOK in .datums, .auxilats, .ups, .utm, .utmupsBase, ...
597
- '''(INTERNAL) Prefix C{name} with I{underscore}.
598
- '''
599
- return name if name.startswith(_UNDER_) else NN(_UNDER_, name)
600
-
601
-
602
- def _usage(file_py, *args): # in .etm
603
- '''(INTERNAL) Build "usage: python -m ..." cmd line for module B{C{file_py}}.
604
- '''
605
- import os
606
- m = os.path.dirname(file_py).replace(os.getcwd(), _ELLIPSIS_) \
607
- .replace(os.sep, _DOT_).strip()
608
- b, x = os.path.splitext(os.path.basename(file_py))
609
- if x == '.py' and b != '__main__':
610
- m = _DOT_(m or _pygeodesy_, b)
611
- p = NN(_python_, _sys.version_info[0])
612
- return NN('usage', _SPACE_(_COLON_, p, '-m', _enquote(m), *args))
613
-
614
-
615
- def _version2(version, n=2):
616
- '''(INTERNAL) Split C{B{version} str} into a C{1-, 2- or 3-tuple} of C{int}s.
617
- '''
618
- t = _version_ints(version.split(_DOT_, 2))
619
- if len(t) < n:
620
- t += (0,) * n
621
- return t[:n]
622
-
623
-
624
- def _version_info(package): # in .Base.karney, .basics
625
- '''(INTERNAL) Get the C{package.__version_info__} as a 2- or
626
- 3-tuple C{(major, minor, revision)} if C{int}s.
627
- '''
628
- try:
629
- return _version_ints(package.__version_info__)
630
- except AttributeError:
631
- return _version2(package.__version__.strip(), n=3)
632
-
633
-
634
- def _version_ints(vs):
635
- # helper for _version2 and _version_info above
636
-
637
- def _ints(vs):
638
- for v in vs:
639
- try:
640
- yield int(v.strip())
641
- except (TypeError, ValueError):
642
- pass
643
-
644
- return tuple(_ints(vs))
645
-
646
-
647
- __all__ = (_NN_, # not MISSING!
648
- Str_.__name__, # classes
649
- machine.__name__) # in .lazily
650
- __version__ = '24.05.06'
451
+ __all__ = (_NN_, # NOT MISSING!
452
+ Str_.__name__) # classes
453
+ __version__ = '24.05.13'
651
454
 
652
455
  if __name__ == '__main__':
653
456
 
pygeodesy/iters.py CHANGED
@@ -9,11 +9,12 @@ the initial items, skipping of duplicate items and copying of the
9
9
  iterated items.
10
10
  '''
11
11
 
12
- from pygeodesy.basics import islistuple, issubclassof, \
13
- len2, map2, _passarg
12
+ from pygeodesy.basics import islistuple, issubclassof, len2, \
13
+ map2, _passarg
14
14
  # from pygeodesy.constants import _1_0 # from .utily
15
15
  from pygeodesy.errors import _IndexError, LenError, PointsError, \
16
16
  _TypeError, _ValueError
17
+ # from pygeodesy.internals import _passarg # from .basics
17
18
  from pygeodesy.interns import NN, _0_, _composite_, _few_, \
18
19
  _latlon_, _points_, _too_
19
20
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
pygeodesy/karney.py CHANGED
@@ -140,15 +140,15 @@ in C{pygeodesy} are based on I{Karney}'s post U{Area of a spherical polygon
140
140
  from __future__ import division as _; del _ # PYCHOK semicolon
141
141
 
142
142
  from pygeodesy.basics import _copysign, int1s, isint, itemsorted, neg, unsigned0, \
143
- _xgeographiclib, _zip
143
+ _xgeographiclib, _zip, _version_info
144
144
  from pygeodesy.constants import NAN, _isfinite as _math_isfinite, _0_0, \
145
145
  _1_16th, _1_0, _2_0, _180_0, _N_180_0, _360_0
146
146
  from pygeodesy.errors import GeodesicError, _ValueError, _xkwds, _xkwds_get
147
147
  from pygeodesy.fmath import cbrt, fremainder, norm2
148
+ # from pygeodesy.internals import _version_info # from .basics
148
149
  from pygeodesy.interns import NN, _2_, _a12_, _area_, _azi2_, _azi12_, _composite_, \
149
150
  _lat1_, _lat2_, _lon1_, _lon2_, _m12_, _M12_, _M21_, \
150
- _number_, _s12_, _S12_, _UNDER_, _version_info, \
151
- _BAR_ # PYCHOK used!
151
+ _number_, _s12_, _S12_, _UNDER_, _BAR_ # PYCHOK used!
152
152
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS, _getenv
153
153
  from pygeodesy.named import ADict, _NamedBase, _NamedTuple, notImplemented, _Pass
154
154
  from pygeodesy.props import deprecated_method, Property_RO
@@ -159,7 +159,7 @@ from pygeodesy.utily import atan2d, sincos2d, tand, _unrollon, fabs
159
159
  # from math import fabs # from .utily
160
160
 
161
161
  __all__ = _ALL_LAZY.karney
162
- __version__ = '24.03.22'
162
+ __version__ = '24.05.13'
163
163
 
164
164
  _K_2_0 = _getenv('PYGEODESY_GEOGRAPHICLIB', _2_) == _2_
165
165
  _perimeter_ = 'perimeter'
pygeodesy/ktm.py CHANGED
@@ -53,13 +53,13 @@ from pygeodesy.fmath import hypot, hypot1
53
53
  from pygeodesy.fsums import fsum1f_
54
54
  from pygeodesy.interns import NN, _COMMASPACE_, _singular_
55
55
  from pygeodesy.karney import _atan2d, _diff182, _fix90, _norm180, \
56
- _polynomial, _unsigned2, _NamedBase
57
- from pygeodesy.lazily import _ALL_LAZY, _pairs
58
- # from pygeodesy.named import _NamedBase # from .karney
56
+ _polynomial, _unsigned2
57
+ # from pygeodesy.lazily import _ALL_LAZY # from .named
58
+ from pygeodesy.named import _NamedBase, pairs, _ALL_LAZY
59
59
  from pygeodesy.namedTuples import Forward4Tuple, Reverse4Tuple
60
60
  from pygeodesy.props import property_doc_, Property, Property_RO, \
61
61
  _update_all
62
- # from pygeodesy.streprs import pairs as _pairs # from .lazily
62
+ # from pygeodesy.streprs import pairs # from .named
63
63
  from pygeodesy.units import Degrees, Scalar_, _1mm as _TOL_10 # PYCHOK used!
64
64
  from pygeodesy.utily import atan1d, _loneg, sincos2, sincos2d_
65
65
 
@@ -67,7 +67,7 @@ from cmath import polar
67
67
  from math import atan2, asinh, cos, cosh, degrees, fabs, sin, sinh, sqrt, tanh
68
68
 
69
69
  __all__ = _ALL_LAZY.ktm
70
- __version__ = '24.01.02'
70
+ __version__ = '24.05.11'
71
71
 
72
72
 
73
73
  class KTMError(_ValueError):
@@ -419,7 +419,7 @@ class KTransverseMercator(_NamedBase):
419
419
  d = dict(ellipsoid=self.ellipsoid, k0=self.k0, TMorder=self.TMorder)
420
420
  if self.name: # PYCHOK no cover
421
421
  d.update(name=self.name)
422
- return _COMMASPACE_.join(_pairs(d, **kwds))
422
+ return _COMMASPACE_.join(pairs(d, **kwds))
423
423
 
424
424
 
425
425
  def _cma(a, b0, b1, Cn):
@@ -605,7 +605,7 @@ assert set(_AlpCoeffs.keys()) == set(_BetCoeffs.keys())
605
605
 
606
606
  if __name__ == '__main__':
607
607
 
608
- from pygeodesy.interns import _usage
608
+ from pygeodesy.internals import _usage
609
609
  from sys import argv, exit as _exit
610
610
 
611
611
  _exit(_usage(*argv).replace('.ktm', '.etm -series'))