pygeodesy 24.5.15__py2.py3-none-any.whl → 24.6.1__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 (90) hide show
  1. {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.6.1.dist-info}/METADATA +6 -5
  2. PyGeodesy-24.6.1.dist-info/RECORD +116 -0
  3. pygeodesy/__init__.py +4 -4
  4. pygeodesy/albers.py +41 -41
  5. pygeodesy/auxilats/__init__.py +1 -1
  6. pygeodesy/auxilats/__main__.py +2 -2
  7. pygeodesy/auxilats/auxAngle.py +32 -31
  8. pygeodesy/auxilats/auxLat.py +80 -51
  9. pygeodesy/azimuthal.py +123 -124
  10. pygeodesy/basics.py +46 -10
  11. pygeodesy/booleans.py +13 -14
  12. pygeodesy/cartesianBase.py +25 -23
  13. pygeodesy/clipy.py +3 -3
  14. pygeodesy/constants.py +3 -3
  15. pygeodesy/css.py +50 -42
  16. pygeodesy/datums.py +42 -41
  17. pygeodesy/deprecated/functions.py +9 -3
  18. pygeodesy/dms.py +6 -6
  19. pygeodesy/ecef.py +41 -41
  20. pygeodesy/ellipsoidalBase.py +41 -41
  21. pygeodesy/ellipsoidalBaseDI.py +3 -4
  22. pygeodesy/ellipsoidalGeodSolve.py +2 -2
  23. pygeodesy/ellipsoidalKarney.py +3 -3
  24. pygeodesy/ellipsoidalNvector.py +11 -12
  25. pygeodesy/ellipsoids.py +45 -38
  26. pygeodesy/elliptic.py +3 -4
  27. pygeodesy/epsg.py +4 -3
  28. pygeodesy/errors.py +52 -20
  29. pygeodesy/etm.py +68 -65
  30. pygeodesy/fmath.py +44 -49
  31. pygeodesy/formy.py +129 -115
  32. pygeodesy/frechet.py +118 -103
  33. pygeodesy/fstats.py +21 -14
  34. pygeodesy/fsums.py +124 -80
  35. pygeodesy/gars.py +10 -9
  36. pygeodesy/geodesicw.py +19 -17
  37. pygeodesy/geodesicx/__init__.py +1 -1
  38. pygeodesy/geodesicx/__main__.py +2 -2
  39. pygeodesy/geodesicx/gx.py +39 -33
  40. pygeodesy/geodesicx/gxarea.py +12 -9
  41. pygeodesy/geodesicx/gxbases.py +3 -4
  42. pygeodesy/geodesicx/gxline.py +6 -8
  43. pygeodesy/geodsolve.py +29 -28
  44. pygeodesy/geohash.py +60 -57
  45. pygeodesy/geoids.py +34 -32
  46. pygeodesy/hausdorff.py +114 -101
  47. pygeodesy/heights.py +137 -130
  48. pygeodesy/internals.py +16 -11
  49. pygeodesy/interns.py +3 -6
  50. pygeodesy/iters.py +19 -17
  51. pygeodesy/karney.py +21 -17
  52. pygeodesy/ktm.py +25 -18
  53. pygeodesy/latlonBase.py +12 -11
  54. pygeodesy/lazily.py +6 -6
  55. pygeodesy/lcc.py +24 -25
  56. pygeodesy/ltp.py +143 -113
  57. pygeodesy/ltpTuples.py +207 -150
  58. pygeodesy/mgrs.py +26 -26
  59. pygeodesy/named.py +172 -90
  60. pygeodesy/namedTuples.py +33 -25
  61. pygeodesy/nvectorBase.py +8 -8
  62. pygeodesy/osgr.py +40 -48
  63. pygeodesy/points.py +18 -18
  64. pygeodesy/props.py +29 -16
  65. pygeodesy/rhumb/__init__.py +1 -1
  66. pygeodesy/rhumb/aux_.py +13 -15
  67. pygeodesy/rhumb/bases.py +12 -5
  68. pygeodesy/rhumb/ekx.py +24 -18
  69. pygeodesy/rhumb/solve.py +13 -10
  70. pygeodesy/simplify.py +16 -16
  71. pygeodesy/solveBase.py +18 -18
  72. pygeodesy/sphericalBase.py +17 -21
  73. pygeodesy/sphericalTrigonometry.py +21 -21
  74. pygeodesy/streprs.py +5 -5
  75. pygeodesy/trf.py +13 -11
  76. pygeodesy/triaxials.py +68 -64
  77. pygeodesy/units.py +35 -35
  78. pygeodesy/unitsBase.py +24 -11
  79. pygeodesy/ups.py +66 -70
  80. pygeodesy/utily.py +3 -3
  81. pygeodesy/utm.py +183 -187
  82. pygeodesy/utmups.py +38 -38
  83. pygeodesy/utmupsBase.py +104 -106
  84. pygeodesy/vector2d.py +6 -7
  85. pygeodesy/vector3d.py +16 -17
  86. pygeodesy/vector3dBase.py +4 -5
  87. pygeodesy/webmercator.py +43 -51
  88. PyGeodesy-24.5.15.dist-info/RECORD +0 -116
  89. {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.6.1.dist-info}/WHEEL +0 -0
  90. {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.6.1.dist-info}/top_level.txt +0 -0
