pygeodesy 24.5.24__py2.py3-none-any.whl → 24.6.9__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.9.dist-info}/METADATA +6 -5
  2. PyGeodesy-24.6.9.dist-info/RECORD +116 -0
  3. pygeodesy/__init__.py +4 -4
  4. pygeodesy/auxilats/__init__.py +1 -1
  5. pygeodesy/auxilats/__main__.py +2 -2
  6. pygeodesy/auxilats/auxAngle.py +4 -4
  7. pygeodesy/basics.py +39 -5
  8. pygeodesy/booleans.py +54 -67
  9. pygeodesy/cartesianBase.py +138 -147
  10. pygeodesy/constants.py +3 -3
  11. pygeodesy/deprecated/functions.py +9 -3
  12. pygeodesy/ecef.py +67 -72
  13. pygeodesy/ellipsoidalBase.py +18 -56
  14. pygeodesy/ellipsoidalGeodSolve.py +2 -2
  15. pygeodesy/ellipsoidalKarney.py +3 -3
  16. pygeodesy/ellipsoidalNvector.py +7 -7
  17. pygeodesy/ellipsoids.py +6 -5
  18. pygeodesy/errors.py +20 -10
  19. pygeodesy/etm.py +16 -21
  20. pygeodesy/fmath.py +9 -20
  21. pygeodesy/formy.py +60 -74
  22. pygeodesy/frechet.py +13 -14
  23. pygeodesy/fsums.py +60 -26
  24. pygeodesy/geodesicx/__init__.py +1 -1
  25. pygeodesy/geodesicx/__main__.py +2 -2
  26. pygeodesy/geodesicx/gx.py +3 -5
  27. pygeodesy/geodsolve.py +24 -26
  28. pygeodesy/geohash.py +27 -40
  29. pygeodesy/geoids.py +1 -1
  30. pygeodesy/hausdorff.py +17 -18
  31. pygeodesy/heights.py +17 -30
  32. pygeodesy/internals.py +15 -14
  33. pygeodesy/interns.py +3 -9
  34. pygeodesy/iters.py +2 -2
  35. pygeodesy/karney.py +8 -7
  36. pygeodesy/latlonBase.py +189 -176
  37. pygeodesy/lazily.py +92 -56
  38. pygeodesy/lcc.py +2 -2
  39. pygeodesy/ltp.py +93 -55
  40. pygeodesy/ltpTuples.py +304 -240
  41. pygeodesy/mgrs.py +51 -24
  42. pygeodesy/named.py +159 -136
  43. pygeodesy/namedTuples.py +43 -14
  44. pygeodesy/nvectorBase.py +20 -23
  45. pygeodesy/osgr.py +40 -48
  46. pygeodesy/points.py +11 -11
  47. pygeodesy/props.py +29 -16
  48. pygeodesy/rhumb/aux_.py +13 -15
  49. pygeodesy/rhumb/bases.py +12 -5
  50. pygeodesy/rhumb/ekx.py +24 -18
  51. pygeodesy/rhumb/solve.py +20 -70
  52. pygeodesy/simplify.py +16 -16
  53. pygeodesy/solveBase.py +35 -32
  54. pygeodesy/sphericalBase.py +33 -31
  55. pygeodesy/sphericalTrigonometry.py +17 -17
  56. pygeodesy/streprs.py +6 -4
  57. pygeodesy/trf.py +11 -9
  58. pygeodesy/triaxials.py +71 -50
  59. pygeodesy/units.py +40 -65
  60. pygeodesy/unitsBase.py +2 -2
  61. pygeodesy/ups.py +66 -70
  62. pygeodesy/utily.py +7 -6
  63. pygeodesy/utm.py +152 -156
  64. pygeodesy/utmups.py +38 -38
  65. pygeodesy/utmupsBase.py +102 -106
  66. pygeodesy/vector3d.py +34 -36
  67. pygeodesy/vector3dBase.py +12 -9
  68. pygeodesy/webmercator.py +43 -51
  69. PyGeodesy-24.5.24.dist-info/RECORD +0 -116
  70. {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.9.dist-info}/WHEEL +0 -0
  71. {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.9.dist-info}/top_level.txt +0 -0
@@ -21,18 +21,18 @@ from pygeodesy.datums import Datums, _earth_ellipsoid, _spherical_datum
21
21
  from pygeodesy.errors import IntersectionError, _ValueError, \
22
22
  _xattr, _xError
23
23
  from pygeodesy.fmath import favg, fdot, hypot, sqrt_a
24
- from pygeodesy.interns import NN, _COMMA_, _concentric_, _datum_, \
25
- _distant_, _exceed_PI_radians_, _name_, \
26
- _near_, _radius_, _too_
24
+ from pygeodesy.interns import _COMMA_, _concentric_, _datum_, _distant_, \
25
+ _exceed_PI_radians_, _name_, _near_, \
26
+ _radius_, _too_
27
27
  from pygeodesy.latlonBase import LatLonBase, _trilaterate5 # PYCHOK passed
28
28
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
29
29
  # from pygeodesy.namedTuples import Bearing2Tuple # from .cartesianBase
30
30
  from pygeodesy.nvectorBase import NvectorBase, Fmt, _xattrs
31
- from pygeodesy.props import deprecated_method, property_doc_, \
32
- property_RO, _update_all
31
+ from pygeodesy.props import deprecated_method, property_doc_, property_RO, \
32
+ _update_all
33
33
  # from pygeodesy.streprs import Fmt, _xattrs # from .nvectorBase
