pygeodesy 24.4.24__py2.py3-none-any.whl → 24.5.6__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/interns.py CHANGED
@@ -151,7 +151,6 @@ _antipodal_ = 'antipodal' # PYCHOK OK
151
151
  _areaOf_ = 'areaOf' # PYCHOK OK
152
152
  _arg_ = 'arg' # PYCHOK OK
153
153
  # _ASTERISK_ = _STAR_ # PYCHOK OK
154
- _at_ = 'at' # PYCHOK OK
155
154
  _AT_ = Str_('@') # PYCHOK OK
156
155
  _AtoZnoIO_ = _Slicer('ABCDEFGHJKLMNPQRSTUVWXYZ') # PYCHOK in .gars, .mgrs and .wgrs
157
156
  _attribute_ = 'attribute' # PYCHOK OK
@@ -247,7 +246,6 @@ _HASH_ = '#' # PYCHOK OK
247
246
  _height_ = 'height' # PYCHOK OK
248
247
  _hemipole_ = 'hemipole' # PYCHOK OK
249
248
  _i_ = 'i' # PYCHOK OK
250
- _iadd_op_ = '+=' # PYCHOK OK
251
249
  _immutable_ = 'immutable' # PYCHOK OK
252
250
  _in_ = 'in' # PYCHOK OK
253
251
  _incompatible_ = 'incompatible' # PYCHOK OK
@@ -463,11 +461,14 @@ def _dunder_nameof(inst, *dflt):
463
461
  return dflt[0] if dflt else inst.__class__.__name__
464
462
 
465
463
 
466
- def _enquote(strs, quote=_QUOTE2_): # in .basics, .solveBase
467
- '''(INTERNAL) Enquote a string containing whitespace.
464
+ def _enquote(strs, quote=_QUOTE2_, white=NN): # in .basics, .solveBase
465
+ '''(INTERNAL) Enquote a string containing whitespace or replace
466
+ whitespace by C{white} if specified.
468
467
  '''
469
- if len(strs.split()) > 1:
470
- strs = NN(quote, strs, quote)
468
+ if strs:
469
+ t = strs.split()
470
+ if len(t) > 1:
471
+ strs = white.join(t if white else (quote, strs, quote))
471
472
  return strs
472
473
 
473
474
 
@@ -646,7 +647,7 @@ def _version_ints(vs):
646
647
  __all__ = (_NN_, # not MISSING!
647
648
  Str_.__name__, # classes
648
649
  machine.__name__) # in .lazily
649
- __version__ = '24.03.20'
650
+ __version__ = '24.05.06'
650
651
 
651
652
  if __name__ == '__main__':
652
653
 
pygeodesy/named.py CHANGED
@@ -20,7 +20,7 @@ from pygeodesy.errors import _AssertionError, _AttributeError, _incompatible, \
20
20
  _NameError, _NotImplementedError, _TypeError, \
21
21
  _TypesError, UnitError, _ValueError, _xattr, _xkwds, \
22
22
  _xkwds_get, _xkwds_item2, _xkwds_pop2
23
- from pygeodesy.interns import MISSING, NN, _at_, _AT_, _COLON_, _COLONSPACE_, _COMMA_, \
23
+ from pygeodesy.interns import MISSING, NN, _AT_, _COLON_, _COLONSPACE_, _COMMA_, \
24
24
  _COMMASPACE_, _doesn_t_exist_, _DOT_, _DUNDER_, _EQUAL_, \
25
25
  _exists_, _immutable_, _name_, _NL_, _NN_, _no_, _other_, \
26
26
  _s_, _SPACE_, _std_, _UNDER_, _valid_, _vs_, \
@@ -32,7 +32,7 @@ from pygeodesy.props import _allPropertiesOf_n, deprecated_method, _hasProperty,
32
32
  from pygeodesy.streprs import attrs, Fmt, lrstrip, pairs, reprs, unstr
33
33
 
34
34
  __all__ = _ALL_LAZY.named
35
- __version__ = '24.04.07'
35
+ __version__ = '24.05.04'
36
36
 
37
37
  _COMMANL_ = _COMMA_ + _NL_
38
38
  _COMMASPACEDOT_ = _COMMASPACE_ + _DOT_
@@ -48,10 +48,16 @@ _Units_ = '_Units_'
48
48
  _UP = 2
49
49
 
50
50
 
51
- def _xjoined_(prefix, name):
51
+ def _xjoined_(prefix, name, enquote=True):
52
52
  '''(INTERNAL) Join C{pref} and non-empty C{name}.
