pygeodesy 24.5.8__py2.py3-none-any.whl → 24.5.24__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/METADATA +2 -2
  2. PyGeodesy-24.5.24.dist-info/RECORD +116 -0
  3. pygeodesy/__init__.py +16 -12
  4. pygeodesy/__main__.py +9 -10
  5. pygeodesy/albers.py +42 -42
  6. pygeodesy/auxilats/__init__.py +1 -1
  7. pygeodesy/auxilats/__main__.py +7 -10
  8. pygeodesy/auxilats/auxAngle.py +32 -31
  9. pygeodesy/auxilats/auxLat.py +81 -51
  10. pygeodesy/azimuthal.py +123 -124
  11. pygeodesy/basics.py +165 -176
  12. pygeodesy/booleans.py +14 -15
  13. pygeodesy/cartesianBase.py +25 -23
  14. pygeodesy/clipy.py +3 -3
  15. pygeodesy/constants.py +8 -6
  16. pygeodesy/css.py +50 -42
  17. pygeodesy/datums.py +50 -48
  18. pygeodesy/dms.py +6 -6
  19. pygeodesy/ecef.py +27 -27
  20. pygeodesy/elevations.py +2 -2
  21. pygeodesy/ellipsoidalBase.py +28 -27
  22. pygeodesy/ellipsoidalBaseDI.py +8 -7
  23. pygeodesy/ellipsoidalNvector.py +11 -12
  24. pygeodesy/ellipsoids.py +41 -35
  25. pygeodesy/elliptic.py +12 -10
  26. pygeodesy/epsg.py +4 -3
  27. pygeodesy/errors.py +35 -13
  28. pygeodesy/etm.py +62 -53
  29. pygeodesy/fmath.py +48 -41
  30. pygeodesy/formy.py +93 -65
  31. pygeodesy/frechet.py +117 -102
  32. pygeodesy/fstats.py +52 -46
  33. pygeodesy/fsums.py +169 -145
  34. pygeodesy/gars.py +10 -9
  35. pygeodesy/geodesicw.py +32 -30
  36. pygeodesy/geodesicx/__init__.py +1 -1
  37. pygeodesy/geodesicx/__main__.py +4 -4
  38. pygeodesy/geodesicx/gx.py +40 -32
  39. pygeodesy/geodesicx/gxarea.py +15 -12
  40. pygeodesy/geodesicx/gxbases.py +3 -4
  41. pygeodesy/geodesicx/gxline.py +6 -8
  42. pygeodesy/geodsolve.py +28 -26
  43. pygeodesy/geohash.py +47 -44
  44. pygeodesy/geoids.py +37 -35
  45. pygeodesy/hausdorff.py +112 -99
  46. pygeodesy/heights.py +136 -129
  47. pygeodesy/internals.py +576 -0
  48. pygeodesy/interns.py +6 -207
  49. pygeodesy/iters.py +22 -19
  50. pygeodesy/karney.py +18 -15
  51. pygeodesy/ktm.py +31 -24
  52. pygeodesy/latlonBase.py +12 -11
  53. pygeodesy/lazily.py +140 -218
  54. pygeodesy/lcc.py +24 -25
  55. pygeodesy/ltp.py +83 -71
  56. pygeodesy/ltpTuples.py +7 -5
  57. pygeodesy/mgrs.py +5 -4
  58. pygeodesy/named.py +136 -49
  59. pygeodesy/namedTuples.py +33 -25
  60. pygeodesy/nvectorBase.py +10 -9
  61. pygeodesy/osgr.py +14 -12
  62. pygeodesy/points.py +13 -13
  63. pygeodesy/props.py +7 -7
  64. pygeodesy/rhumb/__init__.py +1 -1
  65. pygeodesy/rhumb/bases.py +3 -2
  66. pygeodesy/rhumb/solve.py +2 -2
  67. pygeodesy/solveBase.py +8 -7
  68. pygeodesy/sphericalTrigonometry.py +5 -5
  69. pygeodesy/streprs.py +8 -7
  70. pygeodesy/trf.py +8 -8
  71. pygeodesy/triaxials.py +67 -63
  72. pygeodesy/units.py +48 -50
  73. pygeodesy/unitsBase.py +24 -11
  74. pygeodesy/ups.py +7 -6
  75. pygeodesy/utily.py +4 -4
  76. pygeodesy/utm.py +53 -52
  77. pygeodesy/utmupsBase.py +11 -8
  78. pygeodesy/vector2d.py +6 -7
  79. pygeodesy/vector3d.py +16 -17
  80. pygeodesy/vector3dBase.py +5 -5
  81. PyGeodesy-24.5.8.dist-info/RECORD +0 -115
  82. {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/WHEEL +0 -0
  83. {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/top_level.txt +0 -0
pygeodesy/fstats.py CHANGED
@@ -11,17 +11,17 @@ from pygeodesy.basics import isscalar, isodd, _xinstanceof, \
11
11
  _xiterable, _xsubclassof, _zip
12
12
  from pygeodesy.constants import _0_0, _1_0, _2_0, _3_0, _4_0, _6_0
13
13
  from pygeodesy.errors import _AssertionError, _ValueError, _xError
14
- from pygeodesy.fmath import Fsqrt
15
- from pygeodesy.fsums import _2finite, _Float, Fsum, _iadd_op_, \
16
- _isAn, _isFsumTuple, _Tuple, Fmt
17
- from pygeodesy.interns import NN, _odd_, _SPACE_
14
+ from pygeodesy.fmath import Fsqrt, Fmt
15
+ from pygeodesy.fsums import _2finite, Fsum, _iadd_op_, _isFsumTuple
16
+ from pygeodesy.interns import _odd_, _SPACE_
18
17
  from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
19
- from pygeodesy.named import _Named, _NotImplemented, property_RO
18
+ from pygeodesy.named import _name__, _Named, _NotImplemented, \
19
+ property_RO
20
20
  # from pygeodesy.props import property_RO # from .named
21
- # from pygeodesy.streprs import Fmt # from .fsums
21
+ # from pygeodesy.streprs import Fmt # from .fmath
22
22
 
23
23
  __all__ = _ALL_LAZY.fstats
24
- __version__ = '24.05.08'
24
+ __version__ = '24.05.21'
25
25
 
26
26
 
27
27
  def _2Floats(**xs):
@@ -33,11 +33,12 @@ def _2Floats(**xs):
33
33
  raise _AssertionError(xs=xs, cause=X)
34
34
 
35
35
  try:
36
- i, x = 0, None
37
- for i, x in enumerate(xs): # don't unravel Fsums
36
+ i = None
37
+ for i, x in enumerate(_xiterable(xs)): # don't unravel Fsums
38
38
  yield x._Fsum if _isFsumTuple(x) else _2finite(x)
39
39
  except Exception as X:
40
- raise _xError(X, Fmt.INDEX(name, i), x)
40
+ raise _xError(X, name, xs) if i is None else \
41
+ _xError(X, Fmt.INDEX(name, i), x)
41
42
 
42
43
 
43
44
  def _sampled(n, sample):
@@ -86,10 +87,14 @@ class _FstatsNamed(_Named):
86
87
  n = _SPACE_(self.classname, n) if n else self.classname
87
88
  return Fmt.SQUARE(n, len(self))
88
89
 
89
- def copy(self, deep=False, name=NN):
90
+ def copy(self, deep=False, **name):
90
91
  '''Copy this instance, C{shallow} or B{C{deep}}.
92
+
93
+ @kwarg name: Optional, overriding C{B{name}="copy"} (C{str}).
94
+
95
+ @return: The copy instance.
91
96
  '''
92
- n = name or self.copy.__name__
97
+ n = _name__(name, name__=self.copy)
93
98
  f = _Named.copy(self, deep=deep, name=n)
94
99
  return self._copy(f, self) # PYCHOK expected
95
100
 
@@ -105,8 +110,8 @@ class _FstatsBase(_FstatsNamed):
105
110
  '''(INTERNAL) Copy C{B{c} = B{s}}.
106
111
  '''
107
112
  _xinstanceof(self.__class__, d=d, s=s)
108
- d._Ms = _Tuple(M.copy() for M in s._Ms) # deep=False
109
- d._n = s._n
113
+ d._Ms = tuple(M.copy() for M in s._Ms) # deep=False
114
+ d._n = s._n
110
115
  return d
111
116
 
112
117
  def fadd(self, xs, sample=False): # PYCHOK no cover
@@ -130,7 +135,7 @@ class _FstatsBase(_FstatsNamed):
130
135
 
131
136
  @see: Method C{fadd}.
132
137
  '''
133
- return _Float(self._Mean(xs))
138
+ return float(self._Mean(xs))
134
139
 
135
140
  def fmean_(self, *xs):
136
141
  '''Accumulate and return the current mean.
@@ -151,7 +156,7 @@ class _FstatsBase(_FstatsNamed):
151
156
 
152
157
  @see: Method C{fadd}.
153
158
  '''
154
- return _Float(self._Stdev(xs, **sample))
159
+ return float(self._Stdev(xs, **sample))
155
160
 
156
161
  def fstdev_(self, *xs, **sample):
157
162
  '''Accumulate and return the current standard deviation.
@@ -172,7 +177,7 @@ class _FstatsBase(_FstatsNamed):
172
177
 
173
178
  @see: Method C{fadd}.
174
179
  '''
175
- return _Float(self._Variance(xs, **sample))
180
+ return float(self._Variance(xs, **sample))
176
181
 
177
182
  def fvariance_(self, *xs, **sample):
178
183
  '''Accumulate and return the current variance.
@@ -189,12 +194,11 @@ class _FstatsBase(_FstatsNamed):
189
194
  self.fadd_(other._Fsum)
190
195
  elif isscalar(other):
191
196
  self.fadd_(_2finite(other))
192
- else: # iterable?
193
- _xiterable(other)
197
+ elif _xiterable(other):
194
198
  self.fadd(other)
195
- except Exception as x:
199
+ except Exception as X:
196
200
  t = _SPACE_(self, _iadd_op_, repr(other))
197
- raise _xError(x, t)
201
+ raise _xError(X, t)
198
202
 
199
203
  @property_RO
200
204
  def _M1(self):
@@ -235,16 +239,16 @@ class Fcook(_FstatsBase):
235
239
  @see: L{Fwelford} and U{Higher-order statistics<https://
236
240
  WikiPedia.org/wiki/Algorithms_for_calculating_variance>}.
237
241
  '''
238
- def __init__(self, xs=None, name=NN):
242
+ def __init__(self, xs=None, **name):
239
243
  '''New L{Fcook} stats accumulator.
240
244
 
241
245
  @arg xs: Iterable of additional values (each C{scalar} or
242
246
  an L{Fsum} or L{Fsum2Tuple} instance).
243
- @kwarg name: Optional name (C{str}).
247
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
244
248
 
245
249
  @see: Method L{Fcook.fadd}.
246
250
  '''
247
- self._Ms = _Tuple(Fsum() for _ in range(4)) # 1st, 2nd ... Moment
251
+ self._Ms = tuple(Fsum() for _ in range(4)) # 1st, 2nd ... Moment
248
252
  if name:
249
253
  self.name = name
250
254
  if xs:
@@ -265,7 +269,7 @@ class Fcook(_FstatsBase):
265
269
 
266
270
  @see: Method L{Fcook.fadd}.
267
271
  '''
268
- if _isAn(other, Fcook):
272
+ if isinstance(other, Fcook):
269
273
  nb = len(other)
270
274
  if nb > 0:
271
275
  na = len(self)
@@ -374,7 +378,7 @@ class Fcook(_FstatsBase):
374
378
 
375
379
  @see: Method L{Fcook.fadd}.
376
380
  '''
377
- return _Float(self._JarqueBera(xs, excess, sample=sample))
381
+ return float(self._JarqueBera(xs, excess, sample=sample))
378
382
 
379
383
  def fjb_(self, *xs, **sample_excess):
380
384
  '''Accumulate and compute the current U{Jarque-Bera
@@ -401,7 +405,7 @@ class Fcook(_FstatsBase):
401
405
  @see: Method L{Fcook.fadd}.
402
406
  '''
403
407
  n = self.fadd(xs, **sample)
404
- return _Float(self._Kurtosis(n, excess, **sample))
408
+ return float(self._Kurtosis(n, excess, **sample))
405
409
 
406
410
  def fkurtosis_(self, *xs, **excess_sample):
407
411
  '''Accumulate and return the current kurtosis.
@@ -423,7 +427,7 @@ class Fcook(_FstatsBase):
423
427
  https://TowardsDataScience.com/skewness-kurtosis-simplified-1338e094fc85>}
424
428
  and method L{Fcook.fadd}.
425
429
  '''
426
- return _Float(self._Median(xs))
430
+ return float(self._Median(xs))
427
431
 
428
432
  def fmedian_(self, *xs):
429
433
  '''Accumulate and return the current median.
@@ -448,7 +452,7 @@ class Fcook(_FstatsBase):
448
452
  @see: Method L{Fcook.fadd}.
449
453
  '''
450
454
  n = self.fadd(xs, **sample)
451
- return _Float(self._Skewness(n, **sample))
455
+ return float(self._Skewness(n, **sample))
452
456
 
453
457
  def fskewness_(self, *xs, **sample):
454
458
  '''Accumulate and return the current skewness.
@@ -506,10 +510,12 @@ class Fcook(_FstatsBase):
506
510
  S *= (n + 1) / (n - 1)
507
511
  return S
508
512
 
509
- def toFwelford(self, name=NN):
510
- '''Return an L{Fwelford} equivalent.
513
+ def toFwelford(self, **name):
514
+ '''Return a L{Fwelford} equivalent.
515
+
516
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
511
517
  '''
512
- f = Fwelford(name=name or self.name)
518
+ f = Fwelford(name=self._name__(name))
513
519
  f._Ms = self._M1.copy(), self._M2.copy() # deep=False
514
520
  f._n = self._n
515
521
  return f
@@ -521,12 +527,12 @@ class Fwelford(_FstatsBase):
521
527
 
522
528
  @see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}.
523
529
  '''
524
- def __init__(self, xs=None, name=NN):
530
+ def __init__(self, xs=None, **name):
525
531
  '''New L{Fwelford} stats accumulator.
526
532
 
527
533
  @arg xs: Iterable of initial values (each C{scalar} or an
528
534
  L{Fsum} or L{Fsum2Tuple} instance).
529
- @kwarg name: Optional name (C{str}).
535
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
530
536
 
531
537
  @see: Method L{Fwelford.fadd}.
532
538
  '''
@@ -552,7 +558,7 @@ class Fwelford(_FstatsBase):
552
558
  @see: Method L{Fwelford.fadd} and U{Parallel algorithm<https//
553
559
  WikiPedia.org/wiki/Algorithms_for_calculating_variance>}.
554
560
  '''
555
- if _isAn(other, Fwelford):
561
+ if isinstance(other, Fwelford):
556
562
  nb = len(other)
557
563
  if nb > 0:
558
564
  na = len(self)
@@ -579,7 +585,7 @@ class Fwelford(_FstatsBase):
579
585
  else:
580
586
  self._copy(self, other)
581
587
 
582
- elif _isAn(other, Fcook):
588
+ elif isinstance(other, Fcook):
583
589
  self += other.toFwelford()
584
590
  else:
585
591
  self._iadd_other(other)
@@ -620,7 +626,7 @@ class Flinear(_FstatsNamed):
620
626
  C{RunningRegression} computing the running slope, intercept
621
627
  and correlation of a linear regression.
622
628
  '''
623
- def __init__(self, xs=None, ys=None, Fstats=Fwelford, name=NN):
629
+ def __init__(self, xs=None, ys=None, Fstats=Fwelford, **name):
624
630
  '''New L{Flinear} regression accumulator.
625
631
 
626
632
  @kwarg xs: Iterable of initial C{x} values (each C{scalar} or
@@ -629,7 +635,7 @@ class Flinear(_FstatsNamed):
629
635
  an L{Fsum} or L{Fsum2Tuple} instance).
630
636
  @kwarg Fstats: Class for C{xs} and C{ys} values (L{Fcook} or
631
637
  L{Fwelford}).
632
- @kwarg name: Optional name (C{str}).
638
+ @kwarg name: Optional C{B{name}=NN} (C{str}).
633
639
 
634
640
  @raise TypeError: B{C{Fstats}} not L{Fcook} or L{Fwelford}.
635
641
 
@@ -661,7 +667,7 @@ class Flinear(_FstatsNamed):
661
667
 
662
668
  @see: Method L{Flinear.fadd_}.
663
669
  '''
664
- if _isAn(other, Flinear):
670
+ if isinstance(other, Flinear):
665
671
  if len(other) > 0:
666
672
  if len(self) > 0:
667
673
  n = other._n
@@ -676,11 +682,11 @@ class Flinear(_FstatsNamed):
676
682
  self._copy(self, other)
677
683
  else:
678
684
  try:
679
- _xiterable(other)
680
- self.fadd_(*other)
681
- except Exception as x:
685
+ if _xiterable(other):
686
+ self.fadd_(*other)
687
+ except Exception as X:
682
688
  op = _SPACE_(self, _iadd_op_, repr(other))
683
- raise _xError(x, op)
689
+ raise _xError(X, op)
684
690
  return self
685
691
 
686
692
  def _copy(self, d, s):
@@ -752,7 +758,7 @@ class Flinear(_FstatsNamed):
752
758
  @kwarg sample: Use C{B{sample}=True} for the I{sample} correlation
753
759
  instead of the I{population} correlation (C{bool}).
754
760
  '''
755
- return _Float(self._Correlation(**sample))
761
+ return float(self._Correlation(**sample))
756
762
 
757
763
  def fintercept(self, **sample):
758
764
  '''Return the current, running (sample) intercept (C{float}).
@@ -760,7 +766,7 @@ class Flinear(_FstatsNamed):
760
766
  @kwarg sample: Use C{B{sample}=True} for the I{sample} intercept
761
767
  instead of the I{population} intercept (C{bool}).
762
768
  '''
763
- return _Float(self._Intercept(**sample))
769
+ return float(self._Intercept(**sample))
764
770
 
765
771
  def fslope(self, **sample):
766
772
  '''Return the current, running (sample) slope (C{float}).
@@ -768,7 +774,7 @@ class Flinear(_FstatsNamed):
768
774
  @kwarg sample: Use C{B{sample}=True} for the I{sample} slope
769
775
  instead of the I{population} slope (C{bool}).
770
776
  '''
771
- return _Float(self._Slope(**sample))
777
+ return float(self._Slope(**sample))
772
778
 
773
779
  def _Intercept(self, **sample):
774
780
  '''(INTERNAL) Return the current (sample) intercept as L{Fsum}.