pygeodesy/fsums.py CHANGED
@@ -25,27 +25,29 @@ from __future__ import division as _; del _ # PYCHOK semicolon
25
25
 
26
26
  from pygeodesy.basics import isbool, iscomplex, isint, isscalar, \
27
27
  _signOf, itemsorted, signOf, _xiterable, \
28
- _enquote
28
+ _xiterablen, _enquote
29
29
  from pygeodesy.constants import INT0, _isfinite, NEG0, _pos_self, \
30
30
  _0_0, _1_0, _N_1_0, Float, Int
31
- from pygeodesy.errors import _OverflowError, _TypeError, _ValueError, \
32
- _xError, _xError2, _xkwds_get
31
+ from pygeodesy.errors import _OverflowError, _TypeError, _UnexpectedError, \
32
+ _ValueError, _xError, _xError2, _xkwds_get1, \
33
+ _xkwds_pop2
33
34
  # from pygeodesy.internals import _enquote # from .basics
34
35
  from pygeodesy.interns import NN, _arg_, _COMMASPACE_, _DASH_, _DOT_, \
35
36
  _EQUAL_, _from_, _LANGLE_, _NOTEQUAL_, \
36
37
  _not_finite_, _PERCENT_, _PLUS_, \
37
38
  _RANGLE_, _SLASH_, _SPACE_, _STAR_, _UNDER_
38
39
  from pygeodesy.lazily import _ALL_LAZY, _getenv, _sys_version_info2
39
- from pygeodesy.named import _Named, _NamedTuple, _NotImplemented
40
+ from pygeodesy.named import _name__, _name2__, _Named, _NamedTuple, \
41
+ _NotImplemented
40
42
  from pygeodesy.props import _allPropertiesOf_n, deprecated_property_RO, \
41
- Property_RO, property_RO
43
+ Property, Property_RO, property_RO
42
44
  from pygeodesy.streprs import Fmt, fstr, unstr
43
45
  # from pygeodesy.units import Float, Int # from .constants
44
46
 
45
47
  from math import ceil as _ceil, fabs, floor as _floor # PYCHOK used! .ltp
46
48
 
47
49
  __all__ = _ALL_LAZY.fsums
48
- __version__ = '24.05.13'
50
+ __version__ = '24.05.29'
49
51
 
50
52
  _add_op_ = _PLUS_ # in .auxilats.auxAngle
51
53
  _eq_op_ = _EQUAL_ * 2 # _DEQUAL_
@@ -281,9 +283,15 @@ def _2sum(a, b): # by .testFmath
281
283
  raise _OverflowError(u, txt=t)
282
284
 
283
285
 
284
- def _threshold(threshold):
285
- '''(INTERNAL) Get the L{ResidualError}s threshold.
286
+ def _threshold(threshold=_0_0, **kwds):
287
+ '''(INTERNAL) Get the L{ResidualError}s threshold,
288
+ optionally from single kwds C{B{RESIDUAL}=scalar}.
286
289
  '''
290
+ if kwds:
291
+ threshold, kwds = _xkwds_pop2(kwds, RESIDUAL=threshold)
292
+ # threshold = kwds.pop('RESIDUAL', threshold)
293
+ if kwds:
294
+ raise _UnexpectedError(**kwds)
287
295
  try:
288
296
  return _2finite(threshold) # PYCHOK None
289
297
  except Exception as x:
@@ -320,21 +328,21 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
320
328
  def __init__(self, *xs, **name_RESIDUAL):
321
329
  '''New L{Fsum} for I{running} precision floating point summation.
322
330
 
323
- @arg xs: No, one or more items to add (each C{scalar} or an L{Fsum}
324
- or L{Fsum2Tuple} instance), all positional.
325
- @kwarg name_RESIDUAL: Optional C{B{name}=NN} for this L{Fsum} and
326
- the C{B{RESIDUAL}=0.0} threshold for L{ResidualError}s.
331
+ @arg xs: No, one or more initial items to add (each C{scalar} or
332
+ an L{Fsum} or L{Fsum2Tuple} instance), all positional.
333
+ @kwarg name_RESIDUAL: Optional C{B{name}=NN} (C{str}) for this
334
+ L{Fsum} and the C{B{RESIDUAL}=0.0} threshold for
335
+ L{ResidualError}s (C{scalar}).
327
336
 
328
337
  @see: Methods L{Fsum.fadd} and L{Fsum.RESIDUAL}.