53
53
  '''
54
- return _SPACE_(prefix, repr(name)) if name and prefix else (prefix or name)
54
+ if name and prefix:
55
+ if enquote:
56
+ name = repr(name)
57
+ n = _SPACE_(prefix, name)
58
+ else:
59
+ n = prefix or name
60
+ return n
55
61
 
56
62
 
57
63
  def _xnamed(inst, name, force=False):
@@ -192,7 +198,7 @@ class _Named(object):
192
198
  def __repr__(self):
193
199
  '''Default C{repr(self)}.
194
200
  '''
195
- return Fmt.ANGLE(_SPACE_(self, _at_, hex(id(self))))
201
+ return Fmt.repr_at(self)
196
202
 
197
203
  def __rmatmul__(self, other): # PYCHOK no cover
198
204
  '''Not implemented.'''
@@ -360,9 +366,15 @@ class _Named(object):
360
366
  '''
361
367
  return self.name or self.classname
362
368
 
369
+ # @Property_RO
370
+ # def named_(self):
371
+ # '''Get the C{class} name I{and/or} the str(name) or C{""} (C{str}).
372
+ # '''
373
+ # return _xjoined_(self.classname, self.name, enquote=False)
374
+
363
375
  @Property_RO
364
376
  def named2(self):
365
- '''Get the C{class} name I{and/or} the name or C{""} (C{str}).
377
+ '''Get the C{class} name I{and/or} the repr(name) or C{""} (C{str}).
366
378
  '''
367
379
  return _xjoined_(self.classname, self.name)
368
380
 
pygeodesy/props.py CHANGED
@@ -25,7 +25,7 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, \
25
25
  from functools import wraps as _wraps
26
26
 
27
27
  __all__ = _ALL_LAZY.props
28
- __version__ = '24.03.06'
28
+ __version__ = '24.05.03'
29
29
 
30
30
  _class_ = 'class'
31
31
  _dont_use_ = _DEPRECATED_ + ", don't use."
@@ -36,9 +36,9 @@ _method_ = 'method'
36
36
  _not_an_inst_ = _not_(_an_, 'instance')
37
37
 
38
38
 
39
- def _allPropertiesOf(Clas_or_inst, *Bases):
39
+ def _allPropertiesOf(Clas_or_inst, *Bases, **excls):
40
40
  '''(INTERNAL) Yield all C{R/property/_RO}s at C{Clas_or_inst}
41
- as specified in the C{Bases} arguments.
41
+ as specified in the C{Bases} arguments, except C{excls}.
42
42
  '''
43
43
  if _isclass(Clas_or_inst):
44
44
  S = Clas_or_inst, # just this Clas
@@ -48,17 +48,18 @@ def _allPropertiesOf(Clas_or_inst, *Bases):
48
48
  except AttributeError:
49
49
  raise
50
50
  S = () # not an inst
51
- B = Bases or _PropertyBase
51
+ B = Bases or _PropertyBase
52
+ _is = isinstance
52
53
  for C in S:
53
54
  for n, p in C.__dict__.items():
54
- if isinstance(p, B) and p.name == n:
55
+ if _is(p, B) and p.name == n and n not in excls:
55
56
  yield p
56
57
 
57
58
 
58
- def _allPropertiesOf_n(n, Clas_or_inst, *Bases):
59
+ def _allPropertiesOf_n(n, Clas_or_inst, *Bases, **excls):
59
60
  '''(INTERNAL) Assert the number of C{R/property/_RO}s at C{Clas_or_inst}.
