pygeodesy 24.5.15__py2.py3-none-any.whl → 24.5.24__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 (72) hide show
  1. {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.5.24.dist-info}/METADATA +2 -2
  2. PyGeodesy-24.5.24.dist-info/RECORD +116 -0
  3. pygeodesy/__init__.py +1 -1
  4. pygeodesy/albers.py +41 -41
  5. pygeodesy/auxilats/__init__.py +1 -1
  6. pygeodesy/auxilats/auxAngle.py +32 -31
  7. pygeodesy/auxilats/auxLat.py +80 -51
  8. pygeodesy/azimuthal.py +123 -124
  9. pygeodesy/basics.py +8 -6
  10. pygeodesy/booleans.py +11 -12
  11. pygeodesy/cartesianBase.py +25 -23
  12. pygeodesy/clipy.py +3 -3
  13. pygeodesy/css.py +50 -42
  14. pygeodesy/datums.py +42 -41
  15. pygeodesy/dms.py +6 -6
  16. pygeodesy/ecef.py +23 -24
  17. pygeodesy/ellipsoidalBase.py +28 -27
  18. pygeodesy/ellipsoidalBaseDI.py +3 -4
  19. pygeodesy/ellipsoidalNvector.py +11 -12
  20. pygeodesy/ellipsoids.py +41 -35
  21. pygeodesy/elliptic.py +3 -4
  22. pygeodesy/epsg.py +4 -3
  23. pygeodesy/errors.py +34 -12
  24. pygeodesy/etm.py +62 -54
  25. pygeodesy/fmath.py +36 -30
  26. pygeodesy/formy.py +93 -65
  27. pygeodesy/frechet.py +117 -102
  28. pygeodesy/fstats.py +21 -14
  29. pygeodesy/fsums.py +67 -57
  30. pygeodesy/gars.py +10 -9
  31. pygeodesy/geodesicw.py +19 -17
  32. pygeodesy/geodesicx/__init__.py +1 -1
  33. pygeodesy/geodesicx/gx.py +40 -32
  34. pygeodesy/geodesicx/gxarea.py +12 -9
  35. pygeodesy/geodesicx/gxbases.py +3 -4
  36. pygeodesy/geodesicx/gxline.py +6 -8
  37. pygeodesy/geodsolve.py +28 -27
  38. pygeodesy/geohash.py +47 -44
  39. pygeodesy/geoids.py +34 -32
  40. pygeodesy/hausdorff.py +112 -99
  41. pygeodesy/heights.py +134 -127
  42. pygeodesy/internals.py +14 -9
  43. pygeodesy/interns.py +3 -6
  44. pygeodesy/iters.py +19 -17
  45. pygeodesy/karney.py +15 -12
  46. pygeodesy/ktm.py +25 -18
  47. pygeodesy/latlonBase.py +12 -11
  48. pygeodesy/lazily.py +4 -4
  49. pygeodesy/lcc.py +24 -25
  50. pygeodesy/ltp.py +83 -71
  51. pygeodesy/ltpTuples.py +7 -5
  52. pygeodesy/mgrs.py +3 -3
  53. pygeodesy/named.py +126 -42
  54. pygeodesy/namedTuples.py +33 -25
  55. pygeodesy/nvectorBase.py +7 -7
  56. pygeodesy/points.py +9 -9
  57. pygeodesy/rhumb/__init__.py +1 -1
  58. pygeodesy/solveBase.py +5 -5
  59. pygeodesy/sphericalTrigonometry.py +5 -5
  60. pygeodesy/streprs.py +5 -5
  61. pygeodesy/trf.py +5 -5
  62. pygeodesy/triaxials.py +67 -63
  63. pygeodesy/units.py +35 -35
  64. pygeodesy/unitsBase.py +24 -11
  65. pygeodesy/utm.py +53 -53
  66. pygeodesy/utmupsBase.py +10 -8
  67. pygeodesy/vector2d.py +6 -7
  68. pygeodesy/vector3d.py +16 -17
  69. pygeodesy/vector3dBase.py +4 -5
  70. PyGeodesy-24.5.15.dist-info/RECORD +0 -116
  71. {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.5.24.dist-info}/WHEEL +0 -0
  72. {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.5.24.dist-info}/top_level.txt +0 -0
pygeodesy/datums.py CHANGED
@@ -73,8 +73,7 @@ from pygeodesy.constants import R_M, _float as _F, _0_0, _1_0, _2_0, _8_0, _3600
73
73
  # LatLonEllipsoidalBase as _LLEB # MODS
74
74
  from pygeodesy.ellipsoids import a_f2Tuple, Ellipsoid, Ellipsoid2, Ellipsoids, _EWGS84, \
75
75
  Vector3Tuple
76
- from pygeodesy.errors import _IsnotError, _TypeError, _xattr, _xellipsoidall, _xkwds, \
77
- _xkwds_pop2
76
+ from pygeodesy.errors import _IsnotError, _TypeError, _xellipsoidall, _xkwds, _xkwds_pop2
78
77
  from pygeodesy.fmath import fdot, fmean, Fmt, _operator
79
78
  from pygeodesy.internals import _passarg, _under
80
79
  from pygeodesy.interns import NN, _a_, _Airy1830_, _AiryModified_, _BAR_, _Bessel1841_, \
@@ -84,7 +83,8 @@ from pygeodesy.interns import NN, _a_, _Airy1830_, _AiryModified_, _BAR_, _Besse
84
83
  _PLUS_, _Sphere_, _spherical_, _transform_, _UNDER_, \
85
84
  _WGS72_, _WGS84_
86
85
  from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