34
- from pygeodesy.units import _isRadius, Bearing, Bearing_, Radians_, \
35
- Radius, Radius_, Scalar_, _100km
34
+ from pygeodesy.units import Bearing, Bearing_, _isRadius, Radians_, Radius, \
35
+ Radius_, Scalar_, _100km
36
36
  from pygeodesy.utily import acos1, asin1, atan2b, atan2d, degrees90, \
37
37
  degrees180, sincos2, sincos2d, _unrollon, \
38
38
  tanPI_2_2, wrapPI
@@ -40,7 +40,7 @@ from pygeodesy.utily import acos1, asin1, atan2b, atan2d, degrees90, \
40
40
  from math import cos, fabs, log, sin, sqrt
41
41
 
42
42
  __all__ = _ALL_LAZY.sphericalBase
43
- __version__ = '23.12.18'
43
+ __version__ = '24.06.06'
44
44
 
45
45
 
46
46
  class CartesianSphericalBase(CartesianBase):
@@ -117,7 +117,7 @@ class LatLonSphericalBase(LatLonBase):
117
117
  _datum = Datums.Sphere # spherical L{Datum}
118
118
  _napieradius = _100km
119
119
 
120
- def __init__(self, latlonh, lon=None, height=0, datum=None, wrap=False, name=NN):
120
+ def __init__(self, latlonh, lon=None, height=0, datum=None, wrap=False, **name):
121
121
  '''Create a spherical C{LatLon} point frome the given lat-, longitude and
122
122
  height on the given datum.
123
123
 
@@ -132,12 +132,12 @@ class LatLonSphericalBase(LatLonBase):
132
132
  conventionally).
133
133
  @kwarg wrap: If C{True}, wrap or I{normalize} B{C{lat}} and B{C{lon}}
134
134
  (C{bool}).
135
- @kwarg name: Optional name (C{str}).
135
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
136
136
 
137
137
  @raise TypeError: If B{C{latlonh}} is not a C{LatLon} or B{C{datum}} not
138
138
  spherical.
139
139
  '''
140
- LatLonBase.__init__(self, latlonh, lon=lon, height=height, wrap=wrap, name=name)
140
+ LatLonBase.__init__(self, latlonh, lon=lon, height=height, wrap=wrap, **name)
141
141
  if datum not in (None, self.datum):
142
142
  self.datum = datum
143
143
 
@@ -302,26 +302,22 @@ class LatLonSphericalBase(LatLonBase):
302
302
  # raise _xError(x, this=self, point=point, other=other, **radius_exact_height_wrap)
303
303
  # return p.midpointTo(q)
304
304
 
305
- def parse(self, strllh, height=0, sep=_COMMA_, name=NN):
305
+ def parse(self, strllh, height=0, sep=_COMMA_, **name):
306
306
  '''Parse a string representing a similar, spherical C{LatLon}
307
307
  point, consisting of C{"lat, lon[, height]"}.
308
308
 
309
- @arg strllh: Lat, lon and optional height (C{str}),
310
- see function L{pygeodesy.parse3llh}.
309
+ @arg strllh: Lat, lon and optional height (C{str}), see function
310
+ L{pygeodesy.parse3llh}.
311
311
  @kwarg height: Optional, default height (C{meter}).
312
312
  @kwarg sep: Optional separator (C{str}).
313
- @kwarg name: Optional instance name (C{str}),
314
- overriding this name.
313
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding this name.
315
314
 
316
315
  @return: The similar point (spherical C{LatLon}).
317
316
 
318
317
  @raise ParseError: Invalid B{C{strllh}}.
319
318
  '''
320
- t = _MODS.dms.parse3llh(strllh, height=height, sep=sep)
321
- r = self.classof(*t)
322
- if name:
323
- r.rename(name)
324
- return r
319
+ llh = _MODS.dms.parse3llh(strllh, height=height, sep=sep)
320
+ return self.classof(*llh, **name)
325
321
 
326
322
  @property_RO
327
323
  def _radius(self):
@@ -384,7 +380,8 @@ class LatLonSphericalBase(LatLonBase):
384
380
  '''DEPRECATED, use method C{.rhumbAzimuthTo}.'''
385
381
  return self.rhumbAzimuthTo(other, b360=True) # [0..360)
386
382
 
387
- def rhumbDestination(self, distance, azimuth, radius=R_M, height=None, exact=False):
383
+ def rhumbDestination(self, distance, azimuth, radius=R_M, height=None,
384
+ exact=False, **name):
388
385
  '''Return the destination point having travelled the given distance from
389
386
  this point along a rhumb line (loxodrome) of the given azimuth.
390
387
 
@@ -397,6 +394,7 @@ class LatLonSphericalBase(LatLonBase):
397
394
  @kwarg height: Optional height, overriding the default height (C{meter}.
398
395
  @kwarg exact: If C{True}, use I{Elliptic, Krüger} L{Rhumb} (C{bool}),
399
396
  default C{False} for backward compatibility.
397
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
400
398
 
401
399
  @return: The destination point (spherical C{LatLon}).
402
400
 
@@ -405,7 +403,7 @@ class LatLonSphericalBase(LatLonBase):
405
403
  '''
406
404
  if exact: # use series, always
407
405
  r = LatLonBase.rhumbDestination(self, distance, azimuth, exact=False, # Krüger
408
- radius=radius, height=height)
406
+ radius=radius, height=height, **name)
409
407
  else: # radius=None from .rhumbMidpointTo
410
408
  if radius in (None, self._radius):