60
61
  '''
61
- t = tuple(p.name for p in _allPropertiesOf(Clas_or_inst, *Bases))
62
+ t = tuple(p.name for p in _allPropertiesOf(Clas_or_inst, *Bases, **excls))
62
63
  if len(t) != n:
63
64
  raise _AssertionError(_COMMASPACE_.join(t), Clas_or_inst,
64
65
  txt=_COMMASPACE_(len(t), _not_(n)))
pygeodesy/streprs.py CHANGED
@@ -21,12 +21,14 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
21
21
  from math import fabs, log10 as _log10
22
22
 
23
23
  __all__ = _ALL_LAZY.streprs
24
- __version__ = '24.03.20'
24
+ __version__ = '24.05.04'
25
25
 
26
+ _at_ = 'at' # PYCHOK used!
26
27
  _EN_PREC = 6 # max MGRS/OSGR precision, 1 micrometer
27
28
  _EN_WIDE = 5 # number of MGRS/OSGR units, log10(_100km)
28
29
  _OKd_ = '._-' # acceptable name characters
29
30
  _PAREN_g = '(%g)' # PYCHOK used!
31
+ _RESIDUAL_ = 'RESIDUAL' # PYCHOK used!
30
32
  _threshold_ = 'threshold' # PYCHOK used!
31
33
 
32
34
 
@@ -42,8 +44,8 @@ class _Fmt(str):
42
44
  for n, v in name_value.items():
43
45
  break
44
46
  else:
45
- n, v = name_value_[:2] if len(name_value_) > 1 else (NN,
46
- (name_value_[0] if name_value_ else MISSING))
47
+ n, v = name_value_[:2] if len(name_value_) > 1 else \
48
+ (NN, (name_value_ or MISSING))
47
49
  t = str.__mod__(self, v)
48
50
  return NN(n, t) if n else t
49
51
 
@@ -123,6 +125,7 @@ class Fmt(object):
123
125
  EQUALSPACED = _Fmt(_EQUALSPACED_(NN, '%s'))
124
126
  exceeds_eps = _Fmt(_exceeds_(_eps_, _PAREN_g))
125
127
  exceeds_limit = _Fmt(_exceeds_(_limit_, _PAREN_g))
128
+ exceeds_R = _Fmt(_exceeds_(_RESIDUAL_, _PAREN_g))
126
129
  f = Fstr(_f_)
127
130
  F = Fstr(_F_)
128
131
  g = Fstr(_g_)
@@ -173,6 +176,11 @@ class Fmt(object):
173
176
  t = t.replace(_tolerance_, _threshold_)
174
177
  return _no_(t)
175
178
 
179
+ def repr_at(self, inst, text=NN):
180
+ '''Return a C{repr} string C{"<B{text} at B{hex_id}>"}.
181
+ '''
182
+ return self.ANGLE(_SPACE_((text or inst), _at_, hex(id(inst))))
183
+
176
184
  Fmt = Fmt() # PYCHOK singleton
177
185
  Fmt.__name__ = Fmt.__class__.__name__
178
186
 
@@ -286,7 +294,7 @@ def _enstr2m3(estr, nstr, wide=_EN_WIDE): # in .mgrs, .osgr
286
294
  return e, n, m
287
295
 
288
296
 
289
- def fstr(floats, prec=6, fmt=Fmt.F, ints=False, sep=_COMMASPACE_, strepr=None):
297
+ def fstr(floats, prec=6, fmt=Fmt.F, ints=False, sep=_COMMASPACE_, strepr=None, force=True):
290
298
  '''Convert one or more floats to string, optionally stripped of trailing zero decimals.
291
299
 
292
300
  @arg floats: Single or a list, sequence, tuple, etc. (C{scalar}s).
@@ -300,15 +308,18 @@ def fstr(floats, prec=6, fmt=Fmt.F, ints=False, sep=_COMMASPACE_, strepr=None):
300
308
  @kwarg ints: Optionally, remove the decimal dot for C{int} values (C{bool}).
301
309
  @kwarg sep: Separator joining the B{C{floats}} (C{str}).
302
310
  @kwarg strepr: Optional callable to format non-C{floats} (typically
303
- C{repr}, C{str}) or C{None} to raise a TypeError.
311
+ C{repr}, C{str}) or C{None} to raise a TypeError and used
312
+ only if C{B{force} is not True}.
313
+ @kwarg force: If C{True} format all B{C{floats}} using B{C{fmt}},
314
+ otherwise use B{C{strepr}} for non-C{floats}.
304
315
 