329
338
  '''
330
339
  if name_RESIDUAL:
331
-
332
- def _n_R(name=NN, RESIDUAL=None):
333
- return name, RESIDUAL
334
-
335
- n, R = _n_R(**name_RESIDUAL)
336
- if R is not None:
337
- self.RESIDUAL(R)
340
+ n, kwds = _name2__(**name_RESIDUAL)
341
+ if kwds:
342
+ R = Fsum._RESIDUAL
343
+ t = _threshold(R, **kwds)
344
+ if t != R:
345
+ self._RESIDUAL = t
338
346
  if n:
339
347
  self.name = n
340
348
 
@@ -391,9 +399,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
391
399
  in Python 2- and remainder C{mod} an L{Fsum} instance.
392
400
 
393
401
  @arg other: An L{Fsum}, L{Fsum2Tuple} or C{scalar} modulus.
394
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
395
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
396
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
402
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
403
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
404
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
397
405
 
398
406
  @raise ResidualError: Non-zero, significant residual or invalid
399
407
  B{C{RESIDUAL}}.
@@ -543,9 +551,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
543
551
  @arg other: The exponent (C{scalar}, L{Fsum} or L{Fsum2Tuple}).
544
552
  @arg mod: Optional modulus (C{int} or C{None}) for the 3-argument
545
553
  C{pow(B{self}, B{other}, B{mod})} version.
546
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
547
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
548
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
554
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
555
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
556
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
549
557
 
550
558
  @return: This instance, updated (L{Fsum}).
551
559
 
@@ -601,9 +609,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
601
609
  '''Apply C{B{self} /= B{other}} to this instance.
602
610
 
603
611
  @arg other: An L{Fsum}, L{Fsum2Tuple} or C{scalar} divisor.
604
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
605
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
606
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
612
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
613
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
614
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
607
615
 
608
616
  @return: This instance, updated (L{Fsum}).
609
617
 
@@ -785,9 +793,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
785
793
  '''Return C{B{self} / B{other}} as an L{Fsum}.
786
794
 
787
795
  @arg other: An L{Fsum}, L{Fsum2Tuple} or C{scalar} divisor.
788
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
789
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
790
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
796
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
797
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
798
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
791
799
 
792
800
  @return: The quotient (L{Fsum}).
793
801
 
@@ -863,12 +871,15 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
863
871
  s = self.signOf() # res=True
864
872
  return s
865
873
 
866
- def copy(self, deep=False, name=NN):
874
+ def copy(self, deep=False, **name):
867
875
  '''Copy this instance, C{shallow} or B{C{deep}}.
868
876
 
