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.
- {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.5.24.dist-info}/METADATA +2 -2
- PyGeodesy-24.5.24.dist-info/RECORD +116 -0
- pygeodesy/__init__.py +1 -1
- pygeodesy/albers.py +41 -41
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/auxAngle.py +32 -31
- pygeodesy/auxilats/auxLat.py +80 -51
- pygeodesy/azimuthal.py +123 -124
- pygeodesy/basics.py +8 -6
- pygeodesy/booleans.py +11 -12
- pygeodesy/cartesianBase.py +25 -23
- pygeodesy/clipy.py +3 -3
- pygeodesy/css.py +50 -42
- pygeodesy/datums.py +42 -41
- pygeodesy/dms.py +6 -6
- pygeodesy/ecef.py +23 -24
- pygeodesy/ellipsoidalBase.py +28 -27
- pygeodesy/ellipsoidalBaseDI.py +3 -4
- pygeodesy/ellipsoidalNvector.py +11 -12
- pygeodesy/ellipsoids.py +41 -35
- pygeodesy/elliptic.py +3 -4
- pygeodesy/epsg.py +4 -3
- pygeodesy/errors.py +34 -12
- pygeodesy/etm.py +62 -54
- pygeodesy/fmath.py +36 -30
- pygeodesy/formy.py +93 -65
- pygeodesy/frechet.py +117 -102
- pygeodesy/fstats.py +21 -14
- pygeodesy/fsums.py +67 -57
- pygeodesy/gars.py +10 -9
- pygeodesy/geodesicw.py +19 -17
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/gx.py +40 -32
- pygeodesy/geodesicx/gxarea.py +12 -9
- pygeodesy/geodesicx/gxbases.py +3 -4
- pygeodesy/geodesicx/gxline.py +6 -8
- pygeodesy/geodsolve.py +28 -27
- pygeodesy/geohash.py +47 -44
- pygeodesy/geoids.py +34 -32
- pygeodesy/hausdorff.py +112 -99
- pygeodesy/heights.py +134 -127
- pygeodesy/internals.py +14 -9
- pygeodesy/interns.py +3 -6
- pygeodesy/iters.py +19 -17
- pygeodesy/karney.py +15 -12
- pygeodesy/ktm.py +25 -18
- pygeodesy/latlonBase.py +12 -11
- pygeodesy/lazily.py +4 -4
- pygeodesy/lcc.py +24 -25
- pygeodesy/ltp.py +83 -71
- pygeodesy/ltpTuples.py +7 -5
- pygeodesy/mgrs.py +3 -3
- pygeodesy/named.py +126 -42
- pygeodesy/namedTuples.py +33 -25
- pygeodesy/nvectorBase.py +7 -7
- pygeodesy/points.py +9 -9
- pygeodesy/rhumb/__init__.py +1 -1
- pygeodesy/solveBase.py +5 -5
- pygeodesy/sphericalTrigonometry.py +5 -5
- pygeodesy/streprs.py +5 -5
- pygeodesy/trf.py +5 -5
- pygeodesy/triaxials.py +67 -63
- pygeodesy/units.py +35 -35
- pygeodesy/unitsBase.py +24 -11
- pygeodesy/utm.py +53 -53
- pygeodesy/utmupsBase.py +10 -8
- pygeodesy/vector2d.py +6 -7
- pygeodesy/vector3d.py +16 -17
- pygeodesy/vector3dBase.py +4 -5
- PyGeodesy-24.5.15.dist-info/RECORD +0 -116
- {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.5.24.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.5.15.dist-info → PyGeodesy-24.5.24.dist-info}/top_level.txt +0 -0
pygeodesy/fsums.py
CHANGED
|
@@ -28,15 +28,17 @@ from pygeodesy.basics import isbool, iscomplex, isint, isscalar, \
|
|
|
28
28
|
_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,
|
|
32
|
-
_xError, _xError2, _xkwds_get
|
|
31
|
+
from pygeodesy.errors import _OverflowError, _TypeError, _UnexpectedError, \
|
|
32
|
+
_ValueError, _xError, _xError2, _xkwds_get, \
|
|
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,
|
|
40
|
+
from pygeodesy.named import _name__, _name2__, _Named, _NamedTuple, \
|
|
41
|
+
_NotImplemented
|
|
40
42
|
from pygeodesy.props import _allPropertiesOf_n, deprecated_property_RO, \
|
|
41
43
|
Property_RO, property_RO
|
|
42
44
|
from pygeodesy.streprs import Fmt, fstr, unstr
|
|
@@ -45,7 +47,7 @@ from pygeodesy.streprs import Fmt, fstr, unstr
|
|
|
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.
|
|
50
|
+
__version__ = '24.05.24'
|
|
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
|
|
324
|
-
or L{Fsum2Tuple} instance), all positional.
|
|
325
|
-
@kwarg name_RESIDUAL: Optional C{B{name}=NN} for this
|
|
326
|
-
the C{B{RESIDUAL}=0.0} threshold for
|
|
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
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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}
|
|
395
|
-
|
|
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}
|
|
547
|
-
|
|
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}
|
|
605
|
-
|
|
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}
|
|
789
|
-
|
|
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
|
|
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
|
-
|
|
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,7 +1102,7 @@ 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,
|
|
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
|
|
|
1097
1108
|
def _finite(self, other, op=None):
|
|
@@ -1105,10 +1116,10 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1105
1116
|
def fint(self, name=NN, **raiser_RESIDUAL):
|
|
1106
1117
|
'''Return this instance' current running sum as C{integer}.
|
|
1107
1118
|
|
|
1108
|
-
@kwarg name: Optional
|
|
1109
|
-
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False}
|
|
1110
|
-
|
|
1111
|
-
to override the L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1119
|
+
@kwarg name: Optional, overriding C{B{name}="fint"} (C{str}).
|
|
1120
|
+
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
|
|
1121
|
+
L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
|
|
1122
|
+
to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1112
1123
|
|
|
1113
1124
|
@return: The C{integer} sum (L{Fsum}) if this instance C{is_integer}
|
|
1114
1125
|
with a zero or insignificant I{integer} residual.
|
|
@@ -1124,8 +1135,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1124
1135
|
if R:
|
|
1125
1136
|
t = _stresidual(_integer_, r, **R)
|
|
1126
1137
|
raise ResidualError(_integer_, i, txt=t)
|
|
1127
|
-
|
|
1128
|
-
return f._fset(i)
|
|
1138
|
+
return _Psum_(i, name=_name__(name, name__=self.fint))
|
|
1129
1139
|
|
|
1130
1140
|
def fint2(self, **name):
|
|
1131
1141
|
'''Return this instance' current running sum as C{int} and the
|
|
@@ -1200,9 +1210,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1200
1210
|
'''Apply C{B{self} /= B{over}} and summate.
|
|
1201
1211
|
|
|
1202
1212
|
@arg over: An L{Fsum} or C{scalar} denominator.
|
|
1203
|
-
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False}
|
|
1204
|
-
|
|
1205
|
-
to override the L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1213
|
+
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
|
|
1214
|
+
L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
|
|
1215
|
+
to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1206
1216
|
|
|
1207
1217
|
@return: Precision running sum (C{float}).
|
|
1208
1218
|
|
|
@@ -1399,13 +1409,13 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1399
1409
|
'''
|
|
1400
1410
|
return Fsum2Tuple(self._facc_1(xs)._fprs2, **name)
|
|
1401
1411
|
|
|
1402
|
-
def fsum2(self, xs=(), name
|
|
1412
|
+
def fsum2(self, xs=(), **name):
|
|
1403
1413
|
'''Add an iterable's items, summate and return the
|
|
1404
1414
|
current precision running sum I{and} the C{residual}.
|
|
1405
1415
|
|
|
1406
1416
|
@arg xs: Iterable of items to add (each item C{scalar}
|
|
1407
1417
|
or an L{Fsum} or L{Fsum2Tuple} instance).
|
|
1408
|
-
@kwarg name: Optional name (C{str}).
|
|
1418
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
1409
1419
|
|
|
1410
1420
|
@return: L{Fsum2Tuple}C{(fsum, residual)} with C{fsum} the
|
|
1411
1421
|
current precision running sum and C{residual}, the
|
|
@@ -1493,9 +1503,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1493
1503
|
def int_float(self, **raiser_RESIDUAL):
|
|
1494
1504
|
'''Return this instance' current running sum as C{int} or C{float}.
|
|
1495
1505
|
|
|
1496
|
-
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False}
|
|
1497
|
-
|
|
1498
|
-
to override the L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1506
|
+
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
|
|
1507
|
+
L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
|
|
1508
|
+
to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1499
1509
|
|
|
1500
1510
|
@return: This C{integer} sum if this instance C{is_integer},
|
|
1501
1511
|
otherwise return the C{float} sum if the residual is
|
|
@@ -1550,9 +1560,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1550
1560
|
'''Is this instance' running sum C{scalar} without residual or with
|
|
1551
1561
|
a residual I{ratio} not exceeding the RESIDUAL threshold?
|
|
1552
1562
|
|
|
1553
|
-
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False}
|
|
1554
|
-
L{ResidualError}s and C{B{RESIDUAL}=scalar}
|
|
1555
|
-
the L{RESIDUAL<Fsum.RESIDUAL>}
|
|
1563
|
+
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
|
|
1564
|
+
L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
|
|
1565
|
+
to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1556
1566
|
|
|
1557
1567
|
@return: C{True} if this instance' non-zero residual C{ratio} exceeds
|
|
1558
1568
|
the L{RESIDUAL<Fsum.RESIDUAL>} threshold (C{bool}).
|
|
@@ -1611,9 +1621,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1611
1621
|
@arg x: The exponent (C{scalar} or L{Fsum}).
|
|
1612
1622
|
@arg mod: Optional modulus (C{int} or C{None}) for the 3-argument
|
|
1613
1623
|
C{pow(B{self}, B{other}, B{mod})} version.
|
|
1614
|
-
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False}
|
|
1615
|
-
|
|
1616
|
-
to override the L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1624
|
+
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
|
|
1625
|
+
L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
|
|
1626
|
+
to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1617
1627
|
|
|
1618
1628
|
@return: The C{pow(self, B{x})} or C{pow(self, B{x}, *B{mod})}
|
|
1619
1629
|
result (L{Fsum}).
|
|
@@ -1820,7 +1830,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1820
1830
|
if r and raiser:
|
|
1821
1831
|
t = self._RESIDUAL
|
|
1822
1832
|
if RESIDUAL:
|
|
1823
|
-
t = _threshold(
|
|
1833
|
+
t = _threshold(t, **RESIDUAL)
|
|
1824
1834
|
if t < 0 or (s + r) != s:
|
|
1825
1835
|
q = (r / s) if s else s # == 0.
|
|
1826
1836
|
if fabs(q) > fabs(t):
|
|
@@ -1895,9 +1905,9 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1895
1905
|
'''Return C{B{self}**(1 / B{root})} as L{Fsum}.
|
|
1896
1906
|
|
|
1897
1907
|
@arg root: The order (C{scalar} or L{Fsum}), non-zero.
|
|
1898
|
-
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False}
|
|
1899
|
-
|
|
1900
|
-
to override the L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1908
|
+
@kwarg raiser_RESIDUAL: Use C{B{raiser}=False} to ignore
|
|
1909
|
+
L{ResidualError}s (C{bool}) and C{B{RESIDUAL}=scalar}
|
|
1910
|
+
to override the current L{RESIDUAL<Fsum.RESIDUAL>}.
|
|
1901
1911
|
|
|
1902
1912
|
@return: The C{self ** (1 / B{root})} result (L{Fsum}).
|
|
1903
1913
|
|
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 .
|
|
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
|
|
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
|
|
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__ = '
|
|
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
|
|
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
|
|
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=
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
79
|
-
|
|
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 =
|
|
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
|
|
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_ =
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
483
|
-
raise GeodesicError(unstr(
|
|
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
|
|
pygeodesy/geodesicx/__init__.py
CHANGED