305
316
  @return: The C{sep.join(strs(floats, ...)} joined (C{str}) or single
306
317
  C{strs((floats,), ...)} (C{str}) if B{C{floats}} is C{scalar}.
307
318
  '''
308
319
  if isscalar(floats): # see Fstr.__call__ above
309
- return next(_streprs(prec, (floats,), fmt, ints, True, strepr))
320
+ return next(_streprs(prec, (floats,), fmt, ints, force, strepr))
310
321
  else:
311
- return sep.join(_streprs(prec, floats, fmt, ints, True, strepr))
322
+ return sep.join(_streprs(prec, floats, fmt, ints, force, strepr))
312
323
 
313
324
 
314
325
  def _fstrENH2(inst, prec, m, fmt=Fmt.F): # in .css, .lcc, .utmupsBase
pygeodesy/triaxials.py CHANGED
@@ -30,7 +30,7 @@ see the U{GeographicLib<https://GeographicLib.SourceForge.io>} documentation.
30
30
  # make sure int/int division yields float quotient, see .basics
31
31
  from __future__ import division as _; del _ # PYCHOK semicolon
32
32
 
33
- from pygeodesy.basics import isLatLon, isscalar, map2, _zip, _ValueError
33
+ from pygeodesy.basics import isLatLon, isscalar, _zip, _ValueError
34
34
  from pygeodesy.constants import EPS, EPS0, EPS02, EPS4, INT0, PI2, PI_3, PI4, \
35
35
  _EPS2e4, float0_, isfinite, isnear1, _0_0, _0_5, \
36
36
  _1_0, _N_1_0, _N_2_0, _4_0 # PYCHOK used!
@@ -59,7 +59,7 @@ from pygeodesy.vector3d import _otherV3d, Vector3d, _ALL_LAZY, _MODS
59
59
  from math import atan2, fabs, sqrt
60
60
 
61
61
  __all__ = _ALL_LAZY.triaxials
62
- __version__ = '24.04.14'
62
+ __version__ = '24.04.30'
63
63
 
64
64
  _not_ordered_ = _not_('ordered')
65
65
  _omega_ = 'omega'
@@ -1127,7 +1127,7 @@ Triaxials = Triaxials(Triaxial, Triaxial_) # PYCHOK singleton
1127
1127
  # <https://ArxIV.org/pdf/1909.06452.pdf> Table 1 Semi-axes in Km
1128
1128
  # <https://www.JPS.NASA.gov/education/images/pdf/ss-moons.pdf>
1129
1129
  # <https://link.Springer.com/article/10.1007/s00190-022-01650-9>
1130
- _EWGS84_35 = _EWGS84.a + 35, _EWGS84.a - 35, _EWGS84.b
1130
+ _abc84_35 = (_EWGS84.a + 35), (_EWGS84.a - 35), _EWGS84.b
1131
1131
  Triaxials._assert( # a (Km) b (Km) c (Km) planet
1132
1132
  Amalthea = _lazy('Amalthea', 125.0, 73.0, 64), # Jupiter
1133
1133
  Ariel = _lazy('Ariel', 581.1, 577.9, 577.7), # Uranus
@@ -1140,8 +1140,8 @@ Triaxials._assert( # a (Km) b (Km) c (Km) planet
1140
1140
  Miranda = _lazy('Miranda', 240.4, 234.2, 232.9), # Uranus
1141
1141
  Moon = _lazy('Moon', 1735.55, 1735.324, 1734.898), # Earth
1142
1142
  Tethys = _lazy('Tethys', 535.6, 528.2, 525.8), # Saturn
1143
- WGS84_35 = _lazy('WGS84_35', *map2(m2km, _EWGS84_35)))
1144
- del _EWGS84_35
1143
+ WGS84_35 = _lazy('WGS84_35', *map(m2km, _abc84_35)))
1144
+ del _abc84_35, _EWGS84
1145
1145
 
1146
1146
 
1147
1147
  def _getitems(items, *indices):
pygeodesy/vector2d.py CHANGED
@@ -30,7 +30,7 @@ from contextlib import contextmanager
30
30
  # from math import fabs, sqrt # from .fmath
31
31
 
32
32
  __all__ = _ALL_LAZY.vector2d
33
- __version__ = '24.04.18'
33
+ __version__ = '24.05.04'
34
34
 
35
35
  _cA_ = 'cA'
36
36
  _cB_ = 'cB'
@@ -663,7 +663,7 @@ def _trilaterate2d2(x1, y1, radius1, x2, y2, radius2, x3, y3, radius3,
663
663
  return t
664
664
 
665
665
 
666
- def _trilaterate3d2(c1, r1, c2, r2, c3, r3, eps=EPS, coin=False,
666
+ def _trilaterate3d2(c1, r1, c2, r2, c3, r3, eps=EPS4, coin=False,
667
667
  **clas_Vector_and_kwds):
668
668
  # (INTERNAL) Intersect three spheres or circles, see function
669
669
  # L{pygeodesy.trilaterate3d2}, separated to allow callers to
pygeodesy/vector3d.py CHANGED
@@ -301,7 +301,7 @@ class Vector3d(Vector3dBase):
301
301
  '''
302
302
  return _MODS.vector2d.soddy4(self, point2, point3, eps=eps, useZ=True)
303
303
 
304
- def trilaterate2d2(self, radius, center2, radius2, center3, radius3, eps=EPS, z=INT0):
304
+ def trilaterate2d2(self, radius, center2, radius2, center3, radius3, eps=EPS4, z=INT0):
305
305
  '''Trilaterate this and two other circles, each given as a (2-D) center
306
306
  and a radius.
307
307
 
@@ -344,7 +344,7 @@ class Vector3d(Vector3dBase):
344
344
  center2=center2, radius2=radius2,
345
345
  center3=center3, radius3=radius3)
346
346
 
347
- def trilaterate3d2(self, radius, center2, radius2, center3, radius3, eps=EPS):
347
+ def trilaterate3d2(self, radius, center2, radius2, center3, radius3, eps=EPS4):
348
348
  '''Trilaterate this and two other spheres, each given as a (3-D) center
349
349
  and a radius.
350
350