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
@@ -31,8 +31,7 @@ from pygeodesy.ellipsoidalBase import CartesianEllipsoidalBase, \
31
31
  _TOL_M, _Wrap
32
32
  from pygeodesy.errors import _IsnotError, _xkwds, _xkwds_pop2
33
33
  # from pygeodesy.fmath import fdot # from .nvectorBase
34
- from pygeodesy.interns import NN, _Nv00_, _COMMASPACE_
35
- from pygeodesy.interns import _down_, _east_, _north_, _pole_ # PYCHOK used!
34
+ from pygeodesy.interns import _Nv00_, _COMMASPACE_, _pole_ # PYCHOK used!
36
35
  from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _ALL_OTHER
37
36
  # from pygeodesy.ltp import Ltp # _MODS
38
37
  from pygeodesy.ltpTuples import Aer as _Aer, Ned as _Ned, Ned4Tuple, \
@@ -49,15 +48,15 @@ from pygeodesy.units import Bearing, Distance, Height, Scalar
49
48
  # from math import fabs # from .nvectorBase
50
49
 
51
50
  __all__ = _ALL_LAZY.ellipsoidalNvector
52
- __version__ = '24.02.18'
51
+ __version__ = '24.05.19'
53
52
 
54
53
 
55
54
  class Ned(_Ned):
56
55
  '''DEPRECATED on 2024.02.04, use class L{pygeodesy.Ned}.'''
57
56
 
58
- def __init__(self, north, east, down, name=NN):
57
+ def __init__(self, north, east, down, **name):
59
58
  deprecated_class(self.__class__)
60
- _Ned.__init__(self, north, east, down, name=name)
59
+ _Ned.__init__(self, north, east, down, **name)
61
60
 
62
61
  @deprecated_method # PYCHOK expected
63
62
  def toRepr(self, prec=None, fmt=Fmt.SQUARE, sep=_COMMASPACE_, **unused):
@@ -434,7 +433,7 @@ class Nvector(NvectorBase):
434
433
  '''
435
434
  _datum = _WGS84 # default datum (L{Datum})
436
435
 
437
- def __init__(self, x_xyz, y=None, z=None, h=0, datum=None, ll=None, name=NN):
436
+ def __init__(self, x_xyz, y=None, z=None, h=0, datum=None, ll=None, **name):
438
437
  '''New n-vector normal to the earth's surface.
439
438
 
440
439
  @arg x_xyz: X component of vector (C{scalar}) or (3-D) vector
@@ -449,13 +448,13 @@ class Nvector(NvectorBase):
449
448
  (L{Datum}, L{Ellipsoid}, L{Ellipsoid2} or
450
449
  L{a_f2Tuple}).
451
450
  @kwarg ll: Optional, original latlon (C{LatLon}).
452
- @kwarg name: Optional name (C{str}).
451
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
453
452
 
454
453
  @raise TypeError: If B{C{datum}} is not a L{Datum}.
455
454
  '''
456
- NvectorBase.__init__(self, x_xyz, y=y, z=z, h=h, ll=ll, name=name)
455
+ NvectorBase.__init__(self, x_xyz, y=y, z=z, h=h, ll=ll, **name)
457
456
  if datum not in (None, self._datum):
458
- self._datum = _ellipsoidal_datum(datum, name=name)
457
+ self._datum = _ellipsoidal_datum(datum, **name)
459
458
 
460
459
  @Property_RO
461
460
  def datum(self):
@@ -550,7 +549,7 @@ def meanOf(points, datum=_WGS84, height=None, wrap=False,
550
549
  # geographic mean
551
550
  m = sumOf(p._N_vector for p in Ps.iterate(closed=False))
552
551
  kwds = _xkwds(LatLon_and_kwds, height=height, datum=datum,
553
- LatLon=LatLon, name=meanOf.__name__)
552
+ LatLon=LatLon, name__=meanOf)
554
553
  return m.toLatLon(**kwds)
555
554
 
556
555
 
@@ -618,7 +617,7 @@ def sumOf(nvectors, Vector=Nvector, h=None, **Vector_kwds):
618
617
 
619
618
 
620
619
  @deprecated_function
621
- def toNed(distance, bearing, elevation, Ned=Ned, name=NN):
620
+ def toNed(distance, bearing, elevation, Ned=Ned, **name):
622
621
  '''DEPRECATED, use L{pygeodesy.Aer}C{(bearing, elevation,
623
622
  distance).xyzLocal.toNed(B{Ned}, name=B{name})} or