411
409
  d, r = self.datum, radius
@@ -429,7 +427,7 @@ class LatLonSphericalBase(LatLonBase):
429
427
  b2 = b1 if isnear0(q) else (b1 + r * sb / q)
430
428
 
431
429
  h = self._heigHt(height)
432
- r = self.classof(degrees90(a2), degrees180(b2), datum=d, height=h)
430
+ r = self.classof(degrees90(a2), degrees180(b2), datum=d, height=h, **name)
433
431
  return r
434
432
 
435
433
  def rhumbDistanceTo(self, other, radius=R_M, exact=False, wrap=False):
@@ -503,7 +501,7 @@ class LatLonSphericalBase(LatLonBase):
503
501
  height=height, wrap=wrap)
504
502
 
505
503
  def rhumbMidpointTo(self, other, height=None, radius=R_M, exact=False,
506
- fraction=_0_5, wrap=False):
504
+ fraction=_0_5, **wrap_name):
507
505
  '''Return the (loxodromic) midpoint on the rhumb line between
508
506
  this and an other point.
509
507
 
@@ -515,8 +513,9 @@ class LatLonSphericalBase(LatLonBase):
515
513
  default C{False} for backward compatibility.
516
514
  @kwarg fraction: Midpoint location from this point (C{scalar}), may
517
515
  be negative if C{B{exact}=True}.
518
- @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the B{C{other}}
519
- point (C{bool}).
516
+ @kwarg wrap_name: Optional C{B{name}=NN} (C{str}) and optional keyword
517
+ argument C{B{wrap}=False}, if C{True}, wrap or I{normalize}
518
+ and unroll the B{C{other}} point (C{bool}).
520
519
 
521
520
  @return: The (mid)point at the given B{C{fraction}} along the rhumb
522
521
  line (spherical C{LatLon}).
@@ -528,18 +527,21 @@ class LatLonSphericalBase(LatLonBase):
528
527
  if exact: # use series, always
529
528
  r = LatLonBase.rhumbMidpointTo(self, other, exact=False, # Krüger
530
529
  radius=radius, height=height,
531
- fraction=fraction, wrap=wrap)
530
+ fraction=fraction, **wrap_name)
532
531
  elif fraction is not _0_5:
533
532
  f = Scalar_(fraction=fraction) # low=_0_0
534
- r, db, dp = self._rhumbs3(other, wrap, r=True) # radians
533
+ w, n = self._wrap_name2(**wrap_name)
534
+ r, db, dp = self._rhumbs3(other, w, r=True) # radians
535
535
  z = atan2b(db, dp)
536
536
  h = self._havg(other, f=f, h=height)
537
- r = self.rhumbDestination(r * f, z, radius=None, height=h)
537
+ r = self.rhumbDestination(r * f, z, radius=None, height=h, name=n)
538
538
 
539
539
  else: # for backward compatibility, unwrapped
540
+ _, n = self._wrap_name2(**wrap_name)
540
541
  # see <https://MathForum.org/library/drmath/view/51822.html>
541
542
  a1, b1 = self.philam
542
543
  a2, b2 = self.others(other).philam
544
+ _, n = self._wrap_name2(**wrap_name)
543
545
 
544
546
  if fabs(b2 - b1) > PI:
545
547
  b1 += PI2 # crossing anti-meridian
@@ -561,7 +563,7 @@ class LatLonSphericalBase(LatLonBase):
561
563
  d = self.datum if radius in (None, self._radius) else \
562
564
  _spherical_datum(radius, name=self.name, raiser=_radius_)
563
565
  h = self._havg(other, h=height)
564
- r = self.classof(degrees90(a3), degrees180(b3), datum=d, height=h)
566
+ r = self.classof(degrees90(a3), degrees180(b3), datum=d, height=h, name=n)
565
567
  return r
566
568
 
567
569
  @property_RO
@@ -54,7 +54,7 @@ from pygeodesy.vector3d import sumOf, Vector3d
54
54
  from math import asin, atan2, cos, degrees, fabs, radians, sin
55
55
 
56
56
  __all__ = _ALL_LAZY.sphericalTrigonometry
57
- __version__ = '24.045.19'
57
+ __version__ = '24.05.25'
58
58
 
59
59
  _PI_EPS4 = PI - EPS4
60
60
  if _PI_EPS4 >= PI:
@@ -538,7 +538,7 @@ class LatLon(LatLonSphericalBase):
538
538
  def nearestOn(self, point1, point2, radius=R_M, **wrap_adjust_limit):
539
539
  '''Locate the point between two points closest to this point.
540
540
 
541
- Distances are approximated by function L{pygeodesy.equirectangular_},
541
+ Distances are approximated by function L{pygeodesy.equirectangular4},
542
542
  subject to the supplied B{C{options}}.
543
543
 
544
544
  @arg point1: Start point (L{LatLon}).
@@ -546,12 +546,12 @@ class LatLon(LatLonSphericalBase):
546
546
  @kwarg radius: Mean earth radius (C{meter}).
547
547
  @kwarg wrap_adjust_limit: Optional keyword arguments for functions
548
548
  L{sphericalTrigonometry.nearestOn3} and
549
- L{pygeodesy.equirectangular_},
549
+ L{pygeodesy.equirectangular4},
550
550
 
551
551
  @return: Closest point on the great circle line (L{LatLon}).
552
552
 
553
553
  @raise LimitError: Lat- and/or longitudinal delta exceeds B{C{limit}},