87
- from pygeodesy.named import _NamedEnum, _NamedEnumItem, _lazyNamedEnumItem as _lazy
86
+ from pygeodesy.named import _lazyNamedEnumItem as _lazy, _name__, _name2__, _NamedEnum, \
87
+ _NamedEnumItem
88
88
  # from pygeodesy.namedTuples import Vector3Tuple # from .ellipsoids
89
89
  from pygeodesy.props import Property_RO, property_RO
90
90
  # from pygeodesy.streprs import Fmt # from .fmath
@@ -94,7 +94,7 @@ from pygeodesy.units import _isRadius, Radius_, radians
94
94
  # import operator as _operator # from .fmath
95
95
 
96
96
  __all__ = _ALL_LAZY.datums
97
- __version__ = '24.05.14'
97
+ __version__ = '24.05.21'
98
98
 
99
99
  _a_ellipsoid_ = _UNDER_(_a_, _ellipsoid_)
100
100
  _BD72_ = 'BD72'
@@ -204,15 +204,15 @@ class Transform(_NamedEnumItem):
204
204
  def __neg__(self):
205
205
  return self.inverse()
206
206
 
207
- def inverse(self, name=NN):
207
+ def inverse(self, **name):
208
208
  '''Return the inverse of this transform.
209
209
 
210
210
  @kwarg name: Optional, unique name (C{str}).
211
211
 
212
212
  @return: Inverse (L{Transform}), unregistered.
213
213
  '''
214
- r = type(self)(**dict(self.items(inverse=True)))
215
- n = name or _negastr(self.name)
214
+ r = type(self)(**dict(self.items(inverse=True)))
215
+ n = _name__(**name) or _negastr(self.name)
216
216
  if n:
217
217
  r.name = n # unregistered
218
218
  return r
@@ -248,16 +248,17 @@ class Transform(_NamedEnumItem):
248
248
  self.s = s = (s1 - _1_0) / _S1_S
249
249
  return s
250
250
 
251
- def toStr(self, prec=5, fmt=Fmt.g, name=NN, **unused): # PYCHOK expected
251
+ def toStr(self, prec=5, fmt=Fmt.g, **name): # PYCHOK expected
252
252
  '''Return this transform as a string.
253
253
 
254
254
  @kwarg prec: Number of (decimal) digits, unstripped (C{int}).
255
255
  @kwarg fmt: Optional C{float} format (C{letter}).
256
- @kwarg name: Override name (C{str}) or C{None} to exclude
257
- this transform's name.
256
+ @kwarg name: Optional, override C{B{name}=NN} (C{str}) or
257
+ C{None} to exclude this transform's name.
258
258
 
259
259
  @return: Transform attributes (C{str}).
260
260
  '''
261
+ name, _ = _name2__(**name) # name=None
261
262
  return self._instr(name, prec, *_Names11, fmt=fmt)
262
263
 
263
264
  def transform(self, x, y, z, inverse=False, **Vector_and_kwds):
@@ -378,12 +379,12 @@ class Datum(_NamedEnumItem):
378
379
  _ellipsoid = Ellipsoids.WGS84 # default ellipsoid (L{Ellipsoid}, L{Ellipsoid2})
379
380
  _transform = Transforms.WGS84 # default transform (L{Transform})
380
381
 
381
- def __init__(self, ellipsoid, transform=None, name=NN):
382
+ def __init__(self, ellipsoid, transform=None, **name):
382
383
  '''New L{Datum}.
383
384
 
384
385
  @arg ellipsoid: The ellipsoid (L{Ellipsoid} or L{Ellipsoid2}).
385
386
  @kwarg transform: Optional transform (L{Transform}).
386
- @kwarg name: Optional, unique name (C{str}).
387
+ @kwarg name: Optional, unique C{B{name}=NN} (C{str}).
387
388
 
388
389
  @raise NameError: Datum with that B{C{name}} already exists.
389
390
 
@@ -397,7 +398,8 @@ class Datum(_NamedEnumItem):
397
398
  self._transform = transform or Datum._transform
398
399
  _xinstanceof(Transform, transform=self.transform)
399
400
 
400
- self._register(Datums, name or self.transform.name or self.ellipsoid.name)
401
+ self._register(Datums, _name__(name) or self.transform.name
402
+ or self.ellipsoid.name)
401
403
 
402
404
  def __eq__(self, other):
403
405
  '''Compare this and an other datum.
@@ -474,15 +476,16 @@ class Datum(_NamedEnumItem):
474
476
  '''
475
477
  return self.ellipsoid.isSpherical
476
478
 
477
- def toStr(self, sep=_COMMASPACE_, name=NN, **unused): # PYCHOK expected
479
+ def toStr(self, sep=_COMMASPACE_, **name): # PYCHOK expected
478
480
  '''Return this datum as a string.
479
481
 
480
482
  @kwarg sep: Separator to join (C{str}).
481
- @kwarg name: Override name (C{str}) or C{None} to exclude
482
- this datum's name.
483
+ @kwarg name: Optional, override C{B{name}=NN} (C{str}) or
484
+ C{None} to exclude this datum's name.
483
485
 
484
486
  @return: Datum attributes (C{str}).
485
487
  '''
488
+ name, _ = _name2__(**name) # name=None
486
489
  t = [] if name is None else \
487
490
  [Fmt.EQUAL(name=repr(name or self.named))]
488
491
  for a in (_ellipsoid_, _transform_):
@@ -497,7 +500,7 @@ class Datum(_NamedEnumItem):
497
500
  return self._transform
498
501
 
499
502
 
500
- def _earth_datum(inst, a_earth, f=None, name=NN, raiser=_a_ellipsoid_): # in .karney, .trf, ...
503
+ def _earth_datum(inst, a_earth, f=None, raiser=_a_ellipsoid_, **name): # in .karney, .trf, ...
501
504
  '''(INTERNAL) Set C{inst._datum} from C{(B{a_..}, B{f})} or C{B{.._ellipsoid}}