624
623
  L{XyzLocal}C{(pygeodesy.Aer(bearing, elevation,
@@ -633,7 +632,7 @@ def toNed(distance, bearing, elevation, Ned=Ned, name=NN):
633
632
  frame horizontal (C{degrees}).
634
633
  @kwarg Ned: Optional class to return the NED (C{Ned}) or
635
634
  C{None}.
636
- @kwarg name: Optional name (C{str}).
635
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
637
636
 
638
637
  @return: An NED vector equivalent to this B{C{distance}},
639
638
  B{C{bearing}} and B{C{elevation}} (DEPRECATED L{Ned})
pygeodesy/ellipsoids.py CHANGED
@@ -76,12 +76,11 @@ from pygeodesy.fmath import cbrt, cbrt2, fdot, Fhorner, fpowers, hypot, hypot_,
76
76
  from pygeodesy.interns import NN, _a_, _Airy1830_, _AiryModified_, _b_, _Bessel1841_, _beta_, \
77
77
  _Clarke1866_, _Clarke1880IGN_, _DOT_, _f_, _GRS80_, _height_, \
78
78
  _Intl1924_, _incompatible_, _invalid_, _Krassovski1940_, \
79
- _Krassowsky1940_, _meridional_, _lat_, _negative_, _not_, \
80
- _not_finite_, _prime_vertical_, _radius_, _Sphere_, _SPACE_, \
81
- _vs_, _WGS72_, _WGS84_
79
+ _Krassowsky1940_, _lat_, _meridional_, _negative_, _not_finite_, \
80
+ _prime_vertical_, _radius_, _Sphere_, _SPACE_, _vs_, _WGS72_, _WGS84_
82
81
  # from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .named
83
- from pygeodesy.named import _lazyNamedEnumItem as _lazy, _NamedEnum, _NamedEnumItem, \
84
- _NamedTuple, _Pass, _ALL_LAZY, _MODS
82
+ from pygeodesy.named import _lazyNamedEnumItem as _lazy, _name__, _name2__, _NamedEnum, \
83
+ _NamedEnumItem, _NamedTuple, _Pass, _ALL_LAZY, _MODS
85
84
  from pygeodesy.namedTuples import Distance2Tuple, Vector3Tuple, Vector4Tuple
86
85
  from pygeodesy.props import deprecated_Property_RO, Property_RO, property_doc_, \
87
86
  deprecated_property_RO, property_RO
@@ -93,7 +92,7 @@ from pygeodesy.utily import atan1, atan1d, atan2b, degrees90, m2radians, radians
93
92
  from math import asinh, atan, atanh, cos, degrees, exp, fabs, radians, sin, sinh, sqrt, tan
94
93
 
95
94
  __all__ = _ALL_LAZY.ellipsoids
96
- __version__ = '24.04.14'
95
+ __version__ = '24.05.21'
97
96
 
98
97
  _f_0_0 = Float(f =_0_0) # zero flattening
99
98
  _f__0_0 = Float(f_=_0_0) # zero inverse flattening
@@ -136,7 +135,7 @@ class a_f2Tuple(_NamedTuple):
136
135
 
137
136
  @arg a: Equatorial radius (C{scalar} > 0).
138
137
  @arg f: Flattening (C{scalar} < 1, negative for I{prolate}).
139
- @kwarg name: Optional name (C{str}).
138
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
140
139
 
141
140
  @return: An L{a_f2Tuple}C{(a, f)} instance.
142
141
 
@@ -157,13 +156,15 @@ class a_f2Tuple(_NamedTuple):
157
156
  '''
158
157
  return a_f2b(self.a, self.f) # PYCHOK .a and .f
159
158
 
160
- def ellipsoid(self, name=NN):
159
+ def ellipsoid(self, **name):
161
160
  '''Return an L{Ellipsoid} for this 2-tuple C{(a, f)}.
162
161
 
162
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
163
+
163
164
  @raise NameError: A registered C{ellipsoid} with the
164
165
  same B{C{name}} already exists.
165
166
  '''
166
- return Ellipsoid(self.a, f=self.f, name=name or self.name) # PYCHOK .a and .f
167
+ return Ellipsoid(self.a, f=self.f, name=self._name__(name)) # PYCHOK .a and .f
167
168
 
168
169
  @Property_RO
169
170
  def f_(self):
@@ -215,7 +216,7 @@ class Ellipsoid(_NamedEnumItem):
215
216
  _KsOrder = 8 # Krüger series order (4, 6 or 8)
216
217
  _rhumbsolve = NN # means, use PYGEODESY_RHUMBSOLVE
217
218
 
218
- def __init__(self, a, b=None, f_=None, f=None, name=NN):
219
+ def __init__(self, a, b=None, f_=None, f=None, **name):
219
220
  '''New L{Ellipsoid} from the I{equatorial} radius I{and} either
220
221
  the I{polar} radius or I{inverse flattening} or I{flattening}.
221
222
 
@@ -224,7 +225,7 @@ class Ellipsoid(_NamedEnumItem):
224
225
  @arg f_: Inverse flattening: M{a / (a - b)} (C{float} >>> 1.0).
225
226
  @arg f: Flattening: M{(a - b) / a} (C{scalar}, near zero for
226
227
  spherical).
227
- @kwarg name: Optional, unique name (C{str}).
228
+ @kwarg name: Optional, unique C{B{name}=NN} (C{str}).
228
229
 
229
230
  @raise NameError: Ellipsoid with the same B{C{name}} already exists.
230
231
 
@@ -234,7 +235,8 @@ class Ellipsoid(_NamedEnumItem):
234
235
  @note: M{abs(f_) > 1 / EPS} or M{abs(1 / f_) < EPS} is forced
235
236
  to M{1 / f_ = 0}, spherical.
236
237
  '''
237
- ff_ = f, f_ # assertion below
238
+ ff_ = f, f_ # assertion below
239
+ n = _name__(**name) if name else NN
238
240
  try:
239
241
  a = Radius_(a=a) # low=EPS
240
242
  if not _isfinite(a):
@@ -268,7 +270,7 @@ class Ellipsoid(_NamedEnumItem):
268
270
 
269
271
  except (TypeError, ValueError) as x:
270
272
  d = _xkwds_not(None, b=b, f_=f_, f=f)
271
- t = instr(self, a=a, name=name, **d)
273
+ t = instr(self, a=a, name=n, **d)
272
274
  raise _ValueError(t, cause=x)
273
275
 
274
276
  self._a = a
@@ -276,7 +278,7 @@ class Ellipsoid(_NamedEnumItem):
276
278
  self._f = f
277
279
  self._f_ = f_
278
280
 
279
- self._register(Ellipsoids, name)
281
+ self._register(Ellipsoids, n)
280
282
 
281
283
  if f and f_: # see .test/testEllipsoidal.py
282
284
  d = dict(eps=_TOL)
@@ -1023,7 +1025,7 @@ class Ellipsoid(_NamedEnumItem):
1023
1025
  g = exact
1024
1026
  E = _xattr(g, ellipsoid=None)
1025
1027
  if not (E is self and isinstance(g, self._Geodesics)):
1026
- raise _ValueError(exact=g, ellipsoid=E, txt=_not_(self.name))
1028
+ raise _ValueError(exact=g, ellipsoid=E, txt_not_=self.name)
1027
1029
  return g
1028
1030
 
1029
1031
  @property_RO
@@ -1102,7 +1104,7 @@ class Ellipsoid(_NamedEnumItem):
1102
1104
  v, d = _MODS.triaxials._hartzell2(pov, los, self._triaxial)
1103
1105
  except Exception as x:
1104
1106
  raise IntersectionError(pov=pov, los=los, cause=x)
1105
- return Vector4Tuple(v.x, v.y, v.z, d, name=self.hartzell4.__name__)
1107
+ return Vector4Tuple(v.x, v.y, v.z, d, name__=self.hartzell4)
1106
1108
 
1107
1109
  @Property_RO
1108
1110
  def _hash(self):
@@ -1163,8 +1165,7 @@ class Ellipsoid(_NamedEnumItem):
1163
1165
  v = v.times(t)
1164
1166
  h = r * (_1_0 - t)
1165
1167
 
1166
- return Vector4Tuple(v.x, v.y, v.z, h, iteration=i,
1167
- name=self.height4.__name__)
1168
+ return Vector4Tuple(v.x, v.y, v.z, h, iteration=i, name__=self.height4)
1168
1169
 
1169
1170
  def _hubeny_2(self, phi2, phi1, lam21, scaled=True, squared=True):
1170
1171
  '''(INTERNAL) like function C{pygeodesy.flatLocal_}/C{pygeodesy.hubeny_},
@@ -1493,7 +1494,7 @@ class Ellipsoid(_NamedEnumItem):
1493
1494
  r = exact
1494
1495
  E = _xattr(r, ellipsoid=None)
1495
1496
  if not (E is self and isinstance(r, self._Rhumbs)):
1496
- raise _ValueError(exact=r, ellipsosid=E, txt=_not_(self.name))
1497
+ raise _ValueError(exact=r, ellipsosid=E, txt_not_=self.name)
1497
1498
  return r
1498
1499
 
1499
1500
  @property_RO
@@ -1807,42 +1808,45 @@ class Ellipsoid(_NamedEnumItem):
1807
1808
  (sqrt((_3_0 * self.a2_b2 + _1_0) * _0_25) * b) if a < b else a)
1808
1809
  return Radius(Rtriaxial=q)
1809
1810
 
1810
- def toEllipsoid2(self, name=NN):
1811
+ def toEllipsoid2(self, **name):
1811
1812
  '''Get a copy of this ellipsoid as an L{Ellipsoid2}.
1812
1813
 
1813
- @kwarg name: Optional, unique name (C{str}).
1814
+ @kwarg name: Optional, unique C{B{name}=NN} (C{str}).
1814
1815
 
1815
1816
  @see: Property C{a_f}.
1816
1817
  '''
1817
- return Ellipsoid2(self, None, name=name)
1818
+ return Ellipsoid2(self, None, **name)
1818
1819
 
1819
- def toStr(self, prec=8, terse=0, name=NN, **unused): # PYCHOK expected
1820
+ def toStr(self, prec=8, terse=0, **name): # PYCHOK expected
1820
1821
  '''Return this ellipsoid as a text string.
1821
1822
 
1822
1823
  @kwarg prec: Number of decimal digits, unstripped (C{int}).
1823
1824
  @kwarg terse: Limit the number of items (C{int}, 0...18).
1824
- @kwarg name: Override name (C{str}) or C{None} to exclude
1825
- this ellipsoid's name.
1825
+ @kwarg name: Optional C{B{name}=NN} (C{str}) or C{None} to
1826
+ exclude this ellipsoid's name.
1826
1827
 
1827
1828
  @return: This C{Ellipsoid}'s attributes (C{str}).
1828
1829
  '''
1829
1830
  E = Ellipsoid
1830
- t = E.a, E.b, E.f_, E.f, E.f2, E.n, E.e, E.e2, E.e21, E.e22, E.e32, \
1831
+ t = E.a, E.b, E.f_, E.f, E.f2, E.n, E.e, E.e2, E.e21, E.e22, E.e32, \
1831
1832
  E.A, E.L, E.R1, E.R2, E.R3, E.Rbiaxial, E.Rtriaxial
1832
1833
  if terse:
1833
1834
  t = t[:terse]
1834
- return self._instr(name, prec, props=t)
1835
+ n, _ = _name2__(**name) # name=None
1836
+ return self._instr(n, prec, props=t)
1835
1837
 
1836
- def toTriaxial(self, name=NN):
1838
+ def toTriaxial(self, **name):
1837
1839
  '''Convert this ellipsoid to a L{Triaxial_}.
1838
1840
 
1841
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
1842
+
1839
1843
  @return: A L{Triaxial_} or L{Triaxial} with the C{X} axis
1840
1844
  pointing east and C{Z} pointing north.
1841
1845
 
1842
1846
  @see: Method L{Triaxial_.toEllipsoid}.
1843
1847
  '''
1844
1848
  T = self._triaxial
1845
- return T.copy(name=name) if name else T
1849
+ return T.copy(**name) if name else T
1846
1850
 
1847
1851
  @property_RO
1848
1852
  def _triaxial(self):
@@ -1864,12 +1868,14 @@ class Ellipsoid(_NamedEnumItem):
1864
1868
  class Ellipsoid2(Ellipsoid):
1865
1869
  '''An L{Ellipsoid} specified by I{equatorial} radius and I{flattening}.
1866
1870
  '''
1867
- def __init__(self, a, f, name=NN):
1871
+ def __init__(self, a, f=None, **name):
1868
1872
  '''New L{Ellipsoid2}.
1869
1873
 
1870
- @arg a: Equatorial radius, semi-axis (C{meter}).
1871
- @arg f: Flattening: (C{float} < 1.0, negative for I{prolate}).
1872
- @kwarg name: Optional, unique name (C{str}).
1874
+ @arg a: Equatorial radius, semi-axis (C{meter}) or a previous
1875
+ L{Ellipsoid} instance.
1876
+ @arg f: Flattening: (C{float} < 1.0, negative for I{prolate}),
1877
+ if B{C{a}} is in C{meter}.
1878
+ @kwarg name: Optional, unique C{B{name}=NN} (C{str}).
1873
1879
 
1874
1880
  @raise NameError: Ellipsoid with that B{C{name}} already exists.
1875
1881
 
@@ -1880,9 +1886,9 @@ class Ellipsoid2(Ellipsoid):
1880
1886
  '''
1881
1887
  if f is None and isinstance(a, Ellipsoid):
1882
1888
  Ellipsoid.__init__(self, a.a, f =a.f,
1883
- b=a.b, f_=a.f_, name=name)
1889
+ b=a.b, f_=a.f_, **name)
1884
1890
  else:
1885
- Ellipsoid.__init__(self, a, f=f, name=name)
1891
+ Ellipsoid.__init__(self, a, f=f, **name)
1886
1892
 
1887
1893
 
1888
1894
  def _spherical_a_b(a, b):
pygeodesy/elliptic.py CHANGED
@@ -98,7 +98,7 @@ from math import asinh, atan, atan2, ceil, cosh, fabs, floor, \
98
98
  radians, sin, sqrt, tanh
99
99
 
100
100
  __all__ = _ALL_LAZY.elliptic
101
- __version__ = '24.05.13'
101
+ __version__ = '24.05.18'
102
102
 
103
103
  _TolRD = zqrt(EPS * 0.002)
104
104
  _TolRF = zqrt(EPS * 0.030)
@@ -139,10 +139,10 @@ class Elliptic(_Named):
139
139
  # _k2 = 0
140
140
  # _kp2 = 0
141
141
 
142
- def __init__(self, k2=0, alpha2=0, kp2=None, alphap2=None, name=NN):
142
+ def __init__(self, k2=0, alpha2=0, kp2=None, alphap2=None, **name):
143
143
  '''Constructor, specifying the C{modulus} and C{parameter}.
144
144
 
145
- @kwarg name: Optional name (C{str}).
145
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
146
146
 
147
147
  @see: Method L{Elliptic.reset} for further details.
148
148
 
@@ -152,7 +152,6 @@ class Elliptic(_Named):
152
152
  E(φ, k)} and C{H(φ, 0, k) = F(φ, k) - D(φ, k)}.
153
153
  '''
154
154
  self.reset(k2=k2, alpha2=alpha2, kp2=kp2, alphap2=alphap2)
155
-
156
155
  if name:
157
156
  self.name = name
158
157
 
pygeodesy/epsg.py CHANGED
@@ -28,7 +28,7 @@ from pygeodesy.utmupsBase import _to3zBhp, _UPS_ZONE, _UTM_ZONE_MIN, \
28
28
  _UTM_ZONE_MAX, _UTMUPS_ZONE_INVALID
29
29
 
30
30
  __all__ = _ALL_LAZY.epsg
31
- __version__ = '22.09.24'
31
+ __version__ = '24.05.18'
32
32
 
33
33
  # _EPSG_INVALID = _UTMUPS_ZONE_INVALID
34
34
  _EPSG_N_01 = 32601 # EPSG code for UTM zone 01 N
@@ -49,11 +49,12 @@ class Epsg(Int):
49
49
  _utmups = None
50
50
  _zone = _UTMUPS_ZONE_INVALID
51
51
 
52
- def __new__(cls, eisu, name=NN):
52
+ def __new__(cls, eisu, **name):
53
53
  '''New L{Epsg} (I{European Petroleum Survey Group}) code from a
54
54
  UTM/USP coordinate or other EPSG code.
55
55
 
56
56
  @arg eisu: Other code (L{Epsg}, C{int}, C{str}, L{Utm} or L{Ups}).
57
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
57
58
 
58
59
  @return: New L{Epsg}.
59
60
 
@@ -88,7 +89,7 @@ class Epsg(Int):
88
89
  self.name = u.name
89
90
 
90
91
  if name:
91
- self.name = name
92
+ self.rename(name)
92
93
  return self
93
94
 
94
95
  def __repr__(self):
pygeodesy/errors.py CHANGED
@@ -14,20 +14,23 @@ C{PYGEODESY_EXCEPTION_CHAINING=std} or to any non-empty string.
14
14
  # from pygeodesy.basics import isint, isodd, issubclassof, itemsorted, _xinstanceof, _zip # _MODS
15
15
  # from pygeodesy.ellipsoidalBase import CartesianEllipsoidalBase, LatLonEllipsoidalBase # _MODS
16
16
  # from pygeodesy import errors # _MODS, _MODS.getattr
17
- # from pygeodesy.internals import _tailof # from .lazily
17
+ from pygeodesy.internals import _plural, _tailof
18
18
  from pygeodesy.interns import MISSING, NN, _a_, _an_, _and_, _clip_, _COLON_, _COLONSPACE_, \
19
19
  _COMMASPACE_, _datum_, _ellipsoidal_, _incompatible_, _invalid_, \
20
- _len_, _not_, _or_, _SPACE_, _specified_, _UNDER_, _vs_, _with_
21
- from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _getenv, _PYTHON_X_DEV, _tailof
20
+ _keyword_, _len_, _not_, _or_, _SPACE_, _specified_, _UNDER_, \
21
+ _vs_, _with_
22
+ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _getenv, _PYTHON_X_DEV
22
23
  # from pygeodesy.streprs import Fmt, unstr # _MODS
23
24
  # from pygeodesy.vector3dBase import Vector3dBase # _MODS
24
25
 
25
26
  from copy import copy as _copy
26
27
 
27
28
  __all__ = _ALL_LAZY.errors # _ALL_DOCS('_InvalidError', '_IsnotError') _under
28
- __version__ = '24.05.15'
29
+ __version__ = '24.05.19'
29
30
 
31
+ _argument_ = 'argument'
30
32
  _box_ = 'box'
33
+ _expected_ = 'expected'
31
34
  _limiterrors = True # in .formy
32
35
  _name_value_ = repr('name=value')
33
36
  _rangerrors = True # in .dms
@@ -142,6 +145,21 @@ def _TypesError(name, value, *Types, **kwds):
142
145
  return _TypeError(name, value, txt=t, **kwds)
143
146
 
144
147
 
148
+ class _UnexpectedError(TypeError): # note, a TypeError!
149
+ '''(INTERNAL) Format a C{TypeError} I{without exception chaining}.
150
+ '''
151
+ def __init__(self, *args, **kwds):
152
+ n = len(kwds)
153
+ if args:
154
+ a = _plural(_argument_, len(args))
155
+ n = _and(a, _plural(_keyword_, n)) if n else a
156
+ else:
157
+ n = _plural(_SPACE_(_keyword_, _argument_), n)
158
+ u = _MODS.streprs.unstr(_SPACE_(n, NN), *args, **kwds)
159
+ # _error_init(TypeError, self, (u,), txt_not_=_expected_)
160
+ TypeError.__init__(self, _SPACE_(u, _not_, _expected_))
161
+
162
+
145
163
  class _ValueError(ValueError):
146
164
  '''(INTERNAL) Format a C{ValueError} with/-out exception chaining.
147
165
  '''
@@ -375,8 +393,8 @@ def crosserrors(raiser=None):
375
393
  return t
376
394
 
377
395
 
378
- def _error_init(Error, inst, args, fmt_name_value='%s (%r)', txt=NN,
379
- cause=None, **kwds): # by .lazily
396
+ def _error_init(Error, inst, args, fmt_name_value='%s (%r)', txt_not_=NN,
397
+ txt__=None, txt=NN, cause=None, **kwds):
380
398
  '''(INTERNAL) Format an error text and initialize an C{Error} instance.
381
399
 
382
400
  @arg Error: The error super-class (C{Exception}).
@@ -388,6 +406,8 @@ def _error_init(Error, inst, args, fmt_name_value='%s (%r)', txt=NN,
388
406
  given as C{name=value} keyword arguments.
389
407
  @kwarg fmt_name_value: Format for (name, value) (C{str}).
390
408
  @kwarg txt: Optional explanation of the error (C{str}).
409
+ @kwarg txt__: Alternate C{B{txt}=B{txt__}.__name__}.
410
+ @kwarg txt_not_: Negative explanation C{B{txt}=_not_(B{txt_not_})}.
391
411
  @kwarg cause: Optional, caught error (L{Exception}), for
392
412
  exception chaining (supported in Python 3+).
393
413
  @kwarg kwds: Additional C{B{name}=value} pairs, if any.
@@ -409,8 +429,10 @@ def _error_init(Error, inst, args, fmt_name_value='%s (%r)', txt=NN,
409
429
  t += _fmtuple(_MODS.basics.itemsorted(kwds))
410
430
  t = _or(*t) if t else _SPACE_(_name_value_, MISSING)
411
431
 
412
- if txt is not None:
413
- x = str(txt) or (str(cause) if cause else _invalid_)
432
+ x = _not_(txt_not_) if txt_not_ else (txt if txt__ is None
433
+ else txt__.__name__)
434
+ if x is not None:
435
+ x = str(x) or (str(cause) if cause else _invalid_)
414
436
  C = _COMMASPACE_ if _COLON_ in t else _COLONSPACE_
415
437
  t = C(t, x)
416
438
  # else: # LenError, _xzip, .dms, .heights, .vector2d
@@ -599,7 +621,7 @@ def _xcallable(**names_callables):
599
621
  '''
600
622
  for n, c in names_callables.items():
601
623
  if not callable(c):
602
- raise _TypeError(n, c, txt=_not_(callable.__name__))
624
+ raise _TypeError(n, c, txt_not_=callable.__name__) # txt__
603
625
 
604
626
 
605
627
  def _xdatum(datum1, datum2, Error=None):
@@ -625,7 +647,7 @@ def _xellipsoidal(**name_value): # see _xellipsoidall elel
625
647
  return v
626
648
  except AttributeError:
627
649
  pass
628
- raise _TypeError(n, v, txt=_not_(_ellipsoidal_))
650
+ raise _TypeError(n, v, txt_not_=_ellipsoidal_)
629
651
  raise _xAssertionError(_xellipsoidal, name_value)
630
652
 
631
653
 
@@ -716,7 +738,7 @@ except AttributeError:
716
738
  # b = getattr(inst, n, None)
717
739
  # if b is None: # invalid bool attr
718
740
  # t = _SPACE_(_EQUAL_(n, repr(v)), 'for', inst.__class__.__name__) # XXX .classname
719
- # raise _AttributeError(t, txt=_not_('applicable'))
741
+ # raise _AttributeError(t, txt_not_='applicable')
720
742
  # if v in (False, True) and v != b:
721
743
  # setattr(inst, NN(_UNDER_, n), v)
722
744
 
@@ -777,7 +799,7 @@ def _Xorder(_Coeffs, Error, **Xorder): # in .auxLat, .ktm, .rhumb.bases, .rhumb
777
799
  if m in _Coeffs and _MODS.basics.isint(m):
778
800
  return m
779
801
  t = sorted(map(str, _Coeffs.keys()))
780
- raise Error(X, m, txt=_not_(_or(*t)))
802
+ raise Error(X, m, txt_not_=_or(*t))
781
803
 
782
804
  # **) MIT License
783
805
  #