554
- see function L{pygeodesy.equirectangular_}.
554
+ see function L{pygeodesy.equirectangular4}.
555
555
 
556
556
  @raise NotImplementedError: Keyword argument C{B{within}=False}
557
557
  is not (yet) supported.
@@ -560,7 +560,7 @@ class LatLon(LatLonSphericalBase):
560
560
 
561
561
  @raise ValueError: Invalid B{C{radius}} or B{C{options}}.
562
562
 
563
- @see: Functions L{pygeodesy.equirectangular_} and L{pygeodesy.nearestOn5}
563
+ @see: Functions L{pygeodesy.equirectangular4} and L{pygeodesy.nearestOn5}
564
564
  and method L{sphericalTrigonometry.LatLon.nearestOn3}.
565
565
  '''
566
566
  # remove kwarg B{C{within}} if present
@@ -605,7 +605,7 @@ class LatLon(LatLonSphericalBase):
605
605
  def nearestOn3(self, points, closed=False, radius=R_M, **wrap_adjust_limit):
606
606
  '''Locate the point on a polygon closest to this point.
607
607
 
608
- Distances are approximated by function L{pygeodesy.equirectangular_},
608
+ Distances are approximated by function L{pygeodesy.equirectangular4},
609
609
  subject to the supplied B{C{options}}.
610
610
 
611
611
  @arg points: The polygon points (L{LatLon}[]).
@@ -613,17 +613,17 @@ class LatLon(LatLonSphericalBase):
613
613
  @kwarg radius: Mean earth radius (C{meter}).
614
614
  @kwarg wrap_adjust_limit: Optional keyword arguments for function
615
615
  L{sphericalTrigonometry.nearestOn3} and
616
- L{pygeodesy.equirectangular_},
616
+ L{pygeodesy.equirectangular4},
617
617
 
618
618
  @return: A L{NearestOn3Tuple}C{(closest, distance, angle)} of the
619
- C{closest} point (L{LatLon}), the L{pygeodesy.equirectangular_}
619
+ C{closest} point (L{LatLon}), the L{pygeodesy.equirectangular4}
620
620
  C{distance} between this and the C{closest} point converted to
621
621
  C{meter}, same units as B{C{radius}}. The C{angle} from this
622
622
  to the C{closest} point is in compass C{degrees360}, like
623
623
  function L{pygeodesy.compassAngle}.
624
624
 
625
625
  @raise LimitError: Lat- and/or longitudinal delta exceeds B{C{limit}},
626
- see function L{pygeodesy.equirectangular_}.
626
+ see function L{pygeodesy.equirectangular4}.
627
627
 
628
628
  @raise PointsError: Insufficient number of B{C{points}}.
629
629
 
@@ -631,7 +631,7 @@ class LatLon(LatLonSphericalBase):
631
631
 
632
632
  @raise ValueError: Invalid B{C{radius}} or B{C{options}}.
633
633
 
634
- @see: Functions L{pygeodesy.compassAngle}, L{pygeodesy.equirectangular_}
634
+ @see: Functions L{pygeodesy.compassAngle}, L{pygeodesy.equirectangular4}
635
635
  and L{pygeodesy.nearestOn5}.
636
636
  '''
637
637
  return nearestOn3(self, points, closed=closed, radius=radius,
@@ -1222,7 +1222,7 @@ def nearestOn3(point, points, closed=False, radius=R_M, wrap=False, adjust=True,
1222
1222
  limit=9, **LatLon_and_kwds):
1223
1223
  '''Locate the point on a path or polygon closest to a reference point.
1224
1224
 
1225
- Distances are I{approximated} using function L{pygeodesy.equirectangular_},
1225
+ Distances are I{approximated} using function L{pygeodesy.equirectangular4},
1226
1226
  subject to the supplied B{C{options}}.
1227
1227
 
1228
1228
  @arg point: The reference point (L{LatLon}).