502
505
  (L{Ellipsoid}, L{Ellipsoid2}, L{Datum}, C{a_f2Tuple} or C{scalar} earth radius).
503
506
 
@@ -520,12 +523,12 @@ def _earth_datum(inst, a_earth, f=None, name=NN, raiser=_a_ellipsoid_): # in .k
520
523
  inst._datum = D
521
524
 
522
525
 
523
- def _earth_ellipsoid(earth, *name_raiser):
526
+ def _earth_ellipsoid(earth, **name_raiser):
524
527
  '''(INTERAL) Return the ellipsoid for the given C{earth} model.
525
528
  '''
526
529
  return Ellipsoids.Sphere if earth is R_M else (
527
530
  _EWGS84 if earth is _EWGS84 or earth is _WGS84 else
528
- _spherical_datum(earth, *name_raiser).ellipsoid)
531
+ _spherical_datum(earth, **name_raiser).ellipsoid)
529
532
 
530
533
 
531
534
  def _ED2(radius, name):
@@ -534,13 +537,13 @@ def _ED2(radius, name):
534
537
  D = Datums.Sphere
535
538
  E = D.ellipsoid
536
539
  if name or radius != E.a: # != E.b
537
- n = _under(name)
540
+ n = _under(_name__(name, _or_nameof=D))
538
541
  E = Ellipsoid(radius, radius, name=n)
539
542
  D = Datum(E, transform=Transforms.Identity, name=n)
540
543
  return E, D
541
544
 
542
545
 
543
- def _ellipsoidal_datum(earth, Error=TypeError, name=NN, raiser=NN):
546
+ def _ellipsoidal_datum(earth, Error=TypeError, raiser=NN, **name):
544
547
  '''(INTERNAL) Create a L{Datum} from an L{Ellipsoid} or L{Ellipsoid2},
545
548
  C{a_f2Tuple}, 2-tuple or 2-list B{C{earth}} model.
546
549
 
@@ -563,29 +566,25 @@ def _ellipsoidal_datum(earth, Error=TypeError, name=NN, raiser=NN):
563
566
  def _EnD3(earth, name):
564
567
  '''(INTERNAL) Helper for C{_earth_datum} and C{_ellipsoidal_datum}.
565
568
  '''
566
- D = None
569
+ D, n = None, _under(_name__(name, _or_nameof=earth))
567
570
  if isinstance(earth, (Ellipsoid, Ellipsoid2)):
568
- E = earth
569
- n = _under(name or E.name)
571
+ E = earth
570
572
  elif isinstance(earth, Datum):
571
- E = earth.ellipsoid
572
- n = _under(name or earth.name)
573
- D = earth
573
+ E = earth.ellipsoid
574
+ D = earth
574
575
  elif _isRadius(earth):
575
- E, D = _ED2(Radius_(earth), name)
576
- n = E.name
576
+ E, D = _ED2(Radius_(earth), n)
577
+ n = E.name
577
578
  elif isinstance(earth, a_f2Tuple):
578
- n = _under(name or earth.name)
579
- E = earth.ellipsoid(name=n)
579
+ E = earth.ellipsoid(name=n)
580
580
  elif islistuple(earth, minum=2):
581
- E = Ellipsoids.Sphere
581
+ E = Ellipsoids.Sphere
582
582
  a, f = earth[:2]
583
583
  if f or a != E.a: # != E.b
584
- n = _under(name or _xattr(earth, name=NN))
585
- E = Ellipsoid(a, f=f, name=n)
584
+ E = Ellipsoid(a, f=f, name=n)
586
585
  else:
587
- n = E.name
588
- D = Datums.Sphere
586
+ n = E.name
587
+ D = Datums.Sphere
589
588
  else:
590
589
  E, n = None, NN
591
590
  return E, n, D
@@ -624,16 +623,18 @@ def _negastr(name): # in .trf
624
623
  return n.lstrip(p) if n.startswith(p) else NN(m, n)
625
624
 
626
625
 
627
- def _spherical_datum(earth, Error=TypeError, name=NN, raiser=NN):
626
+ def _spherical_datum(earth, Error=TypeError, raiser=NN, **name):
628
627
  '''(INTERNAL) Create a L{Datum} from an L{Ellipsoid}, L{Ellipsoid2},
629
628
  C{a_f2Tuple}, 2-tuple, 2-list B{C{earth}} model or C{scalar} radius.
630
629
 
631
630
  @kwarg raiser: If not C{NN}, raise an B{C{Error}} if not spherical.
632
631
  '''
633
- if _isRadius(earth):
632
+ if isinstance(earth, Datum):
633
+ D = earth
634
+ elif _isRadius(earth):
634
635
  _, D = _ED2(Radius_(earth, Error=Error), name)
635
636
  else:
636
- D = _ellipsoidal_datum(earth, Error=Error, name=name)
637
+ D = _ellipsoidal_datum(earth, Error=Error, **name)
637
638
  if raiser and not D.isSpherical:
638
639
  raise _IsnotError(_spherical_, Error=Error, **{raiser: earth})
639
640
  return D
@@ -643,11 +644,11 @@ class Datums(_NamedEnum):
643
644
  '''(INTERNAL) L{Datum} registry, I{must} be a sub-class
644
645
  to accommodate the L{_LazyNamedEnumItem} properties.