877
+ @kwarg name: Optional, overriding C{B{name}='"copy"} (C{str}).
878
+
869
879
  @return: The copy (L{Fsum}).
870
880
  '''
871
- f = _Named.copy(self, deep=deep, name=name)
881
+ n = _name__(name, name__=self.copy)
882
+ f = _Named.copy(self, deep=deep, name=n)
872
883
  if f._ps is self._ps:
873
884
  f._ps = list(self._ps) # separate list
874
885
  if not deep:
@@ -879,7 +890,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
879
890
  def _copy_2(self, which, name=NN):
880
891
  '''(INTERNAL) Copy for I{dyadic} operators.
881
892
  '''
882
- n = name or which.__name__
893
+ n = name or which.__name__ # _dunder_nameof
883
894
  # NOT .classof due to .Fdot(a, *b) args, etc.
884
895
  f = _Named.copy(self, deep=False, name=n)
885
896
  f._ps = list(self._ps) # separate list
@@ -1091,9 +1102,29 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1091
1102
  q -= 1
1092
1103
  # t = self.signOf()
1093
1104
  # if t and t != s:
1094
- # raise self._Error(op, other, _AssertionError, txt=signOf.__name__)
1105
+ # raise self._Error(op, other, _AssertionError, txt__=signOf)
1095
1106
  return DivMod2Tuple(q, self) # q is C{int} in Python 3+, but C{float} in Python 2-
1096
1107
 
1108
+ def _fhorner(self, x, cs, op): # in .fmath
1109
+ '''(INTERNAL) Add an L{Fhorner} evaluation of polynomial
1110
+ M{sum(cs[i] * x**i for i=0..len(cs)-1)}.
1111
+ '''
1112
+ if _xiterablen(cs):
1113
+ H = Fsum(name__=self._fhorner)
1114
+ if _isFsumTuple(x):
1115
+ _mul = H._mul_Fsum
1116
+ else:
1117
+ _mul = H._mul_scalar
1118
+ x = _2float(x=x)
1119
+ if len(cs) > 1 and x:
1120
+ for c in reversed(cs):
1121
+ H._fset_ps(_mul(x, op))
1122
+ H._fadd(c, op, up=False)
1123
+ else: # x == 0
1124
+ H = cs[0]
1125
+ self._fadd(H, op)
1126
+ return self
1127
+
1097
1128
  def _finite(self, other, op=None):
1098
1129
  '''(INTERNAL) Return B{C{other}} if C{finite}.
1099
1130
  '''
@@ -1105,10 +1136,10 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1105
1136
  def fint(self, name=NN, **raiser_RESIDUAL):
1106
1137
  '''Return this instance' current running sum as C{integer}.
1107
1138
 
1108
- @kwarg name: Optional name (C{str}), overriding C{"fint"}.
1109
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
1110
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
1111
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
1139
+ @kwarg name: Optional, overriding C{B{name}="fint"} (C{str}).
1140
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
1141
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
1142
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
1112
1143
 
1113
1144
  @return: The C{integer} sum (L{Fsum}) if this instance C{is_integer}
1114
1145
  with a zero or insignificant I{integer} residual.
@@ -1124,8 +1155,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1124
1155
  if R:
1125
1156
  t = _stresidual(_integer_, r, **R)
1126
1157
  raise ResidualError(_integer_, i, txt=t)
1127
- f = self._copy_2(self.fint, name=name)
1128
- return f._fset(i)
1158
+ return _Psum_(i, name=_name__(name, name__=self.fint))
1129
1159
 
1130
1160
  def fint2(self, **name):
1131
1161
  '''Return this instance' current running sum as C{int} and the
@@ -1139,7 +1169,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1139
1169
  '''
1140
1170
  return Fsum2Tuple(*self._fint2, **name)
1141
1171
 
1142
- @Property_RO
1172
+ @Property
1143
1173
  def _fint2(self): # see ._fset
1144
1174
  '''(INTERNAL) Get 2-tuple (C{int}, I{integer} residual).
1145
1175
  '''
@@ -1149,6 +1179,13 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1149
1179
  r = self._ps_1sum(i) if r and n > 1 else float(s - i)
1150
1180
  return i, (r or INT0) # Fsum2Tuple?
1151
1181
 
1182
+ @_fint2.setter_ # PYCHOK setter_underscore!
1183
+ def _fint2(self, s):
1184
+ '''(INTERNAL) Replace the C{_fint2} value.
1185
+ '''
1186
+ i = int(s)
1187
+ return i, ((s - i) or INT0)
1188
+
1152
1189
  @deprecated_property_RO
1153
1190
  def float_int(self): # PYCHOK no cover
1154
1191
  '''DEPRECATED, use method C{Fsum.int_float}.'''
@@ -1200,9 +1237,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1200
1237
  '''Apply C{B{self} /= B{over}} and summate.
1201
1238
 
1202
1239
  @arg over: An L{Fsum} or C{scalar} denominator.
1203
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
1204
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
1205
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
1240
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
1241
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
1242
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
1206
1243
 
1207
1244
  @return: Precision running sum (C{float}).
1208
1245
 
@@ -1233,7 +1270,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1233
1270
  f = self._pow(other, other, op, **raiser_RESIDUAL)
1234
1271
  return self._fset(f) # n=max(len(self), 1)
1235
1272
 
1236
- @Property_RO
1273
+ @Property
1237
1274
  def _fprs(self):
1238
1275
  '''(INTERNAL) Get and cache this instance' precision
1239
1276
  running sum (C{float} or C{int}), ignoring C{residual}.
@@ -1244,7 +1281,13 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1244
1281
  s, _ = self._fprs2
1245
1282
  return s # ._fprs2.fsum
1246
1283
 
1247
- @Property_RO
1284
+ @_fprs.setter_ # PYCHOK setter_underscore!
1285
+ def _fprs(self, s):
1286
+ '''(INTERNAL) Replace the C{_fprs} value.
1287
+ '''
1288
+ return s
1289
+
1290
+ @Property
1248
1291
  def _fprs2(self):
1249
1292
  '''(INTERNAL) Get and cache this instance' precision
1250
1293
  running sum and residual (L{Fsum2Tuple}).
@@ -1268,6 +1311,12 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1268
1311
  # assert self._ps is ps
1269
1312
  return Fsum2Tuple(s, r)
1270
1313
 
1314
+ @_fprs2.setter_ # PYCHOK setter_underscore!
1315
+ def _fprs2(self, s_r):
1316
+ '''(INTERNAL) Replace the C{_fprs2} value.
1317
+ '''
1318
+ return Fsum2Tuple(s_r)
1319
+
1271
1320
  def fset_(self, *xs):
1272
1321
  '''Replace this instance' value with all positional items.
1273
1322
 
@@ -1300,27 +1349,22 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1300
1349
  s = float(self._finite(other, **op)) if op else other
1301
1350
  self._ps[:] = s,
1302
1351
  self._n = n or 1
1303
- if up:
1304
- i = int(s) # see ._fint2
1305
- t = i, ((s - i) or INT0)
1306
- # Property_ROs _fint2, _fprs and _fprs2 can't be a Property:
1307
- # Property's _fset zaps the value just set by the @setter
1308
- self.__dict__.update(_fint2=t, _fprs=s, _fprs2=Fsum2Tuple(s, INT0))
1352
+ if up: # Property _fint2, _fprs and _fprs2 all have
1353
+ # @.setter_underscore and NOT @.setter because the
1354
+ # latter's _fset zaps the value set by @.setter
1355
+ self._fint2 = s
1356
+ self._fprs = s
1357
+ self._fprs2 = s, INT0
1358
+ # assert self._fprs is s
1309
1359
  else: # PYCHOK no cover
1310
- op = _xkwds_get(op, op=_fset_op_)
1360
+ op = _xkwds_get1(op, op=_fset_op_)
1311
1361
  raise self._Error(op, other, _TypeError)
1312
1362
  return self
1313
1363
 
1314
- def _fset_ps(self, other, n=0): # in .fmath
1364
+ def _fset_ps(self, other): # in .fmath
1315
1365
  '''(INTERNAL) Set partials from a known C{scalar}, L{Fsum} or L{Fsum2Tuple}.
1316
1366
  '''
1317
- if _isFsumTuple(other):
1318
- self._ps[:] = other._ps
1319
- self._n = n or other._n
1320
- else: # assert isscalar(other)
1321
- self._ps[:] = other,
1322
- self._n = n or 1
1323
- return self
1367
+ return self._fset(other, up=False)
1324
1368
 
1325
1369
  def fsub(self, xs=()):
1326
1370
  '''Subtract an iterable's items from this instance.
@@ -1399,13 +1443,13 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1399
1443
  '''
1400
1444
  return Fsum2Tuple(self._facc_1(xs)._fprs2, **name)
1401
1445
 
1402
- def fsum2(self, xs=(), name=NN):
1446
+ def fsum2(self, xs=(), **name):
1403
1447
  '''Add an iterable's items, summate and return the
1404
1448
  current precision running sum I{and} the C{residual}.
1405
1449
 
1406
1450
  @arg xs: Iterable of items to add (each item C{scalar}
1407
1451
  or an L{Fsum} or L{Fsum2Tuple} instance).
1408
- @kwarg name: Optional name (C{str}).
1452
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
1409
1453
 
1410
1454
  @return: L{Fsum2Tuple}C{(fsum, residual)} with C{fsum} the
1411
1455
  current precision running sum and C{residual}, the
@@ -1493,9 +1537,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1493
1537
  def int_float(self, **raiser_RESIDUAL):
1494
1538
  '''Return this instance' current running sum as C{int} or C{float}.
1495
1539
 
1496
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
1497
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
1498
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
1540
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
1541
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
1542
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
1499
1543
 
1500
1544
  @return: This C{integer} sum if this instance C{is_integer},
1501
1545
  otherwise return the C{float} sum if the residual is
@@ -1550,9 +1594,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1550
1594
  '''Is this instance' running sum C{scalar} without residual or with
1551
1595
  a residual I{ratio} not exceeding the RESIDUAL threshold?
1552
1596
 
1553
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to ignore
1554
- L{ResidualError}s and C{B{RESIDUAL}=scalar} to override
1555
- the L{RESIDUAL<Fsum.RESIDUAL>} threshold.
1597
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
1598
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
1599
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
1556
1600
 
1557
1601
  @return: C{True} if this instance' non-zero residual C{ratio} exceeds
1558
1602
  the L{RESIDUAL<Fsum.RESIDUAL>} threshold (C{bool}).
@@ -1611,9 +1655,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1611
1655
  @arg x: The exponent (C{scalar} or L{Fsum}).
1612
1656
  @arg mod: Optional modulus (C{int} or C{None}) for the 3-argument
1613
1657
  C{pow(B{self}, B{other}, B{mod})} version.
1614
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
1615
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
1616
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
1658
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
1659
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
1660
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
1617
1661
 
1618
1662
  @return: The C{pow(self, B{x})} or C{pow(self, B{x}, *B{mod})}
1619
1663
  result (L{Fsum}).
@@ -1755,7 +1799,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1755
1799
  return self._pow_2_3(s, x, other, op, **raiser_RESIDUAL)
1756
1800
 
1757
1801
  def _ps_acc(self, ps, xs, up=True, **unused):
1758
- '''(INTERNAL) Accumulate C{xs} scalars into list C{ps}.
1802
+ '''(INTERNAL) Accumulate C{xs} known scalars into list C{ps}.
1759
1803
  '''
1760
1804
  n = 0
1761
1805
  _2s = _2sum
@@ -1820,7 +1864,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1820
1864
  if r and raiser:
1821
1865
  t = self._RESIDUAL
1822
1866
  if RESIDUAL:
1823
- t = _threshold(_xkwds_get(RESIDUAL, RESIDUAL=t))
1867
+ t = _threshold(t, **RESIDUAL)
1824
1868
  if t < 0 or (s + r) != s:
1825
1869
  q = (r / s) if s else s # == 0.
1826
1870
  if fabs(q) > fabs(t):
@@ -1895,9 +1939,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
1895
1939
  '''Return C{B{self}**(1 / B{root})} as L{Fsum}.
1896
1940
 
1897
1941
  @arg root: The order (C{scalar} or L{Fsum}), non-zero.
1898
- @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} (C{bool}) to
1899
- ignore L{ResidualError}s and C{B{RESIDUAL}=scalar}
1900
- to override the L{RESIDUAL<Fsum.RESIDUAL>}.
1942
+ @kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
1943
+ L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
1944
+ to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
1901
1945
 
1902
1946
  @return: The C{self ** (1 / B{root})} result (L{Fsum}).
1903
1947
 
@@ -2182,7 +2226,7 @@ def fsum_(*xs, **floats):
2182
2226
 
2183
2227
  @see: Function L{fsum<fsums.fsum>} for further details.
2184
2228
  '''
2185
- return _fsum(xs if _xkwds_get(floats, floats=False) is True else
2229
+ return _fsum(xs if _xkwds_get1(floats, floats=False) is True else
2186
2230
  _2floats(xs, origin=1)) if xs else _0_0 # PYCHOK yield
2187
2231
 
2188
2232
 
@@ -2217,7 +2261,7 @@ def fsum1_(*xs, **floats):
2217
2261
 
2218
2262
  @see: Function L{fsum_<fsums.fsum_>} for further details.
2219
2263
  '''
2220
- return _fsum(_1primed(xs if _xkwds_get(floats, floats=False) is True else
2264
+ return _fsum(_1primed(xs if _xkwds_get1(floats, floats=False) is True else
2221
2265
  _2floats(xs, origin=1))) if xs else _0_0 # PYCHOK yield
2222
2266
 
2223
2267
 
pygeodesy/gars.py CHANGED
@@ -13,14 +13,14 @@ by I{Charles Karney}. See also U{Global Area Reference System
13
13
  <https://Earth-Info.NGA.mil/GandG/coordsys/grids/gars.html>}.
14
14
  '''
15
15
 
16
- # from pygeodesy.basics import isstr # from .dms
16
+ # from pygeodesy.basics import isstr # from .named
17
17
  from pygeodesy.constants import _off90, _1_over, _0_5, \
18
18
  _1_0 # PYCHOK used!
19
- from pygeodesy.dms import parse3llh, Fmt, isstr # parseDMS2
19
+ from pygeodesy.dms import parse3llh, Fmt # parseDMS2
20
20
  from pygeodesy.errors import _ValueError, _xkwds
21
21
  from pygeodesy.interns import NN, _0to9_, _AtoZnoIO_, _COMMA_
22
22
  from pygeodesy.lazily import _ALL_LAZY, _ALL_OTHER
23
- from pygeodesy.named import nameof, Property_RO
23
+ from pygeodesy.named import _name__, isstr, Property_RO
24
24
  from pygeodesy.namedTuples import LatLon2Tuple, LatLonPrec3Tuple
25
25
  # from pygeodesy.props import Property_RO # from .named
26
26
  # from pygeodesy.streprs import Fmt # from .dms
@@ -30,7 +30,7 @@ from pygeodesy.units import Int_, Lat, Lon, Precision_, Scalar_, \
30
30
  from math import floor
31
31
 
32
32
  __all__ = _ALL_LAZY.gars
33
- __version__ = '23.10.07'
33
+ __version__ = '24.05.24'
34
34
 
35
35
  _Digits = _0to9_
36
36
  _LatLen = 2
@@ -112,7 +112,7 @@ class Garef(Str):
112
112
  '''Garef class, a named C{str}.
113
113
  '''
114
114
  # no str.__init__ in Python 3
115
- def __new__(cls, cll, precision=1, name=NN):
115
+ def __new__(cls, cll, precision=1, **name):
116
116
  '''New L{Garef} from an other L{Garef} instance or garef
117
117
  C{str} or from a C{LatLon} instance or lat-/longitude C{str}.
118
118
 
@@ -121,7 +121,7 @@ class Garef(Str):
121
121
  @kwarg precision: Optional, the desired garef resolution
122
122
  and length (C{int} 0..2), see function
123
123
  L{gars.encode} for more details.
124
- @kwarg name: Optional name (C{str}).
124
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
125
125
 
126
126
  @return: New L{Garef}.
127
127
 
@@ -150,7 +150,7 @@ class Garef(Str):
150
150
  except AttributeError:
151
151
  raise _xStrError(Garef, cll=cll) # Error=GARSError
152
152
 
153
- self = Str.__new__(cls, g, name=name or nameof(cll))
153
+ self = Str.__new__(cls, g, name=_name__(name, _or_nameof=cll))
154
154
  self._latlon = ll
155
155
  self._precision = p
156
156
  return self
@@ -197,7 +197,7 @@ class Garef(Str):
197
197
  *self.latlon, **_xkwds(LatLon_kwds, name=self.name))
198
198
 
199
199
 
200
- def decode3(garef, center=True):
200
+ def decode3(garef, center=True, **name):
201
201
  '''Decode a C{garef} to lat-, longitude and precision.
202
202
 
203
203
  @arg garef: To be decoded (L{Garef} or C{str}).
@@ -245,10 +245,11 @@ def decode3(garef, center=True):
245
245
  lon += _0_5
246
246
  lat += _0_5
247
247
 
248
+ n = _name__(name, _or_nameof=garef)
248
249
  r = _Resolutions[precision] # == 1.0 / unit
249
250
  return LatLonPrec3Tuple(Lat(lat * r, Error=GARSError),
250
251
  Lon(lon * r, Error=GARSError),
251
- precision, name=nameof(garef))
252
+ precision, name=n)
252
253
 
253
254
 
254
255
  def encode(lat, lon, precision=1): # MCCABE 14
pygeodesy/geodesicw.py CHANGED
@@ -18,7 +18,7 @@ from pygeodesy.constants import EPS, NAN, _EPSqrt as _TOL, _0_5
18
18
  from pygeodesy.datums import _earth_datum, _WGS84, _EWGS84
19
19
  # from pygeodesy.dms import F_D # from .latlonBase
20
20
  # from pygeodesy.ellipsoids import _EWGS84 # from .datums
21
- from pygeodesy.errors import IntersectionError, GeodesicError, _xkwds_pop2
21
+ from pygeodesy.errors import IntersectionError, GeodesicError
22
22
  from pygeodesy.fsums import Fsum, Fmt, unstr
23
23
  from pygeodesy.internals import _dunder_nameof, _under
24
24
  from pygeodesy.interns import NN, _DOT_, _SPACE_, _to_, _too_
@@ -26,7 +26,7 @@ from pygeodesy.karney import _atan2d, Caps, Direct9Tuple, GDict, \
26
26
  _kWrapped, Inverse10Tuple
27
27
  from pygeodesy.latlonBase import LatLonBase as _LLB, F_D, Radius_
28
28
  from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
29
- from pygeodesy.named import callername, classname
29
+ from pygeodesy.named import callername, classname, _name1__, _name2__
30
30
  from pygeodesy.namedTuples import Destination3Tuple, Distance3Tuple
31
31
  from pygeodesy.props import Property, Property_RO, property_RO
32
32
  # from pygeodesy.streprs import Fmt, unstr # from .fsums
@@ -37,7 +37,7 @@ from contextlib import contextmanager
37
37
  # from math import fabs # from .utily
38
38
 
39
39
  __all__ = _ALL_LAZY.geodesicw
40
- __version__ = '24.05.14'
40
+ __version__ = '24.05.24'
41
41
 
42
42
  _plumb_ = 'plumb'
43
43
  _TRIPS = 65
@@ -66,20 +66,21 @@ class _gWrapped(_kWrapped):
66
66
  LINE_OFF = 0 # in .azimuthal._GnomonicBase and .css.CassiniSoldner
67
67
  _name = NN
68
68
 
69
- def __init__(self, a_ellipsoid=_EWGS84, f=None, name=NN): # PYCHOK signature
69
+ def __init__(self, a_ellipsoid=_EWGS84, f=None, **name): # PYCHOK signature
70
70
  '''New I{wrapped} C{geodesic.Geodesic} instance.
71
71
 
72
72
  @arg a_ellipsoid: The equatorial radius I{a} (C{meter}, conventionally),
73
73
  an ellipsoid (L{Ellipsoid}) or a datum (L{Datum}).
74
74
  @arg f: The ellipsoid's flattening (C{scalar}), ignored if B{C{a_ellipsoid})
75
75
  is not C{meter}.
76
- @kwarg name: Optional name (C{str}).
76
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
77
77
  '''
78
- _earth_datum(self, a_ellipsoid, f=f, name=name) # raiser=NN
79
- with _wargs(self, *self.ellipsoid.a_f, name=name) as args:
78
+ _earth_datum(self, a_ellipsoid, f=f, **name) # raiser=NN
79
+ E = self.ellipsoid
80
+ with _wargs(self, *E.a_f, **name) as args:
80
81
  _Geodesic.__init__(self, *args)
81
82
  if name:
82
- self._name = str(name)
83
+ self._name, _ = _name2__(name, _or_nameof=E)
83
84
 
84
85
  def ArcDirect(self, lat1, lon1, azi1, a12, outmask=Caps._STD):
85
86
  '''Return the C{_Geodesic.ArcDirect} result as L{GDict}.
@@ -266,7 +267,7 @@ class _gWrapped(_kWrapped):
266
267
  _geodesic = None
267
268
  _name = NN
268
269
 
269
- def __init__(self, geodesic, lat1, lon1, azi1, **caps_name_): # salp1=NAN, calp1=NAN, name=NN
270
+ def __init__(self, geodesic, lat1, lon1, azi1, **caps_name_): # salp1=NAN, calp1=NAN
270
271
  '''New I{wrapped} C{geodesicline.GeodesicLine} instance.
271
272
 
272
273
  @arg geodesic: A I{wrapped} C{Geodesic} instance.
@@ -281,10 +282,10 @@ class _gWrapped(_kWrapped):
281
282
  '''
282
283
  _xinstanceof(_wrapped.Geodesic, geodesic=geodesic)
283
284
  with _wargs(self, geodesic, lat1, lon1, azi1, **caps_name_) as args:
284
- name, caps_ = _xkwds_pop2(caps_name_, name=geodesic.name)
285
- _GeodesicLine.__init__(self, *args, **caps_)
285
+ name, caps_ = _name2__(caps_name_, _or_nameof=geodesic)
286
+ _GeodesicLine.__init__(self, *args, **caps_) # XXX avoid updates?
286
287
  if name:
287
- self._name = str(name)
288
+ self._name = name
288
289
  self._geodesic = geodesic
289
290
 
290
291
  @Property_RO
@@ -428,7 +429,7 @@ class _gWrapped(_kWrapped):
428
429
  _wrapped = _gWrapped() # PYCHOK singleton, .ellipsoids, .test/base.py
429
430
 
430
431
 
431
- def Geodesic(a_ellipsoid, f=None, name=NN):
432
+ def Geodesic(a_ellipsoid, f=None, **name):
432
433
  '''Return a I{wrapped} C{geodesic.Geodesic} instance from I{Karney}'s
433
434
  Python U{geographiclib<https://PyPI.org/project/geographiclib>},
434
435
  provide the latter is installed, otherwise an C{ImportError}.
@@ -437,9 +438,10 @@ def Geodesic(a_ellipsoid, f=None, name=NN):
437
438
  or the equatorial radius I{a} of the ellipsoid (C{meter}).
438
439
  @arg f: The flattening of the ellipsoid (C{scalar}), ignored if
439
440
  B{C{a_ellipsoid}}) is not specified as C{meter}.
440
- @kwarg name: Optional ellipsoid name (C{str}), ignored like B{C{f}}.
441
+ @kwarg name: Optional ellipsoid C{B{name}=NN} (C{str}), ignored
442
+ like B{C{f}}.
441
443
  '''
442
- return _wrapped.Geodesic(a_ellipsoid, f=f, name=name)
444
+ return _wrapped.Geodesic(a_ellipsoid, f=f, **name)
443
445
 
444
446
 
445
447
  def GeodesicLine(geodesic, lat1, lon1, azi1, caps=Caps._STD_LINE):
@@ -479,8 +481,8 @@ class _wargs(object): # see also .formy._idllmn6, .latlonBase._toCartesian3, .v
479
481
  try:
480
482
  yield args
481
483
  except Exception as x:
482
- n = _DOT_(classname(inst), callername(up=2, underOK=True))
483
- raise GeodesicError(unstr(n, *args, **kwds), cause=x)
484
+ u = _DOT_(classname(inst), callername(up=2, underOK=True))
485
+ raise GeodesicError(unstr(u, *args, **_name1__(kwds)), cause=x)
484
486
 
485
487
  _wargs = _wargs() # PYCHOK singleton
486
488
 
@@ -23,7 +23,7 @@ from pygeodesy.karney import Caps, GeodesicError
23
23
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
24
24
 
25
25
  __all__ = _ALL_LAZY.geodesicx + _ALL_DOCS(Caps, GeodesicError)
26
- __version__ = '23.12.03'
26
+ __version__ = '24.05.31'
27
27
 
28
28
  # **) MIT License
29
29
  #
@@ -5,7 +5,7 @@ u'''Print L{geodesicx} version, etc. using C{python -m pygeodesy.geodesicx}.
5
5
  '''
6
6
 
7
7
  __all__ = ()
8
- __version__ = '24.05.13'
8
+ __version__ = '24.05.31'
9
9
 
10
10
 
11
11
  def _C4stats(nC4=None): # PYCHOK no cover
@@ -88,4 +88,4 @@ _main()
88
88
  # OTHER DEALINGS IN THE SOFTWARE.
89
89
 
90
90
  # % python3 -m pygeodesy.geodesicx
91
- # pygeodesy.geodesicx.version=21.05.30, .C4Order=None, .C4len=5425, .C4set=5107, .C4set100=94, .C4x=465 (Python 3.9.5, 64bit, geographiclib 1.52)
91
+ # pygeodesy.geodesicx.version=24.05.31, .C4len=5425, .C4order=30, .C4set=5107, .C4set_len=94.1%, .C4x=465 (Python 3.12.3, 64bit, arm64, geographiclib 2.0)