@@ -1231,19 +1231,19 @@ def nearestOn3(point, points, closed=False, radius=R_M, wrap=False, adjust=True,
1231
1231
  @kwarg radius: Mean earth radius (C{meter}).
1232
1232
  @kwarg wrap: If C{True}, wrap or I{normalize} and unroll the
1233
1233
  B{C{points}} (C{bool}).
1234
- @kwarg adjust: See function L{pygeodesy.equirectangular_} (C{bool}).
1235
- @kwarg limit: See function L{pygeodesy.equirectangular_} (C{degrees}),
1234
+ @kwarg adjust: See function L{pygeodesy.equirectangular4} (C{bool}).
1235
+ @kwarg limit: See function L{pygeodesy.equirectangular4} (C{degrees}),
1236
1236
  default C{9 degrees} is about C{1,000 Kmeter} (for mean
1237
1237
  spherical earth radius L{R_KM}).
1238
1238
  @kwarg LatLon: Optional class to return the closest point (L{LatLon})
1239
1239
  or C{None}.
1240
1240
  @kwarg options: Optional keyword arguments for function
1241
- L{pygeodesy.equirectangular_}.
1241
+ L{pygeodesy.equirectangular4}.
1242
1242
 
1243
1243
  @return: A L{NearestOn3Tuple}C{(closest, distance, angle)} with the
1244
1244
  C{closest} point as B{C{LatLon}} or L{LatLon3Tuple}C{(lat,
1245
1245
  lon, height)} if B{C{LatLon}} is C{None}. The C{distance}
1246
- is the L{pygeodesy.equirectangular_} distance between the
1246
+ is the L{pygeodesy.equirectangular4} distance between the
1247
1247
  C{closest} and the given B{C{point}} converted to C{meter},
1248
1248
  same units as B{C{radius}}. The C{angle} from the given
1249
1249
  B{C{point}} to the C{closest} is in compass C{degrees360},
@@ -1251,7 +1251,7 @@ def nearestOn3(point, points, closed=False, radius=R_M, wrap=False, adjust=True,
1251
1251
  the (interpolated) height at the C{closest} point.
1252
1252
 
1253
1253
  @raise LimitError: Lat- and/or longitudinal delta exceeds the B{C{limit}},
1254
- see function L{pygeodesy.equirectangular_}.
1254
+ see function L{pygeodesy.equirectangular4}.
1255
1255
 
1256
1256
  @raise PointsError: Insufficient number of B{C{points}}.
1257
1257
 
@@ -1259,7 +1259,7 @@ def nearestOn3(point, points, closed=False, radius=R_M, wrap=False, adjust=True,
1259
1259
 
1260
1260
  @raise ValueError: Invalid B{C{radius}}.
1261
1261
 
1262
- @see: Functions L{pygeodesy.equirectangular_} and L{pygeodesy.nearestOn5}.
1262
+ @see: Functions L{pygeodesy.equirectangular4} and L{pygeodesy.nearestOn5}.
1263
1263
  '''
1264
1264
  t = _nearestOn5(point, points, closed=closed, wrap=wrap,
1265
1265
  adjust=adjust, limit=limit)
pygeodesy/streprs.py CHANGED
@@ -8,7 +8,7 @@ from pygeodesy.basics import isint, islistuple, isscalar, isstr, itemsorted, \
8
8
  _zip, _0_0
9
9
  # from pygeodesy.constants import _0_0
10
10
  from pygeodesy.errors import _or, _AttributeError, _IsnotError, _TypeError, \
11
- _ValueError, _xkwds_get, _xkwds_item2, _xkwds_pop2
11
+ _ValueError, _xkwds_get, _xkwds_item2
12
12
  # from pygeodesy.internals import _dunder_nameof # from .lazily
13
13
  from pygeodesy.interns import NN, _0_, _0to9_, MISSING, _BAR_, _COMMASPACE_, \
14
14
  _DOT_, _E_, _ELLIPSIS_, _EQUAL_, _H_, _LR_PAIRS, \
@@ -22,7 +22,7 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _dunder_nameof
22
22
  from math import fabs, log10 as _log10
23
23
 
24
24
  __all__ = _ALL_LAZY.streprs
25
- __version__ = '24.05.19'
25
+ __version__ = '24.06.04'
26
26
 
27
27
  _at_ = 'at' # PYCHOK used!
28
28
  _EN_PREC = 6 # max MGRS/OSGR precision, 1 micrometer
@@ -546,8 +546,10 @@ def unstr(where, *args, **kwds):
546
546
 
547
547
  @return: Representation (C{str}).
548
548
  '''
549
- e, kwds = _xkwds_pop2(kwds, _ELLIPSIS=False)
550
- g, kwds = _xkwds_pop2(kwds, _fmt=Fmt.g)
549
+ def _e_g_kwds3(_ELLIPSIS=False, _fmt=Fmt.g, **kwds):
550
+ return _ELLIPSIS, _fmt, kwds
551
+
552
+ e, g, kwds = _e_g_kwds3(**kwds)
551
553
  t = reprs(args, fmt=g) if args else ()
552
554
  if e:
553
555
  t += _ELLIPSIS_,
pygeodesy/trf.py CHANGED
@@ -80,8 +80,8 @@ from pygeodesy.interns import MISSING, NN, _AT_, _COMMASPACE_, _conversion_, \
80
80
  _NAD83_, _no_, _PLUS_, _reframe_, _s_, _SPACE_, \
81
81
  _STAR_, _to_, _vs_, _WGS84_, _x_, _intern as _i
82
82
  # from pygeodesy.lazily import _ALL_LAZY # from .units
83
- from pygeodesy.named import ADict, classname, _lazyNamedEnumItem as _lazy, _Named, \
84
- _NamedEnum, _NamedEnumItem, _NamedTuple, Fmt, unstr
83
+ from pygeodesy.named import ADict, classname, _lazyNamedEnumItem as _lazy, _name2__, \
84
+ _Named, _NamedEnum, _NamedEnumItem, _NamedTuple, Fmt, unstr
85
85
  from pygeodesy.props import deprecated_method, property_doc_, Property_RO, property_RO
86
86
  # from pygeodesy.streprs import Fmt, unstr # from .named
87
87
  from pygeodesy.units import Epoch, Float, _ALL_LAZY
@@ -91,7 +91,7 @@ from math import ceil as _ceil, fabs
91
91
  # import operator as _operator # from .datums
92
92
 
93
93
  __all__ = _ALL_LAZY.trf
94
- __version__ = '24.05.21'
94
+ __version__ = '24.06.09'
95
95
 
96
96
  _EP0CH = Epoch(0, low=0)
97
97
  _Es = {_EP0CH: _EP0CH} # L{Epoch}s, deleted below
@@ -253,7 +253,7 @@ class RefFrame(_NamedEnumItem):
253
253
  '''
254
254
  D = self.datum
255
255
  e = self.epoch if epoch is None else _Epoch(epoch)
256
- t = (Fmt.EQUAL(name=repr(name or self.name)),
256
+ t = (Fmt.EQUAL(name=repr(self._name__(name))),
257
257
  Fmt.EQUAL(epoch=e),
258
258
  Fmt.EQUAL(datum=_DOT_(classname(D) + _s_, D.name)))
259
259
  return _COMMASPACE_.join(t[int(name is None):])
@@ -405,10 +405,11 @@ class TransformXform(Transform):
405
405
  n = name or (X.toStr() if X else NN)
406
406
  return Transform.rename(self, n)
407
407
 
408
- def toRefFrame(self, point, name=NN): # PYCHOK signature
408
+ def toRefFrame(self, point, **name): # PYCHOK signature
409
409
  '''Convert an ellipsoidal point using this transform and Xform.
410
410
 
411
411
  @arg point: The point to convert (C{Cartesian} or C{LatLon}).
412
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
412
413
 
413
414
  @return: A copy of the B{C{point}}, converted I{directly} to
414
415
  this transform's Xform's C{refName2} and C{epoch}.
@@ -423,7 +424,7 @@ class TransformXform(Transform):
423
424
  if X: # see _toRefFrame below
424
425
  p._reframe = X.reframe2
425
426
  p._epoch = X.epoch
426
- p.rename(name or self.name)
427
+ p.rename(self._name__(name))
427
428
  return p
428
429
 
429
430
  def toTransform(self, epoch1, **epoch2_inverse):
@@ -902,7 +903,7 @@ def date2epoch(year, month, day):
902
903
  e = y + float(sum(_mDays[:m]) + d) / _366_0
903
904
  return Epoch(e, low=0)
904
905
 
905
- raise ValueError # _invalid_
906
+ raise ValueError() # _invalid_
906
907
  except (TRFError, TypeError, ValueError) as x:
907
908
  raise TRFError(year=year, month=month, day=day, cause=x)
908
909
 
@@ -1043,7 +1044,7 @@ def _sumstr(name1, name2, p_):
1043
1044
 
1044
1045
 
1045
1046
  def _toRefFrame(point, reframe2, reframe=None, epoch=None,
1046
- epoch2=None, name=NN, **LatLon_kwds):
1047
+ epoch2=None, **name_LatLon_kwds):
1047
1048
  '''(INTERNAL) Convert an ellipsoidal point to C{reframe2}
1048
1049
  and C{epoch2 or epoch or pont.epoch or reframe.epoch}.
1049
1050
  '''
@@ -1063,6 +1064,7 @@ def _toRefFrame(point, reframe2, reframe=None, epoch=None,
1063
1064
  _to_, _AT_(reframe2.name, e2))
1064
1065
  raise TRFError(_no_(_conversion_), txt=t)
1065
1066
 
1067
+ name, LatLon_kwds = _name2__(name_LatLon_kwds)
1066
1068
  if t0: # is not ()
1067
1069
  if t0.isunity:
1068
1070
  p = point.dup()
@@ -1078,7 +1080,7 @@ def _toRefFrame(point, reframe2, reframe=None, epoch=None,
1078
1080
  p = point.toTransform(t0)
1079
1081
  p._reframe = reframe2 # see TRFXform.toRefFrame above
1080
1082
  p._epoch = _xattr(t0.Xform, epoch=e2)
1081
- p.rename(name or reframe2.name)
1083
+ p.rename(reframe2._name__(name))
1082
1084
  else:
1083
1085
  p = point.dup(_reframe=reframe2, # ditto
1084
1086
  _epoch=e2, name=name) if name else point
pygeodesy/triaxials.py CHANGED
@@ -35,7 +35,6 @@ from pygeodesy.constants import EPS, EPS0, EPS02, EPS4, INT0, PI2, PI_3, PI4, \
35
35
  _EPS2e4, float0_, isfinite, isnear1, _0_0, _0_5, \
36
36
  _1_0, _N_1_0, _N_2_0, _4_0 # PYCHOK used!
37
37
  from pygeodesy.datums import Datum, _spherical_datum, _WGS84, Ellipsoid, _EWGS84, Fmt
38
- # from pygeodesy.dms import toDMS # _MODS
39
38
  # from pygeodesy.ellipsoids import Ellipsoid, _EWGS84 # from .datums
40
39
  # from pygeodesy.elliptic import Elliptic # _MODS
41
40
  # from pygeodesy.errors import _ValueError # from .basics
@@ -47,38 +46,49 @@ from pygeodesy.interns import NN, _a_, _b_, _beta_, _c_, _distant_, _finite_, \
47
46
  _spherical_, _too_, _x_, _y_
48
47
  # from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .vector3d
49
48
  from pygeodesy.named import _lazyNamedEnumItem as _lazy, _name__, _NamedEnum, \
50
- _NamedEnumItem, _NamedTuple, _Pass
51
- from pygeodesy.namedTuples import LatLon3Tuple, Vector3Tuple, Vector4Tuple
49
+ _NamedEnumItem, _Pass
50
+ from pygeodesy.namedTuples import LatLon3Tuple, _NamedTupleTo, Vector3Tuple, \
51
+ Vector4Tuple
52
52
  from pygeodesy.props import Property_RO, property_RO
53
53
  # from pygeodesy.streprs import Fmt # from .datums
54
- from pygeodesy.units import Float, Height_, Meter, Meter2, Meter3, Radians, \
55
- Radius, Scalar_, _toDegrees, _toRadians
54
+ from pygeodesy.units import Degrees, Float, Height_, Meter, Meter2, Meter3, \
55
+ Radians, Radius, Scalar_
56
56
  from pygeodesy.utily import asin1, atan2d, km2m, m2km, SinCos2, sincos2d_
57
57
  from pygeodesy.vector3d import _otherV3d, Vector3d, _ALL_LAZY, _MODS
58
58
 
59
59
  from math import atan2, fabs, sqrt
60
60
 
61
61
  __all__ = _ALL_LAZY.triaxials
62
- __version__ = '24.05.21'
62
+ __version__ = '24.06.09'
63
63
 
64
64
  _not_ordered_ = _not_('ordered')
65
65
  _omega_ = 'omega'
66
66
  _TRIPS = 269 # 48-55, Eberly 1074?
67
67
 
68
68
 
69
- class _NamedTupleTo(_NamedTuple): # in .testNamedTuples, like .cartesianBase.RadiusThetaPhi3Tuple
70
- '''(INTERNAL) Base for C{-.toDegrees}, C{-.toRadians}.
69
+ class _NamedTupleToX(_NamedTupleTo): # in .testNamedTuples
70
+ '''(INTERNAL) Base class for L{BetaOmega2Tuple},
71
+ L{BetaOmega3Tuple} and L{Jacobi2Tuple}.
71
72
  '''
72
- def _toDegrees(self, a, b, *c, **toDMS_kwds):
73
- a, b, _ = _toDegrees(self, a, b, **toDMS_kwds)
74
- return _ or self.classof(a, b, *c, name=self.name)
73
+ def _toDegrees(self, name, **toDMS_kwds):
74
+ '''(INTERNAL) Convert C{self[0:2]} to L{Degrees} or C{toDMS}.
75
+ '''
76
+ return self._toX3U(_NamedTupleTo._Degrees3, Degrees, name, *self, **toDMS_kwds)
77
+
78
+ def _toRadians(self, name):
79
+ '''(INTERNAL) Convert C{self[0:2]} to L{Radians}.
80
+ '''
81
+ return self._toX3U(_NamedTupleTo._Radians3, Radians, name, *self)
75
82
 
76
- def _toRadians(self, a, b, *c):
77
- a, b, _ = _toRadians(self, a, b)
78
- return _ or self.classof(a, b, *c, name=self.name)
83
+ def _toX3U(self, _X3, U, name, a, b, *c, **kwds):
84
+ a, b, s = _X3(self, a, b, **kwds)
85
+ if s is None or name:
86
+ n = self._name__(name)
87
+ s = self.classof(a, b, *c, name=n).reUnit(U, U).toUnits()
88
+ return s
79
89
 
80
90
 
81
- class BetaOmega2Tuple(_NamedTupleTo):
91
+ class BetaOmega2Tuple(_NamedTupleToX):
82
92
  '''2-Tuple C{(beta, omega)} with I{ellipsoidal} lat- and
83
93
  longitude C{beta} and C{omega} both in L{Radians} (or
84
94
  L{Degrees}).
@@ -86,27 +96,30 @@ class BetaOmega2Tuple(_NamedTupleTo):
86
96
  _Names_ = (_beta_, _omega_)
87
97
  _Units_ = (_Pass, _Pass)
88
98
 
89
- def toDegrees(self, **toDMS_kwds):
99
+ def toDegrees(self, name=NN, **toDMS_kwds):
90
100
  '''Convert this L{BetaOmega2Tuple} to L{Degrees} or C{toDMS}.
91
101
 
92
- @return: L{BetaOmega2Tuple}C{(beta, omega)} with
93
- C{beta} and C{omega} both in L{Degrees}
94
- or as a L{toDMS} string provided some
95
- B{C{toDMS_kwds}} keyword arguments are
102
+ @kwarg name: Optional name (C{str}), overriding this name.
103
+
104
+ @return: L{BetaOmega2Tuple}C{(beta, omega)} with C{beta} and
105
+ C{omega} both in L{Degrees} or as L{toDMS} strings
106
+ provided some B{C{toDMS_kwds}} keyword arguments are
96
107
  specified.
97
108
  '''
98
- return _NamedTupleTo._toDegrees(self, *self, **toDMS_kwds)
109
+ return self._toDegrees(name, **toDMS_kwds)
99
110
 
100
- def toRadians(self):
111
+ def toRadians(self, **name):
101
112
  '''Convert this L{BetaOmega2Tuple} to L{Radians}.
102
113
 
103
- @return: L{BetaOmega2Tuple}C{(beta, omega)} with
104
- C{beta} and C{omega} both in L{Radians}.
114
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding this name.
115
+
116
+ @return: L{BetaOmega2Tuple}C{(beta, omega)} with C{beta} and C{omega}
117
+ both in L{Radians}.
105
118
  '''
106
- return _NamedTupleTo._toRadians(self, *self)
119
+ return self._toRadians(name)
107
120
 
108
121
 
109
- class BetaOmega3Tuple(_NamedTupleTo):
122
+ class BetaOmega3Tuple(_NamedTupleToX):
110
123
  '''3-Tuple C{(beta, omega, height)} with I{ellipsoidal} lat- and
111
124
  longitude C{beta} and C{omega} both in L{Radians} (or L{Degrees})
112
125
  and the C{height}, rather the (signed) I{distance} to the triaxial's
@@ -116,54 +129,62 @@ class BetaOmega3Tuple(_NamedTupleTo):
116
129
  _Names_ = BetaOmega2Tuple._Names_ + (_height_,)
117
130
  _Units_ = BetaOmega2Tuple._Units_ + ( Meter,)
118
131
 
119
- def toDegrees(self, **toDMS_kwds):
132
+ def toDegrees(self, name=NN, **toDMS_kwds):
120
133
  '''Convert this L{BetaOmega3Tuple} to L{Degrees} or C{toDMS}.
121
134
 
135
+ @kwarg name: Optional name (C{str}), overriding this name.
136
+
122
137
  @return: L{BetaOmega3Tuple}C{(beta, omega, height)} with
123
- C{beta} and C{omega} both in L{Degrees} or as a
124
- L{toDMS} string provided some B{C{toDMS_kwds}}
138
+ C{beta} and C{omega} both in L{Degrees} or as
139
+ L{toDMS} strings provided some B{C{toDMS_kwds}}
125
140
  keyword arguments are specified.
126
141
  '''
127
- return _NamedTupleTo._toDegrees(self, *self, **toDMS_kwds)
142
+ return self._toDegrees(name, **toDMS_kwds)
128
143
 
129
- def toRadians(self):
144
+ def toRadians(self, **name):
130
145
  '''Convert this L{BetaOmega3Tuple} to L{Radians}.
131
146
 
132
- @return: L{BetaOmega3Tuple}C{(beta, omega, height)} with
133
- C{beta} and C{omega} both in L{Radians}.
147
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding this name.
148
+
149
+ @return: L{BetaOmega3Tuple}C{(beta, omega, height)} with C{beta}
150
+ and C{omega} both in L{Radians}.
134
151
  '''
135
- return _NamedTupleTo._toRadians(self, *self)
152
+ return self._toRadians(name)
136
153
 
137
- def to2Tuple(self):
154
+ def to2Tuple(self, **name):
138
155
  '''Reduce this L{BetaOmega3Tuple} to a L{BetaOmega2Tuple}.
156
+
157
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding this name.
139
158
  '''
140
- return BetaOmega2Tuple(*self[:2])
159
+ return BetaOmega2Tuple(*self[:2], name=self._name__(name))
141
160
 
142
161
 
143
- class Jacobi2Tuple(_NamedTupleTo):
162
+ class Jacobi2Tuple(_NamedTupleToX):
144
163
  '''2-Tuple C{(x, y)} with a Jacobi Conformal C{x} and C{y}
145
164
  projection, both in L{Radians} (or L{Degrees}).
146
165
  '''
147
166
  _Names_ = (_x_, _y_)
148
167
  _Units_ = (_Pass, _Pass)
149
168
 
150
- def toDegrees(self, **toDMS_kwds):
169
+ def toDegrees(self, name=NN, **toDMS_kwds):
151
170
  '''Convert this L{Jacobi2Tuple} to L{Degrees} or C{toDMS}.
152
171
 
153
- @return: L{Jacobi2Tuple}C{(x, y)} with C{x} and C{y}
154
- both in L{Degrees} or as a L{toDMS} string
155
- provided some B{C{toDMS_kwds}} keyword
156
- arguments are specified.
172
+ @kwarg name: Optional name (C{str}), overriding this name.
173
+
174
+ @return: L{Jacobi2Tuple}C{(x, y)} with C{x} and C{y} both
175
+ in L{Degrees} or as L{toDMS} strings provided some
176
+ B{C{toDMS_kwds}} keyword arguments are specified.
157
177
  '''
158
- return _NamedTupleTo._toDegrees(self, *self, **toDMS_kwds)
178
+ return self._toDegrees(name, **toDMS_kwds)
159
179
 
160
- def toRadians(self):
180
+ def toRadians(self, **name):
161
181
  '''Convert this L{Jacobi2Tuple} to L{Radians}.
162
182
 
163
- @return: L{Jacobi2Tuple}C{(x, y)} with C{x}
164
- and C{y} both in L{Radians}.
183
+ @kwarg name: Optional C{B{name}=NN} (C{str}), overriding this name.
184
+
185
+ @return: L{Jacobi2Tuple}C{(x, y)} with C{x} and C{y} both in L{Radians}.
165
186
  '''
166
- return _NamedTupleTo._toRadians(self, *self)
187
+ return self._toRadians(name)
167
188
 
168
189
 
169
190
  class Triaxial_(_NamedEnumItem):
@@ -894,8 +915,8 @@ class Triaxial(Triaxial_):
894
915
  s = v.times_(self._1e2ac, # == 1 - e_sub_x**2
895
916
  self._1e2bc, # == 1 - e_sub_y**2
896
917
  _1_0)
897
- t = self._reverseLatLon3(s, atan2d, v, self.forwardLatLon_)
898
- return LatLon3Tuple(*t, **name)
918
+ a, b, h = self._reverseLatLon3(s, atan2d, v, self.forwardLatLon_)
919
+ return LatLon3Tuple(Degrees(lat=a), Degrees(lon=b), h, **name)
899
920
 
900
921
  def _reverseLatLon3(self, s, atan2_, v, forward_):
901
922
  '''(INTERNAL) Helper for C{.reverseBetOmg} and C{.reverseLatLon}.
@@ -1158,7 +1179,7 @@ def _getitems(items, *indices):
1158
1179
  return type(items)(map(items.__getitem__, indices))
1159
1180
 
1160
1181
 
1161
- def _hartzell3(pov, los, Tun): # in .ellipsoids.hartzell4, .formy.hartzell
1182
+ def _hartzell3(pov, los, Tun): # in .Ellipsoid.hartzell4, .formy.hartzell
1162
1183
  '''(INTERNAL) Hartzell's "Satellite Line-of-Sight Intersection ...",
1163
1184
  formula from a Point-Of-View to an I{un-/ordered} Triaxial.
1164
1185
  '''