645
646
  '''
646
- def _Lazy(self, ellipsoid_name, transform_name, name=NN):
647
+ def _Lazy(self, ellipsoid_name, transform_name, **name):
647
648
  '''(INTERNAL) Instantiate the L{Datum}.
648
649
  '''
649
650
  return Datum(Ellipsoids.get(ellipsoid_name),
650
- Transforms.get(transform_name), name=name)
651
+ Transforms.get(transform_name), **name)
651
652
 
652
653
  Datums = Datums(Datum) # PYCHOK singleton
653
654
  '''Some pre-defined L{Datum}s, all I{lazily} instantiated.'''
pygeodesy/dms.py CHANGED
@@ -66,10 +66,11 @@ from pygeodesy.basics import copysign0, isLatLon, isodd, issequence, isstr, map2
66
66
  from pygeodesy.constants import _umod_360, _0_0, _0_5, _60_0, _360_0, _3600_0
67
67
  from pygeodesy.errors import ParseError, RangeError, _TypeError, _ValueError,\
68
68
  _parseX, rangerrors, _xkwds, _xkwds_get
69
- from pygeodesy.interns import NN, _arg_, _COMMA_, _d_, _DASH_, _deg_, _degrees_, _DOT_, \
70
- _0_, _e_, _E_, _EW_, _f_, _F_, _g_, _MINUS_, _N_, _NE_, _NS_, \
71
- _NSEW_, _NW_, _of_, _PERCENTDOTSTAR_, _PLUS_, _PLUSMINUS_, \
72
- _QUOTE1_, _QUOTE2_, _radians_, _S_, _SE_, _SPACE_, _SW_, _W_
69
+ from pygeodesy.interns import NN, _arg_, _COMMA_, _d_, _DASH_, _deg_, _degrees_, \
70
+ _DOT_, _0_, _e_, _E_, _EW_, _f_, _F_, _g_, _keyword_, \
71
+ _MINUS_, _N_, _NE_, _NS_, _NSEW_, _NW_, _of_, \
72
+ _PERCENTDOTSTAR_, _PLUS_, _PLUSMINUS_, _QUOTE1_, \
73
+ _QUOTE2_, _radians_, _S_, _SE_, _SPACE_, _SW_, _W_
73
74
  from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _getenv
74
75
  # from pygeodesy.namedTuples import LatLon2Tuple # _MODS
75
76
  # from pygeodesy.props import _throwarning # _MODS
@@ -84,12 +85,11 @@ except ImportError: # Python 3+
84
85
  from string import ascii_letters as _LETTERS
85
86
 
86
87
  __all__ = _ALL_LAZY.dms
87
- __version__ = '24.03.21'
88
+ __version__ = '24.05.18'
88
89
 
89
90
  _beyond_ = 'beyond'
90
91
  _DDDMMSS_ = 'DDDMMSS'
91
92
  _deg_min_ = 'deg+min'
92
- _keyword_ = 'keyword'
93
93
  _SDIGITS_ = '-0123456789+'
94
94
  _sexagecimal_ = 'sexagecimal'
95
95
  _SEXAGECIMUL = 1.e4 # sexagecimal C{D.MMSSss} into decimal C{DMMSS.ss}
pygeodesy/ecef.py CHANGED
@@ -73,7 +73,7 @@ from pygeodesy.interns import NN, _a_, _C_, _datum_, _ellipsoid_, _f_, _height_,
73
73
  _lat_, _lon_, _M_, _name_, _singular_, _SPACE_, \
74
74
  _x_, _xyz_, _y_, _z_
75
75
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
76
- from pygeodesy.named import _NamedBase, _NamedTuple, _Pass, _xnamed
76
+ from pygeodesy.named import _name__, _NamedBase, _NamedTuple, _Pass, _xnamed
77
77
  from pygeodesy.namedTuples import LatLon2Tuple, LatLon3Tuple, \
78
78
  PhiLam2Tuple, Vector3Tuple, Vector4Tuple
79
79
  from pygeodesy.props import deprecated_method, Property_RO, property_RO, property_doc_
@@ -86,7 +86,7 @@ from pygeodesy.utily import atan1, atan1d, atan2d, degrees90, degrees180, \
86
86
  from math import atan2, cos, degrees, fabs, radians, sqrt
87
87
 
88
88
  __all__ = _ALL_LAZY.ecef
89
- __version__ = '24.05.10'
89
+ __version__ = '24.05.21'
90
90
 
91
91
  _Ecef_ = 'Ecef'
92
92
  _prolate_ = 'prolate'
@@ -108,7 +108,7 @@ class _EcefBase(_NamedBase):
108
108
  _E = _EWGS84
109
109
  _lon00 = INT0 # arbitrary, "polar" lon for LocalCartesian, Ltp
110
110
 
111
- def __init__(self, a_ellipsoid=_EWGS84, f=None, name=NN, lon00=INT0):
111
+ def __init__(self, a_ellipsoid=_EWGS84, f=None, lon00=INT0, **name):
112
112
  '''New C{Ecef*} converter.
113
113
 
