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/named.py
CHANGED
|
@@ -19,12 +19,13 @@ from pygeodesy.errors import _AssertionError, _AttributeError, _incompatible, \
|
|
|
19
19
|
_IndexError, _IsnotError, _KeyError, LenError, \
|
|
20
20
|
_NameError, _NotImplementedError, _TypeError, \
|
|
21
21
|
_TypesError, UnitError, _ValueError, _xattr, _xkwds, \
|
|
22
|
-
|
|
22
|
+
_xkwds_item2, _xkwds_pop2
|
|
23
23
|
from pygeodesy.internals import _caller3, _dunder_nameof, _isPyPy, _sizeof, _under
|
|
24
24
|
from pygeodesy.interns import MISSING, NN, _AT_, _COLON_, _COLONSPACE_, _COMMA_, \
|
|
25
|
-
_COMMASPACE_, _doesn_t_exist_, _DOT_, _DUNDER_,
|
|
26
|
-
|
|
27
|
-
_other_, _s_, _SPACE_, _std_,
|
|
25
|
+
_COMMASPACE_, _doesn_t_exist_, _DOT_, _DUNDER_, \
|
|
26
|
+
_dunder_name_, _EQUAL_, _exists_, _immutable_, _name_, \
|
|
27
|
+
_NL_, _NN_, _no_, _other_, _s_, _SPACE_, _std_, \
|
|
28
|
+
_UNDER_, _valid_, _vs_
|
|
28
29
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS, _getenv
|
|
29
30
|
from pygeodesy.props import _allPropertiesOf_n, deprecated_method, _hasProperty, \
|
|
30
31
|
_update_all, property_doc_, Property_RO, property_RO, \
|
|
@@ -32,7 +33,7 @@ from pygeodesy.props import _allPropertiesOf_n, deprecated_method, _hasProperty,
|
|
|
32
33
|
from pygeodesy.streprs import attrs, Fmt, lrstrip, pairs, reprs, unstr
|
|
33
34
|
|
|
34
35
|
__all__ = _ALL_LAZY.named
|
|
35
|
-
__version__ = '24.05.
|
|
36
|
+
__version__ = '24.05.21'
|
|
36
37
|
|
|
37
38
|
_COMMANL_ = _COMMA_ + _NL_
|
|
38
39
|
_COMMASPACEDOT_ = _COMMASPACE_ + _DOT_
|
|
@@ -49,28 +50,32 @@ _Units_ = '_Units_'
|
|
|
49
50
|
_UP = 2
|
|
50
51
|
|
|
51
52
|
|
|
52
|
-
def _xjoined_(prefix, name, enquote=True):
|
|
53
|
-
'''(INTERNAL) Join C{
|
|
53
|
+
def _xjoined_(prefix, name=NN, enquote=True, **name__of_name):
|
|
54
|
+
'''(INTERNAL) Join C{prefix} and non-empty C{name}.
|
|
54
55
|
'''
|
|
56
|
+
if name__of_name:
|
|
57
|
+
name = _name__(name, **name__of_name)
|
|
55
58
|
if name and prefix:
|
|
56
59
|
if enquote:
|
|
57
60
|
name = repr(name)
|
|
58
|
-
|
|
61
|
+
t = _SPACE_(prefix, name)
|
|
59
62
|
else:
|
|
60
|
-
|
|
61
|
-
return
|
|
63
|
+
t = prefix or name
|
|
64
|
+
return t
|
|
62
65
|
|
|
63
66
|
|
|
64
|
-
def _xnamed(inst, name, force=False):
|
|
67
|
+
def _xnamed(inst, name=NN, force=False, **name__of_name):
|
|
65
68
|
'''(INTERNAL) Set the instance' C{.name = B{name}}.
|
|
66
69
|
|
|
67
70
|
@arg inst: The instance (C{_Named}).
|
|
68
|
-
@
|
|
69
|
-
@kwarg force:
|
|
71
|
+
@kwarg name: The name (C{str}).
|
|
72
|
+
@kwarg force: If C{True}, force rename (C{bool}).
|
|
70
73
|
|
|
71
|
-
@return: The B{C{inst}},
|
|
72
|
-
not named before.
|
|
74
|
+
@return: The B{C{inst}}, renamed if B{C{force}}d
|
|
75
|
+
or if not named before.
|
|
73
76
|
'''
|
|
77
|
+
if name__of_name:
|
|
78
|
+
name = _name__(name, **name__of_name)
|
|
74
79
|
if name and isinstance(inst, _Named):
|
|
75
80
|
if not inst.name:
|
|
76
81
|
inst.name = name
|
|
@@ -85,7 +90,7 @@ def _xother3(inst, other, name=_other_, up=1, **name_other):
|
|
|
85
90
|
if name_other: # and other is None
|
|
86
91
|
name, other = _xkwds_item2(name_other)
|
|
87
92
|
elif other and len(other) == 1:
|
|
88
|
-
other = other[0]
|
|
93
|
+
name, other = _name__(name), other[0]
|
|
89
94
|
else:
|
|
90
95
|
raise _AssertionError(name, other, txt=classname(inst, prefixed=True))
|
|
91
96
|
return other, name, up
|
|
@@ -165,6 +170,7 @@ class ADict(dict):
|
|
|
165
170
|
C{floats} formatted by function L{pygeodesy.fstr}.
|
|
166
171
|
'''
|
|
167
172
|
n = _xattr(self, name=NN) or self.__class__.__name__
|
|
173
|
+
print(1, n)
|
|
168
174
|
return Fmt.PAREN(n, self._toT(_EQUAL_, **prec_fmt))
|
|
169
175
|
|
|
170
176
|
def toStr(self, **prec_fmt):
|
|
@@ -259,18 +265,18 @@ class _Named(object):
|
|
|
259
265
|
'''
|
|
260
266
|
return _xnamed(self.__class__(*args, **kwds), self.name)
|
|
261
267
|
|
|
262
|
-
def copy(self, deep=False, name
|
|
268
|
+
def copy(self, deep=False, **name):
|
|
263
269
|
'''Make a shallow or deep copy of this instance.
|
|
264
270
|
|
|
265
271
|
@kwarg deep: If C{True} make a deep, otherwise
|
|
266
272
|
a shallow copy (C{bool}).
|
|
267
|
-
@kwarg name: Optional, non-empty name (C{str}).
|
|
273
|
+
@kwarg name: Optional, non-empty C{B{name}=NN} (C{str}).
|
|
268
274
|
|
|
269
275
|
@return: The copy (C{This class}).
|
|
270
276
|
'''
|
|
271
277
|
c = _xcopy(self, deep=deep)
|
|
272
278
|
if name:
|
|
273
|
-
c.rename(name)
|
|
279
|
+
_ = c.rename(name)
|
|
274
280
|
return c
|
|
275
281
|
|
|
276
282
|
def _DOT_(self, *names):
|
|
@@ -282,7 +288,8 @@ class _Named(object):
|
|
|
282
288
|
'''Duplicate this instance, replacing some attributes.
|
|
283
289
|
|
|
284
290
|
@kwarg deep: If C{True} duplicate deep, otherwise shallow.
|
|
285
|
-
@kwarg items: Attributes to be changed (C{any})
|
|
291
|
+
@kwarg items: Attributes to be changed (C{any}), including
|
|
292
|
+
optional C{B{name}} (C{str}).
|
|
286
293
|
|
|
287
294
|
@return: The duplicate (C{This class}).
|
|
288
295
|
|
|
@@ -292,7 +299,7 @@ class _Named(object):
|
|
|
292
299
|
m, items = _xkwds_pop2(items, name=n)
|
|
293
300
|
d = _xdup(self, deep=deep, **items)
|
|
294
301
|
if m != n:
|
|
295
|
-
d.rename(m)
|
|
302
|
+
d.rename(m) # zap _Named_Property_ROs
|
|
296
303
|
# if items:
|
|
297
304
|
# _update_all(d)
|
|
298
305
|
return d
|
|
@@ -341,11 +348,11 @@ class _Named(object):
|
|
|
341
348
|
|
|
342
349
|
@name.setter # PYCHOK setter!
|
|
343
350
|
def name(self, name):
|
|
344
|
-
'''Set the name (C{str}).
|
|
351
|
+
'''Set the C{B{name}=NN} (C{str}).
|
|
345
352
|
|
|
346
353
|
@raise NameError: Can't rename, use method L{rename}.
|
|
347
354
|
'''
|
|
348
|
-
m, n = self._name,
|
|
355
|
+
m, n = self._name, _name__(name)
|
|
349
356
|
if not m:
|
|
350
357
|
self._name = n
|
|
351
358
|
elif n != m:
|
|
@@ -361,6 +368,11 @@ class _Named(object):
|
|
|
361
368
|
# _Named.name.fset(self, name), but NOT
|
|
362
369
|
# _Named(self).name = name
|
|
363
370
|
|
|
371
|
+
def _name__(self, name): # usually **name
|
|
372
|
+
'''(INTERNAL) Get the C{name} or this C{name}.
|
|
373
|
+
'''
|
|
374
|
+
return _name__(name, _or_nameof=self) # nameof(self)
|
|
375
|
+
|
|
364
376
|
@Property_RO
|
|
365
377
|
def named(self):
|
|
366
378
|
'''Get the name I{or} class name or C{""} (C{str}).
|
|
@@ -408,12 +420,22 @@ class _Named(object):
|
|
|
408
420
|
|
|
409
421
|
@return: The previous name (C{str}).
|
|
410
422
|
'''
|
|
411
|
-
m, n = self._name,
|
|
423
|
+
m, n = self._name, _name__(name)
|
|
412
424
|
if n != m:
|
|
413
425
|
self._name = n
|
|
414
426
|
_update_attrs(self, *_Named_Property_ROs)
|
|
415
427
|
return m
|
|
416
428
|
|
|
429
|
+
def renamed(self, name):
|
|
430
|
+
'''Change the name.
|
|
431
|
+
|
|
432
|
+
@arg name: The new name (C{str}).
|
|
433
|
+
|
|
434
|
+
@return: This instance (C{str}).
|
|
435
|
+
'''
|
|
436
|
+
_ = self.rename(name)
|
|
437
|
+
return self
|
|
438
|
+
|
|
417
439
|
@property_RO
|
|
418
440
|
def sizeof(self):
|
|
419
441
|
'''Get the current size in C{bytes} of this instance (C{int}).
|
|
@@ -443,16 +465,17 @@ class _Named(object):
|
|
|
443
465
|
# '''
|
|
444
466
|
# return _DOT_(self, unstr(which, *args, **kwds))
|
|
445
467
|
|
|
446
|
-
def _xnamed(self, inst, name=NN, force
|
|
468
|
+
def _xnamed(self, inst, name=NN, **force):
|
|
447
469
|
'''(INTERNAL) Set the instance' C{.name = self.name}.
|
|
448
470
|
|
|
449
471
|
@arg inst: The instance (C{_Named}).
|
|
450
|
-
@kwarg name:
|
|
451
|
-
@kwarg force:
|
|
472
|
+
@kwarg name: The name (C{str}).
|
|
473
|
+
@kwarg force: If C{True}, force rename (C{bool}).
|
|
452
474
|
|
|
453
|
-
@return: The B{C{inst}},
|
|
475
|
+
@return: The B{C{inst}}, renamed if B{C{force}}d
|
|
476
|
+
or if not named before.
|
|
454
477
|
'''
|
|
455
|
-
return _xnamed(inst, name
|
|
478
|
+
return _xnamed(inst, name, **force)
|
|
456
479
|
|
|
457
480
|
def _xrenamed(self, inst):
|
|
458
481
|
'''(INTERNAL) Rename the instance' C{.name = self.name}.
|
|
@@ -466,7 +489,7 @@ class _Named(object):
|
|
|
466
489
|
if not isinstance(inst, _Named):
|
|
467
490
|
raise _IsnotError(_valid_, inst=inst)
|
|
468
491
|
|
|
469
|
-
inst.rename(self.name)
|
|
492
|
+
_ = inst.rename(self.name)
|
|
470
493
|
return inst
|
|
471
494
|
|
|
472
495
|
_Named_Property_ROs = _allPropertiesOf_n(5, _Named, Property_RO) # PYCHOK once
|
|
@@ -559,16 +582,17 @@ class _NamedBase(_Named):
|
|
|
559
582
|
|
|
560
583
|
|
|
561
584
|
class _NamedDict(ADict, _Named):
|
|
562
|
-
'''(INTERNAL) Named C{dict} with key I{and} attribute
|
|
563
|
-
|
|
585
|
+
'''(INTERNAL) Named C{dict} with key I{and} attribute access
|
|
586
|
+
to the items.
|
|
564
587
|
'''
|
|
565
588
|
def __init__(self, *args, **kwds):
|
|
566
|
-
if args: # args
|
|
589
|
+
if args: # is args[0] a dict?
|
|
567
590
|
if len(args) != 1: # or not isinstance(args[0], dict)
|
|
591
|
+
kwds = _name1__(kwds)
|
|
568
592
|
t = unstr(self.classname, *args, **kwds) # PYCHOK no cover
|
|
569
593
|
raise _ValueError(args=len(args), txt=t)
|
|
570
|
-
kwds = _xkwds(dict(args[0]), **kwds)
|
|
571
|
-
n, kwds =
|
|
594
|
+
kwds = _xkwds(dict(args[0]), **kwds) # args[0] overrides kwds
|
|
595
|
+
n, kwds = _name2__(**kwds)
|
|
572
596
|
if n:
|
|
573
597
|
_Named.name.fset(self, n) # see _Named.name
|
|
574
598
|
ADict.__init__(self, kwds)
|
|
@@ -640,7 +664,7 @@ class _NamedEnum(_NamedDict):
|
|
|
640
664
|
@arg Classes: Additional, acceptable classes or C{type}s.
|
|
641
665
|
'''
|
|
642
666
|
self._item_Classes = (Class,) + Classes
|
|
643
|
-
n =
|
|
667
|
+
n = _name__(**name) or NN(Class.__name__, _s_) # _dunder_nameof
|
|
644
668
|
if n and _xvalid(n, underOK=True):
|
|
645
669
|
_Named.name.fset(self, n) # see _Named.name
|
|
646
670
|
|
|
@@ -881,9 +905,11 @@ class _NamedEnumItem(_NamedBase):
|
|
|
881
905
|
def name(self, name):
|
|
882
906
|
'''Set the name, unless already registered (C{str}).
|
|
883
907
|
'''
|
|
908
|
+
name = _name__(name) or _NN_
|
|
884
909
|
if self._enum:
|
|
885
|
-
raise _NameError(
|
|
886
|
-
|
|
910
|
+
raise _NameError(name, self, txt=_registered_) # XXX _TypeError
|
|
911
|
+
if name:
|
|
912
|
+
self._name = name
|
|
887
913
|
|
|
888
914
|
def _register(self, enum, name):
|
|
889
915
|
'''(INTERNAL) Add this item as B{C{enum.name}}.
|
|
@@ -891,6 +917,7 @@ class _NamedEnumItem(_NamedBase):
|
|
|
891
917
|
@note: Don't register if name is empty or doesn't
|
|
892
918
|
start with a letter.
|
|
893
919
|
'''
|
|
920
|
+
name = _name__(name)
|
|
894
921
|
if name and _xvalid(name, underOK=True):
|
|
895
922
|
self.name = name
|
|
896
923
|
if name[:1].isalpha(): # '_...' not registered
|
|
@@ -1043,7 +1070,7 @@ class _NamedTuple(tuple, _Named):
|
|
|
1043
1070
|
|
|
1044
1071
|
iteritems = items
|
|
1045
1072
|
|
|
1046
|
-
def _kwdself(self, iteration=None, name
|
|
1073
|
+
def _kwdself(self, iteration=None, **name):
|
|
1047
1074
|
'''(INTERNAL) Set C{__new__} keyword arguments.
|
|
1048
1075
|
'''
|
|
1049
1076
|
if iteration is not None:
|
|
@@ -1144,7 +1171,8 @@ class _NamedTuple(tuple, _Named):
|
|
|
1144
1171
|
if (issubclassof(xTuple, _NamedTuple) and
|
|
1145
1172
|
(len(self._Names_) + len(items)) == len(xTuple._Names_) and
|
|
1146
1173
|
self._Names_ == xTuple._Names_[:len(self)]):
|
|
1147
|
-
|
|
1174
|
+
n = _name__(**name) or self.name
|
|
1175
|
+
return xTuple(self + items, name=n) # *(self + items)
|
|
1148
1176
|
c = NN(self.classname, repr(self._Names_)) # PYCHOK no cover
|
|
1149
1177
|
x = NN(xTuple.__name__, repr(xTuple._Names_)) # PYCHOK no cover
|
|
1150
1178
|
raise TypeError(_SPACE_(c, _vs_, x))
|
|
@@ -1232,9 +1260,9 @@ def modulename(clas, prefixed=None): # in .basics._xversion
|
|
|
1232
1260
|
@return: The B{C{class}}'s C{[module.]class} name (C{str}).
|
|
1233
1261
|
'''
|
|
1234
1262
|
try:
|
|
1235
|
-
n =
|
|
1263
|
+
n = clas.__name__
|
|
1236
1264
|
except AttributeError:
|
|
1237
|
-
n =
|
|
1265
|
+
n = _dunder_name_
|
|
1238
1266
|
if prefixed or (classnaming() if prefixed is None else False):
|
|
1239
1267
|
try:
|
|
1240
1268
|
m = clas.__module__.rsplit(_DOT_, 1)
|
|
@@ -1244,6 +1272,62 @@ def modulename(clas, prefixed=None): # in .basics._xversion
|
|
|
1244
1272
|
return n
|
|
1245
1273
|
|
|
1246
1274
|
|
|
1275
|
+
# def _name__(name=NN, name__=None, _or_nameof=None, **kwds):
|
|
1276
|
+
# '''(INTERNAL) Get single keyword argument C{B{name}=NN|None}.
|
|
1277
|
+
# '''
|
|
1278
|
+
# if kwds: # "unexpected keyword arguments ..."
|
|
1279
|
+
# m = _MODS.errors
|
|
1280
|
+
# raise m._UnexpectedError(**kwds)
|
|
1281
|
+
# if name: # is given
|
|
1282
|
+
# n = _name__(**name) if isinstance(name, dict) else str(name)
|
|
1283
|
+
# elif name__ is not None:
|
|
1284
|
+
# n = getattr(name__, _dunder_name_, NN) # _xattr(name__, __name__=NN)
|
|
1285
|
+
# else:
|
|
1286
|
+
# n = name # NN or None or {} or any False type
|
|
1287
|
+
# if _or_nameof is not None and not n:
|
|
1288
|
+
# n = getattr(_or_nameof, _name_, NN) # _xattr(_or_nameof, name=NN)
|
|
1289
|
+
# return n # str or None or {}
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
def _name__(name=NN, **kwds):
|
|
1293
|
+
'''(INTERNAL) Get single keyword argument C{B{name}=NN|None}.
|
|
1294
|
+
'''
|
|
1295
|
+
if name or kwds:
|
|
1296
|
+
name, kwds = _name2__(name, **kwds)
|
|
1297
|
+
if kwds: # "unexpected keyword arguments ..."
|
|
1298
|
+
m = _MODS.errors
|
|
1299
|
+
raise m._UnexpectedError(**kwds)
|
|
1300
|
+
return name if name or name is None else NN
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
def _name1__(kwds_name, _or_nameof=None):
|
|
1304
|
+
'''(INTERNAL) Resolve and set the C{B{name}=NN}.
|
|
1305
|
+
'''
|
|
1306
|
+
if kwds_name:
|
|
1307
|
+
n, kwds_name = _name2__(kwds_name, _or_nameof=_or_nameof)
|
|
1308
|
+
if n:
|
|
1309
|
+
kwds_name.update(name=n)
|
|
1310
|
+
return kwds_name
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
def _name2__(name=NN, name__=None, _or_nameof=None, **kwds):
|
|
1314
|
+
'''(INTERNAL) Get the C{B{name}=NN|None} and other C{kwds}.
|
|
1315
|
+
'''
|
|
1316
|
+
if name: # is given
|
|
1317
|
+
if isinstance(name, dict):
|
|
1318
|
+
kwds.update(name) # kwds = _xkwds(kwds, **name)?
|
|
1319
|
+
n, kwds = _name2__(**kwds)
|
|
1320
|
+
else:
|
|
1321
|
+
n = str(name)
|
|
1322
|
+
elif name__ is not None:
|
|
1323
|
+
n = getattr(name__, _dunder_name_, NN) # _xattr(name__, __name__=NN)
|
|
1324
|
+
else:
|
|
1325
|
+
n = name if name is None else NN
|
|
1326
|
+
if _or_nameof is not None and not n:
|
|
1327
|
+
n = getattr(_or_nameof, _name_, NN) # _xattr(_or_nameof, name=NN)
|
|
1328
|
+
return n, kwds # (str or None or {}), dict
|
|
1329
|
+
|
|
1330
|
+
|
|
1247
1331
|
def nameof(inst):
|
|
1248
1332
|
'''Get the name of an instance.
|
|
1249
1333
|
|
pygeodesy/namedTuples.py
CHANGED
|
@@ -11,13 +11,13 @@ of C{_NamedTuple} defined in C{pygeodesy.named}.
|
|
|
11
11
|
from pygeodesy.basics import map1, _xinstanceof
|
|
12
12
|
# from pygeodesy.constants import INT0 # from .units
|
|
13
13
|
from pygeodesy.errors import _ALL_LAZY, _MODS, _xattr, _xkwds_not # _xkwds
|
|
14
|
-
from pygeodesy.interns import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
from pygeodesy.interns import _1_, _2_, _a_, _A_, _area_, _angle_, _b_, _B_, \
|
|
15
|
+
_band_, _c_, _C_, _datum_, _D_, _distance_, \
|
|
16
|
+
_E_, _easting_, _end_, _fi_, _gamma_, _height_, \
|
|
17
|
+
_h_, _j_, _hemipole_, _initial_, _lam_, _lat_, \
|
|
18
|
+
_lon_, _n_, _northing_, _number_, _outside_, \
|
|
19
|
+
_phi_, _point_, _precision_, _points_, _radius_, \
|
|
20
|
+
_scale_, _start_, _x_, _y_, _z_, _zone_
|
|
21
21
|
# from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .errors
|
|
22
22
|
from pygeodesy.named import _NamedTuple, _Pass
|
|
23
23
|
from pygeodesy.props import deprecated_property_RO, property_RO
|
|
@@ -27,7 +27,7 @@ from pygeodesy.units import Band, Bearing, Degrees, Degrees2, Easting, \
|
|
|
27
27
|
Radians, Radius, Scalar, Str
|
|
28
28
|
|
|
29
29
|
__all__ = _ALL_LAZY.namedTuples
|
|
30
|
-
__version__ = '
|
|
30
|
+
__version__ = '24.05.18'
|
|
31
31
|
|
|
32
32
|
# __DUNDER gets mangled in class
|
|
33
33
|
_closest_ = 'closest'
|
|
@@ -202,7 +202,8 @@ class LatLon2Tuple(_NamedTuple):
|
|
|
202
202
|
'''Extend this L{LatLon2Tuple} to a L{LatLon3Tuple}.
|
|
203
203
|
|
|
204
204
|
@arg height: The height to add (C{scalar}).
|
|
205
|
-
@kwarg name: Optional name (C{str}), overriding
|
|
205
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding
|
|
206
|
+
this name.
|
|
206
207
|
|
|
207
208
|
@return: A L{LatLon3Tuple}C{(lat, lon, height)}.
|
|
208
209
|
|
|
@@ -215,7 +216,8 @@ class LatLon2Tuple(_NamedTuple):
|
|
|
215
216
|
|
|
216
217
|
@arg height: The height to add (C{scalar}).
|
|
217
218
|
@arg datum: The datum to add (C{Datum}).
|
|
218
|
-
@kwarg name: Optional name (C{str}), overriding
|
|
219
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding
|
|
220
|
+
this name.
|
|
219
221
|
|
|
220
222
|
@return: A L{LatLon4Tuple}C{(lat, lon, height, datum)}.
|
|
221
223
|
|
|
@@ -237,7 +239,8 @@ class LatLon3Tuple(_NamedTuple):
|
|
|
237
239
|
'''Extend this L{LatLon3Tuple} to a L{LatLon4Tuple}.
|
|
238
240
|
|
|
239
241
|
@arg datum: The datum to add (C{Datum}).
|
|
240
|
-
@kwarg name: Optional name (C{str}), overriding
|
|
242
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding
|
|
243
|
+
this name.
|
|
241
244
|
|
|
242
245
|
@return: A L{LatLon4Tuple}C{(lat, lon, height, datum)}.
|
|
243
246
|
|
|
@@ -256,17 +259,17 @@ class LatLon4Tuple(LatLon3Tuple): # .cartesianBase, .css, .ecef, .lcc
|
|
|
256
259
|
|
|
257
260
|
|
|
258
261
|
def _LL4Tuple(lat, lon, height, datum, LatLon, LatLon_kwds, inst=None,
|
|
259
|
-
iteration=None, name
|
|
262
|
+
iteration=None, **name):
|
|
260
263
|
'''(INTERNAL) Return a L{LatLon4Tuple} or a B{C{LatLon}} instance.
|
|
261
264
|
'''
|
|
262
265
|
if LatLon is None: # ignore LatLon_kwds
|
|
263
|
-
r = LatLon4Tuple(lat, lon, height, datum, name
|
|
266
|
+
r = LatLon4Tuple(lat, lon, height, datum, **name)
|
|
264
267
|
else:
|
|
265
268
|
kwds = {} if inst is None else _xkwds_not(None,
|
|
266
269
|
# datum=_xattr(inst, datum=None),
|
|
267
270
|
epoch=_xattr(inst, epoch=None),
|
|
268
271
|
reframe=_xattr(inst, reframe=None)) # PYCHOK indent
|
|
269
|
-
kwds.update(datum=datum, height=height, name
|
|
272
|
+
kwds.update(datum=datum, height=height, **name)
|
|
270
273
|
if LatLon_kwds:
|
|
271
274
|
kwds.update(LatLon_kwds)
|
|
272
275
|
r = LatLon(lat, lon, **kwds)
|
|
@@ -303,7 +306,8 @@ class LatLonPrec3Tuple(_NamedTuple): # .gars.py, .wgrs.py
|
|
|
303
306
|
|
|
304
307
|
@arg height: The height to add (C{float} or C{None}).
|
|
305
308
|
@arg radius: The radius to add (C{float} or C{None}).
|
|
306
|
-
@kwarg name: Optional name (C{str}), overriding
|
|
309
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding
|
|
310
|
+
this name.
|
|
307
311
|
|
|
308
312
|
@return: A L{LatLonPrec5Tuple}C{(lat, lon, precision,
|
|
309
313
|
height, radius)}.
|
|
@@ -401,7 +405,8 @@ class PhiLam2Tuple(_NamedTuple): # .frechet, .hausdorff, .latlonBase, .points,
|
|
|
401
405
|
'''Extend this L{PhiLam2Tuple} to a L{PhiLam3Tuple}.
|
|
402
406
|
|
|
403
407
|
@arg height: The height to add (C{scalar}).
|
|
404
|
-
@kwarg name: Optional name (C{str}),
|
|
408
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}),
|
|
409
|
+
overriding this name.
|
|
405
410
|
|
|
406
411
|
@return: A L{PhiLam3Tuple}C{(phi, lam, height)}.
|
|
407
412
|
|
|
@@ -440,7 +445,8 @@ class PhiLam3Tuple(_NamedTuple): # .nvector.py, extends -2Tuple
|
|
|
440
445
|
'''Extend this L{PhiLam3Tuple} to a L{PhiLam4Tuple}.
|
|
441
446
|
|
|
442
447
|
@arg datum: The datum to add (C{Datum}).
|
|
443
|
-
@kwarg name: Optional name (C{str}),
|
|
448
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}),
|
|
449
|
+
overriding this name.
|
|
444
450
|
|
|
445
451
|
@return: A L{PhiLam4Tuple}C{(phi, lam, height, datum)}.
|
|
446
452
|
|
|
@@ -546,11 +552,11 @@ class UtmUps5Tuple(_NamedTuple): # .mgrs.py, .ups.py, .utm.py, .utmups.py
|
|
|
546
552
|
_Names_ = (_zone_, _hemipole_, _easting_, _northing_, _band_)
|
|
547
553
|
_Units_ = ( Number_, Str, Easting, Northing, Band)
|
|
548
554
|
|
|
549
|
-
def __new__(cls, z, h, e, n, B, Error=None, name
|
|
555
|
+
def __new__(cls, z, h, e, n, B, Error=None, **name):
|
|
550
556
|
if Error is not None:
|
|
551
557
|
e = Easting( e, Error=Error)
|
|
552
558
|
n = Northing(n, Error=Error)
|
|
553
|
-
return _NamedTuple.__new__(cls, z, h, e, n, B, name
|
|
559
|
+
return _NamedTuple.__new__(cls, z, h, e, n, B, **name)
|
|
554
560
|
|
|
555
561
|
|
|
556
562
|
class UtmUps8Tuple(_NamedTuple, _Convergence): # .ups, .utm, .utmups
|
|
@@ -567,13 +573,13 @@ class UtmUps8Tuple(_NamedTuple, _Convergence): # .ups, .utm, .utmups
|
|
|
567
573
|
_Units_ = ( Number_, Str, Easting, Northing,
|
|
568
574
|
Band, _Pass, Degrees, Scalar)
|
|
569
575
|
|
|
570
|
-
def __new__(cls, z, h, e, n, B, d, g, s, Error=None, name
|
|
576
|
+
def __new__(cls, z, h, e, n, B, d, g, s, Error=None, **name): # PYCHOK 11 args
|
|
571
577
|
if Error is not None:
|
|
572
578
|
e = Easting( e, Error=Error)
|
|
573
579
|
n = Northing(n, Error=Error)
|
|
574
580
|
g = Degrees(gamma=g, Error=Error)
|
|
575
581
|
s = Scalar(scale=s, Error=Error)
|
|
576
|
-
return _NamedTuple.__new__(cls, z, h, e, n, B, d, g, s, name
|
|
582
|
+
return _NamedTuple.__new__(cls, z, h, e, n, B, d, g, s, **name)
|
|
577
583
|
|
|
578
584
|
|
|
579
585
|
class UtmUpsLatLon5Tuple(_NamedTuple): # .ups.py, .utm.py, .utmups.py
|
|
@@ -587,11 +593,11 @@ class UtmUpsLatLon5Tuple(_NamedTuple): # .ups.py, .utm.py, .utmups.py
|
|
|
587
593
|
_Names_ = (_zone_, _band_, _hemipole_, _lat_, _lon_)
|
|
588
594
|
_Units_ = ( Number_, Band, Str, Lat, Lon)
|
|
589
595
|
|
|
590
|
-
def __new__(cls, z, B, h, lat, lon, Error=None, name
|
|
596
|
+
def __new__(cls, z, B, h, lat, lon, Error=None, **name):
|
|
591
597
|
if Error is not None:
|
|
592
598
|
lat = Lat(lat, Error=Error)
|
|
593
599
|
lon = Lon(lon, Error=Error)
|
|
594
|
-
return _NamedTuple.__new__(cls, z, B, h, lat, lon, name
|
|
600
|
+
return _NamedTuple.__new__(cls, z, B, h, lat, lon, **name)
|
|
595
601
|
|
|
596
602
|
|
|
597
603
|
class Vector2Tuple(_NamedTuple):
|
|
@@ -605,7 +611,8 @@ class Vector2Tuple(_NamedTuple):
|
|
|
605
611
|
'''Extend this L{Vector2Tuple} to a L{Vector3Tuple}.
|
|
606
612
|
|
|
607
613
|
@kwarg z: The Z component add (C{scalar}).
|
|
608
|
-
@kwarg name: Optional name (C{str}),
|
|
614
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}),
|
|
615
|
+
overriding this name.
|
|
609
616
|
|
|
610
617
|
@return: A L{Vector3Tuple}C{(x, y, z)}.
|
|
611
618
|
|
|
@@ -625,7 +632,8 @@ class Vector3Tuple(_NamedTuple):
|
|
|
625
632
|
'''Extend this L{Vector3Tuple} to a L{Vector4Tuple}.
|
|
626
633
|
|
|
627
634
|
@arg h: The height to add (C{scalar}).
|
|
628
|
-
@kwarg name: Optional name (C{str}),
|
|
635
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}),
|
|
636
|
+
overriding this name.
|
|
629
637
|
|
|
630
638
|
@return: A L{Vector4Tuple}C{(x, y, z, h)}.
|
|
631
639
|
|
pygeodesy/nvectorBase.py
CHANGED
|
@@ -39,7 +39,7 @@ from pygeodesy.vector3d import Vector3d, _xyzhdn3
|
|
|
39
39
|
from math import fabs, sqrt
|
|
40
40
|
|
|
41
41
|
__all__ = _ALL_LAZY.nvectorBase
|
|
42
|
-
__version__ = '24.05.
|
|
42
|
+
__version__ = '24.05.18'
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
class NvectorBase(Vector3d): # XXX kept private
|
|
@@ -49,7 +49,7 @@ class NvectorBase(Vector3d): # XXX kept private
|
|
|
49
49
|
_h = Height(h=0) # height (C{meter})
|
|
50
50
|
_H = NN # height prefix (C{str}), '↑' in JS version
|
|
51
51
|
|
|
52
|
-
def __init__(self, x_xyz, y=None, z=None, h=0, ll=None, datum=None, name
|
|
52
|
+
def __init__(self, x_xyz, y=None, z=None, h=0, ll=None, datum=None, **name):
|
|
53
53
|
'''New n-vector normal to the earth's surface.
|
|
54
54
|
|
|
55
55
|
@arg x_xyz: X component of vector (C{scalar}) or (3-D) vector
|
|
@@ -62,15 +62,15 @@ class NvectorBase(Vector3d): # XXX kept private
|
|
|
62
62
|
@kwarg h: Optional height above surface (C{meter}).
|
|
63
63
|
@kwarg ll: Optional, original latlon (C{LatLon}).
|
|
64
64
|
@kwarg datum: Optional, I{pass-thru} datum (L{Datum}).
|
|
65
|
-
@kwarg name: Optional name (C{str}).
|
|
65
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
66
66
|
|
|
67
67
|
@raise TypeError: Non-scalar B{C{x}}, B{C{y}} or B{C{z}}
|
|
68
68
|
coordinate or B{C{x}} not an C{Nvector},
|
|
69
69
|
L{Vector3Tuple} or L{Vector4Tuple} or
|
|
70
70
|
invalid B{C{datum}}.
|
|
71
71
|
'''
|
|
72
|
-
h, d, n = _xyzhdn3(x_xyz, h, datum, ll)
|
|
73
|
-
Vector3d.__init__(self, x_xyz, y=y, z=z, ll=ll, name=
|
|
72
|
+
h, d, n = _xyzhdn3(x_xyz, h, datum, ll, **name)
|
|
73
|
+
Vector3d.__init__(self, x_xyz, y=y, z=z, ll=ll, name=n)
|
|
74
74
|
if h:
|
|
75
75
|
self.h = h
|
|
76
76
|
if d is not None:
|
|
@@ -461,8 +461,8 @@ class LatLonNvectorBase(LatLonBase):
|
|
|
461
461
|
@arg bearing1: Bearing at this point (compass C{degrees360}).
|
|
462
462
|
@arg other: The other point (C{LatLon}).
|
|
463
463
|
@arg bearing2: Bearing at the other point (compass C{degrees360}).
|
|
464
|
-
@kwarg height: Optional height at the triangulated point,
|
|
465
|
-
|
|
464
|
+
@kwarg height: Optional height at the triangulated point, overriding
|
|
465
|
+
the mean height (C{meter}).
|
|
466
466
|
@kwarg wrap: If C{True}, use this and the B{C{other}} point
|
|
467
467
|
I{normalized} (C{bool}).
|
|
468
468
|
|
pygeodesy/points.py
CHANGED
|
@@ -41,8 +41,8 @@ from pygeodesy.fmath import favg, fdot, hypot, Fsum, fsum
|
|
|
41
41
|
from pygeodesy.formy import _bearingTo2, equirectangular_, _spherical_datum
|
|
42
42
|
from pygeodesy.interns import NN, _colinear_, _COMMASPACE_, _composite_, \
|
|
43
43
|
_DEQUALSPACED_, _ELLIPSIS_, _EW_, _immutable_, \
|
|
44
|
-
_near_, _no_,
|
|
45
|
-
|
|
44
|
+
_near_, _no_, _NS_, _point_, _SPACE_, _UNDER_, \
|
|
45
|
+
_valid_ # _lat_, _lon_
|
|
46
46
|
from pygeodesy.iters import LatLon2PsxyIter, PointsIter, points2
|
|
47
47
|
from pygeodesy.latlonBase import LatLonBase, _latlonheight3, \
|
|
48
48
|
_ALL_DOCS, _ALL_LAZY, _MODS
|
|
@@ -62,7 +62,7 @@ from pygeodesy.utily import atan2b, degrees90, degrees180, degrees2m, \
|
|
|
62
62
|
from math import cos, fabs, fmod as _fmod, radians, sin
|
|
63
63
|
|
|
64
64
|
__all__ = _ALL_LAZY.points
|
|
65
|
-
__version__ = '24.05.
|
|
65
|
+
__version__ = '24.05.19'
|
|
66
66
|
|
|
67
67
|
_ilat_ = 'ilat'
|
|
68
68
|
_ilon_ = 'ilon'
|
|
@@ -92,7 +92,7 @@ class LatLon_(LatLonBase): # XXX in heights._HeightBase.height
|
|
|
92
92
|
# python3 -m timeit -s "from pygeodesy... import LatLonBase as LL" "LL(0, 0)" 2.14 usec
|
|
93
93
|
# python3 -m timeit -s "from pygeodesy import LatLon_" "LatLon_(0, 0)" 216 nsec
|
|
94
94
|
|
|
95
|
-
def __init__(self, latlonh, lon=None, height=0, wrap=False,
|
|
95
|
+
def __init__(self, latlonh, lon=None, height=0, wrap=False, datum=None, **name):
|
|
96
96
|
'''New L{LatLon_}.
|
|
97
97
|
|
|
98
98
|
@note: The lat- and longitude values are taken I{as-given,
|
|
@@ -283,7 +283,7 @@ class _Basequence(_Sequence): # immutable, on purpose
|
|
|
283
283
|
'''
|
|
284
284
|
for i in self._findall(point, start_end):
|
|
285
285
|
return i
|
|
286
|
-
raise _IndexError(self._itemname, point,
|
|
286
|
+
raise _IndexError(self._itemname, point, txt_not_='found')
|
|
287
287
|
|
|
288
288
|
@property_RO
|
|
289
289
|
def isNumpy2(self): # PYCHOK no cover
|
|
@@ -1156,7 +1156,7 @@ def fractional(points, fi, j=None, wrap=None, LatLon=None, Vector=None, **kwds):
|
|
|
1156
1156
|
'''
|
|
1157
1157
|
if LatLon and Vector: # PYCHOK no cover
|
|
1158
1158
|
kwds = _xkwds(kwds, fi=fi, LatLon=LatLon, Vector=Vector)
|
|
1159
|
-
raise _TypeError(
|
|
1159
|
+
raise _TypeError(txt__=fractional, **kwds)
|
|
1160
1160
|
w = wrap if LatLon else False # intermediateTo
|
|
1161
1161
|
try:
|
|
1162
1162
|
if not isscalar(fi) or fi < 0:
|
|
@@ -1168,7 +1168,7 @@ def fractional(points, fi, j=None, wrap=None, LatLon=None, Vector=None, **kwds):
|
|
|
1168
1168
|
elif Vector:
|
|
1169
1169
|
p = Vector(p.x, p.y, p.z, **kwds)
|
|
1170
1170
|
except (IndexError, TypeError):
|
|
1171
|
-
raise _IndexError(fi=fi, points=points, wrap=w,
|
|
1171
|
+
raise _IndexError(fi=fi, points=points, wrap=w, txt__=fractional)
|
|
1172
1172
|
return p
|
|
1173
1173
|
|
|
1174
1174
|
|
|
@@ -1191,12 +1191,12 @@ def _fractional(points, fi, j, fin=None, wrap=None): # in .frechet.py
|
|
|
1191
1191
|
elif _isLatLon(p): # backward compatible default
|
|
1192
1192
|
p = LatLon2Tuple(favg(p.lat, q.lat, f=r),
|
|
1193
1193
|
favg(p.lon, q.lon, f=r),
|
|
1194
|
-
|
|
1194
|
+
name__=fractional)
|
|
1195
1195
|
else: # assume p and q are cartesian or vectorial
|
|
1196
1196
|
z = p.z if p.z is q.z else favg(p.z, q.z, f=r)
|
|
1197
1197
|
p = Vector3Tuple(favg(p.x, q.x, f=r),
|
|
1198
1198
|
favg(p.y, q.y, f=r), z,
|
|
1199
|
-
|
|
1199
|
+
name__=fractional)
|
|
1200
1200
|
return p
|
|
1201
1201
|
|
|
1202
1202
|
|
pygeodesy/rhumb/__init__.py
CHANGED
|
@@ -9,7 +9,7 @@ u'''Package of lazily imported C{rhumb} modules L{rhumb.aux_}, L{rhumb.ekx} and
|
|
|
9
9
|
from pygeodesy.lazily import _ALL_LAZY, _ALL_OTHER, _lazy_import_as, _unLazy0
|
|
10
10
|
|
|
11
11
|
__all__ = _ALL_LAZY.rhumb
|
|
12
|
-
__version__ = '
|
|
12
|
+
__version__ = '24.05.24'
|
|
13
13
|
|
|
14
14
|
if _unLazy0: # or _isfrozen
|
|
15
15
|
from pygeodesy.rhumb.aux_ import RhumbAux, RhumbLineAux
|