114
114
  @arg a_ellipsoid: A (non-prolate) ellipsoid (L{Ellipsoid}, L{Ellipsoid2},
@@ -117,9 +117,9 @@ class _EcefBase(_NamedBase):
117
117
  @kwarg f: C{None} or the ellipsoid flattening (C{scalar}), required
118
118
  for C{scalar} B{C{a_ellipsoid}}, C{B{f}=0} represents a
119
119
  sphere, negative B{C{f}} a prolate ellipsoid.
120
- @kwarg name: Optional name (C{str}).
121
120
  @kwarg lon00: An arbitrary, I{"polar"} longitude (C{degrees}), see the
122
- methods C{reverse}.
121
+ C{reverse} method.
122
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
123
123
 
124
124
  @raise EcefError: If B{C{a_ellipsoid}} not L{Ellipsoid}, L{Ellipsoid2},
125
125
  L{Datum} or L{a_f2Tuple} or C{scalar} or B{C{f}} not
@@ -136,7 +136,7 @@ class _EcefBase(_NamedBase):
136
136
  raise ValueError # _invalid_
137
137
 
138
138
  if E not in (_EWGS84, _WGS84):
139
- d = _ellipsoidal_datum(E, name=name)
139
+ d = _ellipsoidal_datum(E, **name)
140
140
  E = d.ellipsoid
141
141
  if E.a < EPS or E.f > EPS1:
142
142
  raise ValueError # _invalid_
@@ -211,7 +211,7 @@ class _EcefBase(_NamedBase):
211
211
  0, m, self.datum,
212
212
  name=name or self.name)
213
213
 
214
- def forward(self, latlonh, lon=None, height=0, M=False, name=NN):
214
+ def forward(self, latlonh, lon=None, height=0, M=False, **name):
215
215
  '''Convert from geodetic C{(lat, lon, height)} to geocentric C{(x, y, z)}.
216
216
 
217
217
  @arg latlonh: Either a C{LatLon}, an L{Ecef9Tuple} or C{scalar}
@@ -221,7 +221,7 @@ class _EcefBase(_NamedBase):
221
221
  @kwarg height: Optional height (C{meter}), vertically above (or below)
222
222
  the surface of the ellipsoid.
223
223
  @kwarg M: Optionally, return the rotation L{EcefMatrix} (C{bool}).
224
- @kwarg name: Optional name (C{str}).
224
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
225
225
 
226
226
  @return: An L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C, M, datum)} with
227
227
  geocentric C{(x, y, z)} coordinates for the given geodetic ones
@@ -235,10 +235,10 @@ class _EcefBase(_NamedBase):
235
235
  @note: Use method C{.forward_} to specify C{lat} and C{lon} in C{radians}
236
236
  and avoid double angle conversions.
237
237
  '''
238
- llhn = _llhn4(latlonh, lon, height, name=name)
238
+ llhn = _llhn4(latlonh, lon, height, **name)
239
239
  return self._forward(*llhn, M=M)
240
240
 
241
- def forward_(self, phi, lam, height=0, M=False, name=NN):
241
+ def forward_(self, phi, lam, height=0, M=False, **name):
242
242
  '''Like method C{.forward} except with geodetic lat- and longitude given
243
243
  in I{radians}.
244
244
 
@@ -247,7 +247,7 @@ class _EcefBase(_NamedBase):
247
247
  @kwarg height: Optional height (C{meter}), vertically above (or below)
248
248
  the surface of the ellipsoid.
249
249
  @kwarg M: Optionally, return the rotation L{EcefMatrix} (C{bool}).
250
- @kwarg name: Optional name (C{str}).
250
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
251
251
 
252
252
  @return: An L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C, M, datum)}
253
253
  with C{lat} set to C{degrees90(B{phi})} and C{lon} to
@@ -255,8 +255,8 @@ class _EcefBase(_NamedBase):
255
255
 
256
256
  @raise EcefError: If B{C{phi}} or B{C{lam}} invalid or not C{scalar}.
257
257
  '''
258
- try: # like function C{_llhn4} above
259
- plhn = Phi(phi), Lam(lam), Height(height), name
258
+ try: # like function C{_llhn4} below
259
+ plhn = Phi(phi), Lam(lam), Height(height), _name__(name)
260
260
  except (TypeError, ValueError) as x:
261
261
  raise EcefError(phi=phi, lam=lam, height=height, cause=x)
262
262
  return self._forward(*plhn, M=M, _philam=True)
@@ -1272,25 +1272,24 @@ def _4Ecef(this, Ecef): # in .datums.Datum.ecef, .ellipsoids.Ellipsoid.ecef
1272
1272
  return Ecef(this, name=this.name)
1273
1273
 
1274
1274
 
1275
- def _llhn4(latlonh, lon, height, suffix=NN, Error=EcefError, name=NN): # in .ltp
1275
+ def _llhn4(latlonh, lon, height, suffix=NN, Error=EcefError, **name): # in .ltp
1276
1276
  '''(INTERNAL) Get a C{(lat, lon, h, name)} 4-tuple.
1277
1277
  '''
1278
1278
  try:
1279
1279
  lat, lon = latlonh.lat, latlonh.lon
1280
1280
  h = _xattr(latlonh, height=_xattr(latlonh, h=height))
1281
- n = _xattr(latlonh, name=NN)
1281
+ n = _name__(name, _or_nameof=latlonh) # == latlonh._name__(name)
1282
1282
  except AttributeError:
1283
- lat, h, n = latlonh, height, NN
1283
+ lat, h, n = latlonh, height, _name__(**name)
1284
1284
 
1285
1285
  try:
1286
- llhn = Lat(lat), Lon(lon), Height(h), (name or n)
1286
+ return Lat(lat), Lon(lon), Height(h), n
1287
1287
  except (TypeError, ValueError) as x:
1288
1288
  t = _lat_, _lon_, _height_
1289
1289
  if suffix:
1290
1290
  t = (_ + suffix for _ in t)
1291
1291
  d = dict(zip(t, (lat, lon, h)))
1292
1292
  raise Error(cause=x, **d)
1293
- return llhn
1294
1293
 
1295
1294
 
1296
1295
  def _xEcef(Ecef): # PYCHOK .latlonBase
@@ -1302,22 +1301,22 @@ def _xEcef(Ecef): # PYCHOK .latlonBase
1302
1301
 
1303
1302
 
1304
1303
  # kwd lon00 unused but will throw a TypeError if misspelled, etc.
1305
- def _xyzn4(xyz, y, z, Types, Error=EcefError, name=NN, # PYCHOK unused
1306
- _xyz_y_z_names=_xyz_y_z, lon00=0): # in .ltp
1304
+ def _xyzn4(xyz, y, z, Types, Error=EcefError, lon00=0, # PYCHOK unused
1305
+ _xyz_y_z_names=_xyz_y_z, **name): # in .ltp
1307
1306
  '''(INTERNAL) Get an C{(x, y, z, name)} 4-tuple.
1308
1307
  '''
1309
1308
  try:
1309
+ n = _name__(name, _or_nameof=xyz) # == xyz._name__(name)
1310
1310
  try:
1311
- t = xyz.x, xyz.y, xyz.z, _xattr(xyz, name=name)
1311
+ t = xyz.x, xyz.y, xyz.z, n
1312
1312
  if not isinstance(xyz, Types):
1313
1313
  raise _TypesError(_xyz_y_z_names[0], xyz, *Types)
1314
1314
  except AttributeError:
1315
- t = map1(float, xyz, y, z) + (name,)
1316
-
1315
+ t = map1(float, xyz, y, z) + (n,)
1316
+ return t
1317
1317
  except (TypeError, ValueError) as x:
1318
1318
  d = dict(zip(_xyz_y_z_names, (xyz, y, z)))
1319
1319
  raise Error(cause=x, **d)
1320
- return t
1321
1320
  # assert _xyz_y_z == _MODS.basics._args_kwds_names(_xyzn4)[:3]
1322
1321
 
1323
1322
 
@@ -24,8 +24,9 @@ from pygeodesy.errors import _incompatible, _IsnotError, RangeError, _TypeError,
24
24
  # from pygeodesy.fmath import favg # _MODS
25
25
  from pygeodesy.interns import NN, _COMMA_, _ellipsoidal_
26
26
  from pygeodesy.latlonBase import LatLonBase, _trilaterate5, fabs, _Wrap
27
- from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
27
+ # from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS # from .named
28
28
  # from pygeodesy.lcc import toLcc # _MODS
29
+ from pygeodesy.named import _name1__, _ALL_DOCS, _ALL_LAZY, _MODS
29
30
  # from pygeodesy.namedTuples import Vector3Tuple # _MODS
30
31
  from pygeodesy.props import deprecated_method, deprecated_property_RO, \
31
32
  Property_RO, property_doc_, property_RO, _update_all
@@ -36,7 +37,7 @@ from pygeodesy.units import Epoch, _isDegrees, Radius_, _1mm as _TOL_M
36
37
  # from math import fabs # from .latlonBase
37
38
 
38
39
  __all__ = _ALL_LAZY.ellipsoidalBase
39
- __version__ = '24.04.07'
40
+ __version__ = '24.05.21'
40
41
 
41
42
 
42
43
  class CartesianEllipsoidalBase(CartesianBase):
@@ -46,8 +47,8 @@ class CartesianEllipsoidalBase(CartesianBase):
46
47
  _epoch = None # overriding .reframe.epoch (C{float})
47
48
  _reframe = None # reference frame (L{RefFrame})
48
49
 
49
- def __init__(self, x_xyz, y=None, z=None, datum=None, reframe=None,
50
- epoch=None, ll=None, name=NN):
50
+ def __init__(self, x_xyz, y=None, z=None, reframe=None, epoch=None,
51
+ **datum_ll_name):
51
52
  '''New ellispoidal C{Cartesian...}.
52
53
 
53
54
  @kwarg reframe: Optional reference frame (L{RefFrame}).
@@ -61,9 +62,9 @@ class CartesianEllipsoidalBase(CartesianBase):
61
62
  not a L{Datum}, B{C{reframe}} is not a L{RefFrame} or
62
63
  B{C{epoch}} is not C{scalar} non-zero.
63
64
 
64
- @see: Super-class L{CartesianBase<CartesianBase.__init__>} for more details.
65
+ @see: Class L{CartesianBase<CartesianBase.__init__>} for more details.
65
66
  '''
66
- CartesianBase.__init__(self, x_xyz, y=y, z=z, datum=datum, ll=ll, name=name)
67
+ CartesianBase.__init__(self, x_xyz, y=y, z=z, **datum_ll_name)
67
68
  if reframe:
68
69
  self.reframe = reframe
69
70
  self.epoch = epoch
@@ -171,7 +172,7 @@ class CartesianEllipsoidalBase(CartesianBase):
171
172
  kwds = _xkwds(kwds, reframe=self.reframe, epoch=self.epoch)
172
173
  return CartesianBase.toLatLon(self, datum=datum, height=height, **kwds)
173
174
 
174
- def toRefFrame(self, reframe2, reframe=None, epoch=None, epoch2=None, name=NN):
175
+ def toRefFrame(self, reframe2, reframe=None, epoch=None, epoch2=None, **name):
175
176
  '''Convert this point to an other reference frame and epoch.
176
177
 
177
178
  @arg reframe2: Reference frame to convert I{to} (L{RefFrame}).
@@ -181,7 +182,7 @@ class CartesianEllipsoidalBase(CartesianBase):
181
182
  this point's C{epoch or B{reframe}.epoch}.
182
183
  @kwarg epoch2: Optional epoch to observe for the converted point (L{Epoch},
183
184
  C{scalar} or C{str}), otherwise B{C{epoch}}.
184
- @kwarg name: Optional name (C{str}), C{B{reframe2}.name} iff converted.
185
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding C{B{reframe2}.name}.
185
186
 
186
187
  @return: The converted point (ellipsoidal C{Cartesian}) or if conversion
187
188
  C{isunity}, this point or a copy of this point if the B{C{name}}
@@ -194,7 +195,7 @@ class CartesianEllipsoidalBase(CartesianBase):
194
195
  @raise TypeError: B{C{reframe2}} or B{C{reframe}} not a L{RefFrame}.
195
196
  '''
196
197
  return _MODS.trf._toRefFrame(self, reframe2, reframe=reframe, epoch=epoch,
197
- epoch2=epoch2, name=name)
198
+ epoch2=epoch2, **name)
198
199
 
199
200
  @deprecated_method
200
201
  def toTransforms_(self, *transforms, **datum): # PYCHOK no cover
@@ -217,8 +218,8 @@ class LatLonEllipsoidalBase(LatLonBase):
217
218
  _scale = None # UTM/UPS scale factor (C{float})
218
219
  _toLLEB_args = () # Etm/Utm/Ups._toLLEB arguments
219
220
 
220
- def __init__(self, latlonh, lon=None, height=0, datum=None, reframe=None,
221
- epoch=None, wrap=False, name=NN):
221
+ def __init__(self, latlonh, lon=None, height=0, datum=_WGS84, reframe=None,
222
+ epoch=None, wrap=False, **name):
222
223
  '''Create an ellipsoidal C{LatLon} point from the given lat-, longitude
223
224
  and height on the given datum, reference frame and epoch.
224
225
 
@@ -236,7 +237,7 @@ class LatLonEllipsoidalBase(LatLonBase):
236
237
  if C{B{reframe}=None}.
237
238
  @kwarg wrap: If C{True}, wrap or I{normalize} B{C{lat}} and B{C{lon}}
238
239
  (C{bool}).
239
- @kwarg name: Optional name (C{str}).
240
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
240
241
 
241
242
  @raise RangeError: Value of C{lat} or B{C{lon}} outside the valid
242
243
  range and L{rangerrors} set to C{True}.
@@ -247,9 +248,9 @@ class LatLonEllipsoidalBase(LatLonBase):
247
248
 
248
249
  @raise UnitError: Invalid B{C{lat}}, B{C{lon}} or B{C{height}}.
249
250
  '''
250
- LatLonBase.__init__(self, latlonh, lon=lon, height=height, wrap=wrap, name=name)
251
+ LatLonBase.__init__(self, latlonh, lon=lon, height=height, wrap=wrap, **name)
251
252
  if datum not in (None, self._datum, _EWGS84):
252
- self.datum = _ellipsoidal_datum(datum, name=name)
253
+ self.datum = _ellipsoidal_datum(datum, name=self.name)
253
254
  if reframe:
254
255
  self.reframe = reframe
255
256
  self.epoch = epoch
@@ -736,7 +737,7 @@ class LatLonEllipsoidalBase(LatLonBase):
736
737
  return _MODS.osgr.toOsgr(self, kTM=True, name=self.name) # datum=self.datum
737
738
 
738
739
  def parse(self, strllh, height=0, datum=None, epoch=None, reframe=None,
739
- sep=_COMMA_, wrap=False, name=NN):
740
+ sep=_COMMA_, wrap=False, **name):
740
741
  '''Parse a string consisting of C{"lat, lon[, height]"},
741
742
  representing a similar, ellipsoidal C{LatLon} point.
742
743
 
@@ -753,7 +754,7 @@ class LatLonEllipsoidalBase(LatLonBase):
753
754
  @kwarg sep: Optional separator (C{str}).
754
755
  @kwarg wrap: If C{True}, wrap or I{normalize} the lat-
755
756
  and longitude (C{bool}).
756
- @kwarg name: Optional instance name (C{str}), overriding
757
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding
757
758
  this name.
758
759
 
759
760
  @return: The similar point (ellipsoidal C{LatLon}).
@@ -768,7 +769,7 @@ class LatLonEllipsoidalBase(LatLonBase):
768
769
  r.epoch = epoch
769
770
  if reframe not in (None, self.reframe):
770
771
  r.reframe = reframe
771
- return self._xnamed(r, name=name, force=True) if name else r
772
+ return self._xnamed(r, force=True, **name) if name else r
772
773
 
773
774
  def _Radjust2(self, adjust, datum, meter_text2):
774
775
  '''(INTERNAL) Adjust an C{elevation} or C{geoidHeight} with
@@ -834,15 +835,15 @@ class LatLonEllipsoidalBase(LatLonBase):
834
835
  @see: Function L{pygeodesy.toCss}.
835
836
  '''
836
837
  return self._css if not toCss_kwds else _MODS.css.toCss(
837
- self, **_xkwds(toCss_kwds, name=self.name))
838
+ self, **_name1__(toCss_kwds, _or_nameof=self))
838
839
 
839
- def toDatum(self, datum2, height=None, name=NN):
840
+ def toDatum(self, datum2, height=None, **name):
840
841
  '''Convert this point to an other datum.
841
842
 
842
843
  @arg datum2: Datum to convert I{to} (L{Datum}).
843
844
  @kwarg height: Optional height, overriding the
844
845
  converted height (C{meter}).
845
- @kwarg name: Optional name (C{str}), iff converted.
846
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
846
847
 
847
848
  @return: The converted point (ellipsoidal C{LatLon})
848
849
  or a copy of this point if B{C{datum2}}
@@ -850,10 +851,10 @@ class LatLonEllipsoidalBase(LatLonBase):
850
851
 
851
852
  @raise TypeError: Invalid B{C{datum2}}.
852
853
  '''
853
- n = name or self.name
854
+ n = self._name__(name)
854
855
  d2 = _ellipsoidal_datum(datum2, name=n)
855
856
  if self.datum == d2:
856
- r = self.copy(name=name)
857
+ r = self.copy(name=n)
857
858
  else:
858
859
  kwds = _xkwds_not(None, LatLon=self.classof, name=n,
859
860
  epoch=self.epoch, reframe=self.reframe)
@@ -871,7 +872,7 @@ class LatLonEllipsoidalBase(LatLonBase):
871
872
  @see: Function L{pygeodesy.toEtm8}.
872
873
  '''
873
874
  return self._etm if not toEtm8_kwds else _MODS.etm.toEtm8(
874
- self, **_xkwds(toEtm8_kwds, name=self.name))
875
+ self, **_name1__(toEtm8_kwds, _or_nameof=self))
875
876
 
876
877
  def toLcc(self, **toLcc_kwds):
877
878
  '''Convert this C{LatLon} point to a Lambert location.
@@ -883,7 +884,7 @@ class LatLonEllipsoidalBase(LatLonBase):
883
884
  @see: Function L{pygeodesy.toLcc}.
884
885
  '''
885
886
  return self._lcc if not toLcc_kwds else _MODS.lcc.toLcc(
886
- self, **_xkwds(toLcc_kwds, name=self.name))
887
+ self, **_name1__(toLcc_kwds, _or_nameof=self))
887
888
 
888
889
  def toMgrs(self, center=False, pole=NN):
889
890
  '''Convert this C{LatLon} point to an MGRS coordinate.
@@ -918,7 +919,7 @@ class LatLonEllipsoidalBase(LatLonBase):
918
919
  r = self._osgrTM if kTM else self._osgr
919
920
  return r
920
921
 
921
- def toRefFrame(self, reframe2, reframe=None, epoch=None, epoch2=None, height=None, name=NN):
922
+ def toRefFrame(self, reframe2, reframe=None, epoch=None, epoch2=None, height=None, **name):
922
923
  '''Convert this point to an other reference frame and epoch.
923
924
 
924
925
  @arg reframe2: Reference frame to convert I{to} (L{RefFrame}).
@@ -929,7 +930,7 @@ class LatLonEllipsoidalBase(LatLonBase):
929
930
  @kwarg epoch2: Optional epoch to observe for the converted point (L{Epoch},
930
931
  C{scalar} or C{str}), otherwise B{C{epoch}}.
931
932
  @kwarg height: Optional height, overriding the converted height (C{meter}).
932
- @kwarg name: Optional name (C{str}), C{B{reframe2}.name} iff converted.
933
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding C{B{reframe2}.name}.
933
934
 
934
935
  @return: The converted point (ellipsoidal C{LatLon}) or if conversion
935
936
  C{isunity}, this point or a copy of this point if the B{C{name}}
@@ -942,7 +943,7 @@ class LatLonEllipsoidalBase(LatLonBase):
942
943
  @raise TypeError: B{C{reframe2}} or B{C{reframe}} not a L{RefFrame}.
943
944
  '''
944
945
  return _MODS.trf._toRefFrame(self, reframe2, reframe=reframe, epoch=epoch,
945
- epoch2=epoch2, name=name, height=height)
946
+ epoch2=epoch2, height=height, **name)
946
947
 
947
948
  def toTransform(self, transform, inverse=False, datum=None, **LatLon_kwds):
948
949
  '''Apply a Helmert transform to this geodetic point.
@@ -17,7 +17,6 @@ from pygeodesy.errors import _AssertionError, IntersectionError, _IsnotError, \
17
17
  from pygeodesy.fmath import favg, fmean_
18
18
  from pygeodesy.fsums import Fmt, fsumf_
19
19
  from pygeodesy.formy import _isequalTo, opposing, _radical2
20
- # from pygeodesy.internals import _dunder_nameof # from .lazily
21
20
  from pygeodesy.interns import _antipodal_, _concentric_, _ellipsoidal_, \
22
21
  _exceed_PI_radians_, _low_, _near_, \
23
22
  _SPACE_, _too_
@@ -36,7 +35,7 @@ from pygeodesy.utily import m2km, unroll180, _unrollon, _unrollon3, \
36
35
  from math import degrees, radians
37
36
 
38
37
  __all__ = _ALL_LAZY.ellipsoidalBaseDI
39
- __version__ = '24.05.13'
38
+ __version__ = '24.05.19'
40
39
 
41
40
  _polar__ = 'polar?'
42
41
  _B2END = _1_5 # _intersect3 bearing to pseudo-end point factor
@@ -400,12 +399,12 @@ class LatLonEllipsoidalBaseDI(LatLonEllipsoidalBase):
400
399
 
401
400
  f, j = _fi_j2(f, len(Ps)) # like .vector3d.nearestOn6
402
401
 
403
- n = self.nearestOn8.__name__
402
+ n = self.nearestOn8.__name__ # _dunder_nameof
404
403
  c.rename(n)
405
404
  if s is not c:
406
405
  s = s.copy(name=n)
407
406
  if e is not c:
408
- e = e.copy(name=n)
407
+ e = e.copy(name=n) # name__=self.nearestOn8
409
408
  return NearestOn8Tuple(c, c3.distance, f, j, s, e, c3.initial, c3.final,
410
409
  iteration=m) # ._iteration for tests
411
410