pygeodesy 24.5.24__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.
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/METADATA +6 -5
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/RECORD +57 -57
- pygeodesy/__init__.py +4 -4
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/__main__.py +2 -2
- pygeodesy/auxilats/auxAngle.py +4 -4
- pygeodesy/basics.py +39 -5
- pygeodesy/booleans.py +3 -3
- pygeodesy/constants.py +3 -3
- pygeodesy/deprecated/functions.py +9 -3
- pygeodesy/ecef.py +22 -21
- pygeodesy/ellipsoidalBase.py +15 -16
- pygeodesy/ellipsoidalGeodSolve.py +2 -2
- pygeodesy/ellipsoidalKarney.py +3 -3
- pygeodesy/ellipsoids.py +6 -5
- pygeodesy/errors.py +19 -9
- pygeodesy/etm.py +16 -21
- pygeodesy/fmath.py +9 -20
- pygeodesy/formy.py +60 -74
- pygeodesy/frechet.py +11 -11
- pygeodesy/fsums.py +59 -25
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/__main__.py +2 -2
- pygeodesy/geodesicx/gx.py +3 -5
- pygeodesy/geodsolve.py +2 -2
- pygeodesy/geohash.py +14 -14
- pygeodesy/hausdorff.py +12 -12
- pygeodesy/heights.py +5 -5
- pygeodesy/internals.py +3 -3
- pygeodesy/karney.py +8 -7
- pygeodesy/lazily.py +2 -2
- pygeodesy/ltp.py +62 -44
- pygeodesy/ltpTuples.py +202 -147
- pygeodesy/mgrs.py +24 -24
- pygeodesy/named.py +68 -70
- pygeodesy/nvectorBase.py +2 -2
- pygeodesy/osgr.py +40 -48
- pygeodesy/points.py +10 -10
- pygeodesy/props.py +29 -16
- pygeodesy/rhumb/aux_.py +13 -15
- pygeodesy/rhumb/bases.py +12 -5
- pygeodesy/rhumb/ekx.py +24 -18
- pygeodesy/rhumb/solve.py +13 -10
- pygeodesy/simplify.py +16 -16
- pygeodesy/solveBase.py +14 -14
- pygeodesy/sphericalBase.py +17 -21
- pygeodesy/sphericalTrigonometry.py +17 -17
- pygeodesy/trf.py +9 -7
- pygeodesy/triaxials.py +2 -2
- pygeodesy/ups.py +66 -70
- pygeodesy/utily.py +3 -3
- pygeodesy/utm.py +152 -156
- pygeodesy/utmups.py +38 -38
- pygeodesy/utmupsBase.py +102 -106
- pygeodesy/webmercator.py +43 -51
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/top_level.txt +0 -0
pygeodesy/formy.py
CHANGED
|
@@ -8,7 +8,7 @@ from __future__ import division as _; del _ # PYCHOK semicolon
|
|
|
8
8
|
|
|
9
9
|
# from pygeodesy.cartesianBase import CartesianBase # _MODS
|
|
10
10
|
from pygeodesy.constants import EPS, EPS0, EPS1, PI, PI2, PI3, PI_2, R_M, \
|
|
11
|
-
|
|
11
|
+
_0_0s, float0_, isnon0, remainder, _umod_PI2, \
|
|
12
12
|
_0_0, _0_125, _0_25, _0_5, _1_0, _2_0, _4_0, \
|
|
13
13
|
_32_0, _90_0, _180_0, _360_0
|
|
14
14
|
from pygeodesy.datums import Datum, Ellipsoid, _ellipsoidal_datum, \
|
|
@@ -16,18 +16,18 @@ from pygeodesy.datums import Datum, Ellipsoid, _ellipsoidal_datum, \
|
|
|
16
16
|
# from pygeodesy.ellipsoids import Ellipsoid, _EWGS84 # from .datums
|
|
17
17
|
from pygeodesy.errors import IntersectionError, LimitError, limiterrors, \
|
|
18
18
|
_TypeError, _ValueError, _xattr, _xError, \
|
|
19
|
-
_xkwds, _xkwds_pop2
|
|
19
|
+
_xcallable,_xkwds, _xkwds_pop2
|
|
20
20
|
from pygeodesy.fmath import euclid, hypot, hypot2, sqrt0
|
|
21
21
|
from pygeodesy.fsums import fsumf_, Fmt, unstr
|
|
22
22
|
# from pygeodesy.internals import _dunder_nameof # from .named
|
|
23
|
-
from pygeodesy.interns import _delta_, _distant_, _inside_,
|
|
23
|
+
from pygeodesy.interns import _delta_, _distant_, _inside_, _SPACE_, _too_
|
|
24
24
|
from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
|
|
25
25
|
from pygeodesy.named import _name__, _name2__, _NamedTuple, _xnamed, \
|
|
26
26
|
_dunder_nameof
|
|
27
27
|
from pygeodesy.namedTuples import Bearing2Tuple, Distance4Tuple, LatLon2Tuple, \
|
|
28
28
|
Intersection3Tuple, PhiLam2Tuple, Vector3Tuple
|
|
29
29
|
# from pygeodesy.streprs import Fmt, unstr # from .fsums
|
|
30
|
-
# from pygeodesy.triaxials import
|
|
30
|
+
# from pygeodesy.triaxials import _hartzell3 # _MODS
|
|
31
31
|
from pygeodesy.units import _isHeight, _isRadius, Bearing, Degrees_, Distance, \
|
|
32
32
|
Distance_, Height, Lam_, Lat, Lon, Meter_, Phi_, \
|
|
33
33
|
Radians, Radians_, Radius, Radius_, Scalar, _100km
|
|
@@ -42,7 +42,7 @@ from contextlib import contextmanager
|
|
|
42
42
|
from math import asin, atan, atan2, cos, degrees, fabs, radians, sin, sqrt # pow
|
|
43
43
|
|
|
44
44
|
__all__ = _ALL_LAZY.formy
|
|
45
|
-
__version__ = '24.05.
|
|
45
|
+
__version__ = '24.05.28'
|
|
46
46
|
|
|
47
47
|
_RADIANS2 = (PI / _180_0)**2 # degrees- to radians-squared
|
|
48
48
|
_ratio_ = 'ratio'
|
|
@@ -232,8 +232,8 @@ def cosineAndoyerLambert_(phi2, phi1, lam21, datum=_WGS84):
|
|
|
232
232
|
@raise TypeError: Invalid B{C{datum}}.
|
|
233
233
|
|
|
234
234
|
@see: Functions L{cosineAndoyerLambert}, L{cosineForsytheAndoyerLambert_},
|
|
235
|
-
L{cosineLaw_}, L{
|
|
236
|
-
L{
|
|
235
|
+
L{cosineLaw_}, L{euclidean_}, L{flatLocal_}/L{hubeny_}, L{flatPolar_},
|
|
236
|
+
L{haversine_}, L{thomas_} and L{vincentys_} and U{Geodesy-PHP
|
|
237
237
|
<https://GitHub.com/jtejido/geodesy-php/blob/master/src/Geodesy/Distance/
|
|
238
238
|
AndoyerLambert.php>}.
|
|
239
239
|
'''
|
|
@@ -298,8 +298,8 @@ def cosineForsytheAndoyerLambert_(phi2, phi1, lam21, datum=_WGS84):
|
|
|
298
298
|
@raise TypeError: Invalid B{C{datum}}.
|
|
299
299
|
|
|
300
300
|
@see: Functions L{cosineForsytheAndoyerLambert}, L{cosineAndoyerLambert_},
|
|
301
|
-
L{cosineLaw_}, L{
|
|
302
|
-
L{
|
|
301
|
+
L{cosineLaw_}, L{euclidean_}, L{flatLocal_}/L{hubeny_}, L{flatPolar_},
|
|
302
|
+
L{haversine_}, L{thomas_} and L{vincentys_} and U{Geodesy-PHP
|
|
303
303
|
<https://GitHub.com/jtejido/geodesy-php/blob/master/src/Geodesy/
|
|
304
304
|
Distance/ForsytheCorrection.php>}.
|
|
305
305
|
'''
|
|
@@ -366,9 +366,9 @@ def cosineLaw_(phi2, phi1, lam21):
|
|
|
366
366
|
@return: Angular distance (C{radians}).
|
|
367
367
|
|
|
368
368
|
@see: Functions L{cosineLaw}, L{cosineAndoyerLambert_},
|
|
369
|
-
L{cosineForsytheAndoyerLambert_},
|
|
370
|
-
L{
|
|
371
|
-
L{
|
|
369
|
+
L{cosineForsytheAndoyerLambert_}, L{euclidean_},
|
|
370
|
+
L{flatLocal_}/L{hubeny_}, L{flatPolar_}, L{haversine_},
|
|
371
|
+
L{thomas_} and L{vincentys_}.
|
|
372
372
|
|
|
373
373
|
@note: See note at function L{vincentys_}.
|
|
374
374
|
'''
|
|
@@ -430,35 +430,31 @@ def equirectangular(lat1, lon1, lat2, lon2, radius=R_M, **adjust_limit_wrap):
|
|
|
430
430
|
@arg lon1: Start longitude (C{degrees}).
|
|
431
431
|
@arg lat2: End latitude (C{degrees}).
|
|
432
432
|
@arg lon2: End longitude (C{degrees}).
|
|
433
|
-
@kwarg radius: Mean earth radius (C{meter}), datum (L{Datum})
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
@kwarg adjust_limit_wrap: Optional keyword arguments for
|
|
437
|
-
function L{equirectangular_}.
|
|
433
|
+
@kwarg radius: Mean earth radius (C{meter}), datum (L{Datum}) or ellipsoid
|
|
434
|
+
(L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}).
|
|
435
|
+
@kwarg adjust_limit_wrap: Optional keyword arguments for function L{equirectangular4}.
|
|
438
436
|
|
|
439
|
-
@return: Distance (C{meter}, same units as B{C{radius}} or
|
|
440
|
-
the ellipsoid or datum axes).
|
|
437
|
+
@return: Distance (C{meter}, same units as B{C{radius}} or the ellipsoid or datum axes).
|
|
441
438
|
|
|
442
439
|
@raise TypeError: Invalid B{C{radius}}.
|
|
443
440
|
|
|
444
|
-
@see: Function L{
|
|
445
|
-
|
|
446
|
-
approximate or accurate distance functions.
|
|
441
|
+
@see: Function L{equirectangular4} for more details, the available B{C{options}},
|
|
442
|
+
errors, restrictions and other, approximate or accurate distance functions.
|
|
447
443
|
'''
|
|
448
|
-
d = sqrt(
|
|
444
|
+
d = sqrt(equirectangular4(Lat(lat1=lat1), Lon(lon1=lon1),
|
|
449
445
|
Lat(lat2=lat2), Lon(lon2=lon2),
|
|
450
446
|
**adjust_limit_wrap).distance2) # PYCHOK 4 vs 2-3
|
|
451
447
|
return degrees2m(d, radius=_mean_radius(radius, lat1, lat2))
|
|
452
448
|
|
|
453
449
|
|
|
454
450
|
def _equirectangular(lat1, lon1, lat2, lon2, **adjust_limit_wrap):
|
|
455
|
-
'''(INTERNAL) Helper for the L{frechet.
|
|
451
|
+
'''(INTERNAL) Helper for the L{frechet._FrechetMeterRadians}
|
|
456
452
|
and L{hausdorff._HausdorffMeterRedians} classes.
|
|
457
453
|
'''
|
|
458
|
-
return
|
|
454
|
+
return equirectangular4(lat1, lon1, lat2, lon2, **adjust_limit_wrap).distance2 * _RADIANS2
|
|
459
455
|
|
|
460
456
|
|
|
461
|
-
def
|
|
457
|
+
def equirectangular4(lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False):
|
|
462
458
|
'''Compute the distance between two points using the U{Equirectangular Approximation
|
|
463
459
|
/ Projection<https://www.Movable-Type.co.UK/scripts/latlong.html#equirectangular>}.
|
|
464
460
|
|
|
@@ -469,15 +465,15 @@ def equirectangular_(lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False):
|
|
|
469
465
|
@arg lon1: Start longitude (C{degrees}).
|
|
470
466
|
@arg lat2: End latitude (C{degrees}).
|
|
471
467
|
@arg lon2: End longitude (C{degrees}).
|
|
472
|
-
@kwarg adjust: Adjust the wrapped, unrolled longitudinal delta
|
|
473
|
-
|
|
474
|
-
@kwarg limit: Optional limit for lat- and longitudinal deltas
|
|
475
|
-
|
|
476
|
-
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll B{C{lat2}}
|
|
477
|
-
|
|
468
|
+
@kwarg adjust: Adjust the wrapped, unrolled longitudinal delta by the cosine
|
|
469
|
+
of the mean latitude (C{bool}).
|
|
470
|
+
@kwarg limit: Optional limit for lat- and longitudinal deltas (C{degrees}) or
|
|
471
|
+
C{None} or C{0} for unlimited.
|
|
472
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll B{C{lat2}} and
|
|
473
|
+
B{C{lon2}} (C{bool}).
|
|
478
474
|
|
|
479
|
-
@return: A L{Distance4Tuple}C{(distance2, delta_lat, delta_lon,
|
|
480
|
-
|
|
475
|
+
@return: A L{Distance4Tuple}C{(distance2, delta_lat, delta_lon, unroll_lon2)}
|
|
476
|
+
in C{degrees squared}.
|
|
481
477
|
|
|
482
478
|
@raise LimitError: If the lat- and/or longitudinal delta exceeds the
|
|
483
479
|
B{C{-limit..limit}} range and L{pygeodesy.limiterrors}
|
|
@@ -498,7 +494,7 @@ def equirectangular_(lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False):
|
|
|
498
494
|
d = max(fabs(d_lat), fabs(d_lon))
|
|
499
495
|
if d > limit:
|
|
500
496
|
t = _SPACE_(_delta_, Fmt.PAREN_g(d), Fmt.exceeds_limit(limit))
|
|
501
|
-
s = unstr(
|
|
497
|
+
s = unstr(equirectangular4, lat1, lon1, lat2, lon2,
|
|
502
498
|
limit=limit, wrap=wrap)
|
|
503
499
|
raise LimitError(s, txt=t)
|
|
504
500
|
|
|
@@ -551,9 +547,9 @@ def euclidean_(phi2, phi1, lam21, adjust=True):
|
|
|
551
547
|
@return: Angular distance (C{radians}).
|
|
552
548
|
|
|
553
549
|
@see: Functions L{euclid}, L{euclidean}, L{cosineAndoyerLambert_},
|
|
554
|
-
L{cosineForsytheAndoyerLambert_}, L{cosineLaw_},
|
|
555
|
-
L{flatLocal_}/L{hubeny_}, L{flatPolar_}, L{haversine_},
|
|
556
|
-
and L{vincentys_}.
|
|
550
|
+
L{cosineForsytheAndoyerLambert_}, L{cosineLaw_},
|
|
551
|
+
L{flatLocal_}/L{hubeny_}, L{flatPolar_}, L{haversine_},
|
|
552
|
+
L{thomas_} and L{vincentys_}.
|
|
557
553
|
'''
|
|
558
554
|
if adjust:
|
|
559
555
|
lam21 *= _scale_rad(phi2, phi1)
|
|
@@ -866,8 +862,8 @@ def flatLocal_(phi2, phi1, lam21, datum=_WGS84, scaled=True):
|
|
|
866
862
|
|
|
867
863
|
@see: Functions L{flatLocal} or L{hubeny}, L{cosineAndoyerLambert_},
|
|
868
864
|
L{cosineForsytheAndoyerLambert_}, L{cosineLaw_}, L{flatPolar_},
|
|
869
|
-
L{
|
|
870
|
-
|
|
865
|
+
L{euclidean_}, L{haversine_}, L{thomas_} and L{vincentys_} and
|
|
866
|
+
U{local, flat earth approximation
|
|
871
867
|
<https://www.EdWilliams.org/avform.htm#flat>}.
|
|
872
868
|
'''
|
|
873
869
|
E = _ellipsoidal(datum, flatLocal_)
|
|
@@ -920,8 +916,8 @@ def flatPolar_(phi2, phi1, lam21):
|
|
|
920
916
|
|
|
921
917
|
@see: Functions L{flatPolar}, L{cosineAndoyerLambert_},
|
|
922
918
|
L{cosineForsytheAndoyerLambert_}, L{cosineLaw_},
|
|
923
|
-
L{
|
|
924
|
-
L{
|
|
919
|
+
L{euclidean_}, L{flatLocal_}/L{hubeny_}, L{haversine_},
|
|
920
|
+
L{thomas_} and L{vincentys_}.
|
|
925
921
|
'''
|
|
926
922
|
a = fabs(PI_2 - phi1) # co-latitude
|
|
927
923
|
b = fabs(PI_2 - phi2) # co-latitude
|
|
@@ -964,9 +960,9 @@ def hartzell(pov, los=False, earth=_WGS84, **name_LatLon_and_kwds):
|
|
|
964
960
|
@kwarg earth: The earth model (L{Datum}, L{Ellipsoid}, L{Ellipsoid2},
|
|
965
961
|
L{a_f2Tuple} or a C{scalar} earth radius in C{meter}).
|
|
966
962
|
@kwarg name_LatLon_and_kwds: Optional, overriding C{B{name}="hartzell"}
|
|
967
|
-
(C{str}), C{B{LatLon}=None}
|
|
963
|
+
(C{str}), class C{B{LatLon}=None} to return the intersection
|
|
968
964
|
plus additional C{LatLon} keyword arguments, include the
|
|
969
|
-
B{C{datum}} if different from B{C{earth}}.
|
|
965
|
+
B{C{datum}} if different and to convert from B{C{earth}}.
|
|
970
966
|
|
|
971
967
|
@return: The intersection (L{Vector3d}, B{C{pov}}'s C{cartesian type} or the
|
|
972
968
|
given B{C{LatLon}} instance) with attribute C{heigth} set to the
|
|
@@ -981,15 +977,14 @@ def hartzell(pov, los=False, earth=_WGS84, **name_LatLon_and_kwds):
|
|
|
981
977
|
@see: Class L{Los}, functions L{tyr3d} and L{hartzell4} and methods
|
|
982
978
|
L{Ellipsoid.hartzell4} and any C{Cartesian.hartzell} and C{LatLon.hartzell}.
|
|
983
979
|
'''
|
|
984
|
-
D = _spherical_datum(earth, name__=hartzell)
|
|
985
980
|
n, LatLon_and_kwds = _name2__(name_LatLon_and_kwds, name__=hartzell)
|
|
986
981
|
try:
|
|
982
|
+
D = _spherical_datum(earth, name__=hartzell)
|
|
987
983
|
r, h, i = _MODS.triaxials._hartzell3(pov, los, D.ellipsoid._triaxial)
|
|
988
|
-
r = _xnamed(r, n)
|
|
989
984
|
|
|
990
985
|
C = _MODS.cartesianBase.CartesianBase
|
|
991
986
|
if LatLon_and_kwds:
|
|
992
|
-
c = C(r, datum=D
|
|
987
|
+
c = C(r, datum=D)
|
|
993
988
|
r = c.toLatLon(**_xkwds(LatLon_and_kwds, height=h))
|
|
994
989
|
elif isinstance(r, C):
|
|
995
990
|
r.height = h
|
|
@@ -998,7 +993,7 @@ def hartzell(pov, los=False, earth=_WGS84, **name_LatLon_and_kwds):
|
|
|
998
993
|
except Exception as x:
|
|
999
994
|
raise IntersectionError(pov=pov, los=los, earth=earth, cause=x,
|
|
1000
995
|
**LatLon_and_kwds)
|
|
1001
|
-
return r
|
|
996
|
+
return _xnamed(r, n) if n else r
|
|
1002
997
|
|
|
1003
998
|
|
|
1004
999
|
def haversine(lat1, lon1, lat2, lon2, radius=R_M, wrap=False):
|
|
@@ -1045,8 +1040,8 @@ def haversine_(phi2, phi1, lam21):
|
|
|
1045
1040
|
|
|
1046
1041
|
@see: Functions L{haversine}, L{cosineAndoyerLambert_},
|
|
1047
1042
|
L{cosineForsytheAndoyerLambert_}, L{cosineLaw_},
|
|
1048
|
-
L{
|
|
1049
|
-
L{
|
|
1043
|
+
L{euclidean_}, L{flatLocal_}/L{hubeny_}, L{flatPolar_},
|
|
1044
|
+
L{thomas_} and L{vincentys_}.
|
|
1050
1045
|
|
|
1051
1046
|
@note: See note at function L{vincentys_}.
|
|
1052
1047
|
'''
|
|
@@ -1111,8 +1106,8 @@ def heightOrthometric(h_ll, N):
|
|
|
1111
1106
|
|
|
1112
1107
|
|
|
1113
1108
|
def horizon(height, radius=R_M, refraction=False):
|
|
1114
|
-
'''Determine the distance to the horizon from a given altitude
|
|
1115
|
-
|
|
1109
|
+
'''Determine the distance to the horizon from a given altitude above the
|
|
1110
|
+
(spherical) earth.
|
|
1116
1111
|
|
|
1117
1112
|
@arg height: Altitude (C{meter} or same units as B{C{radius}}).
|
|
1118
1113
|
@kwarg radius: Optional mean earth radius (C{meter}).
|
|
@@ -1560,27 +1555,18 @@ def philam2n_xyz(phi, lam, **name):
|
|
|
1560
1555
|
return _2n_xyz(name, *sincos2_(phi, lam))
|
|
1561
1556
|
|
|
1562
1557
|
|
|
1563
|
-
def _Propy(
|
|
1558
|
+
def _Propy(func, nargs, kwds):
|
|
1564
1559
|
'''(INTERNAL) Helper for the C{frechet.[-]Frechet**} and
|
|
1565
1560
|
C{hausdorff.[-]Hausdorff*} classes.
|
|
1566
1561
|
'''
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
if not callable(func):
|
|
1576
|
-
raise TypeError(_not_(callable.__name__))
|
|
1577
|
-
args = (0,) * nargs
|
|
1578
|
-
_ = func(*args, **inst.kwds)
|
|
1579
|
-
except Exception as x:
|
|
1580
|
-
t = unstr(func, **inst.kwds)
|
|
1581
|
-
raise _TypeError(t, cause=x)
|
|
1582
|
-
inst.__dict__[_prop] = func
|
|
1583
|
-
# return func
|
|
1562
|
+
try:
|
|
1563
|
+
_xcallable(distance=func)
|
|
1564
|
+
# assert _args_kwds_count2(func)[0] == nargs + int(ismethod(func))
|
|
1565
|
+
_ = func(*_0_0s(nargs), **kwds)
|
|
1566
|
+
except Exception as x:
|
|
1567
|
+
t = unstr(func, **kwds)
|
|
1568
|
+
raise _TypeError(t, cause=x)
|
|
1569
|
+
return func
|
|
1584
1570
|
|
|
1585
1571
|
|
|
1586
1572
|
def _radical2(d, r1, r2, **name): # in .ellipsoidalBaseDI, .sphericalTrigonometry, .vector3d
|
|
@@ -1723,8 +1709,8 @@ def thomas_(phi2, phi1, lam21, datum=_WGS84):
|
|
|
1723
1709
|
|
|
1724
1710
|
@see: Functions L{thomas}, L{cosineAndoyerLambert_},
|
|
1725
1711
|
L{cosineForsytheAndoyerLambert_}, L{cosineLaw_},
|
|
1726
|
-
L{
|
|
1727
|
-
L{
|
|
1712
|
+
L{euclidean_}, L{flatLocal_}/L{hubeny_}, L{flatPolar_},
|
|
1713
|
+
L{haversine_} and L{vincentys_} and U{Geodesy-PHP
|
|
1728
1714
|
<https://GitHub.com/jtejido/geodesy-php/blob/master/src/Geodesy/
|
|
1729
1715
|
Distance/ThomasFormula.php>}.
|
|
1730
1716
|
'''
|
|
@@ -1806,8 +1792,8 @@ def vincentys_(phi2, phi1, lam21):
|
|
|
1806
1792
|
|
|
1807
1793
|
@see: Functions L{vincentys}, L{cosineAndoyerLambert_},
|
|
1808
1794
|
L{cosineForsytheAndoyerLambert_}, L{cosineLaw_},
|
|
1809
|
-
L{
|
|
1810
|
-
L{
|
|
1795
|
+
L{euclidean_}, L{flatLocal_}/L{hubeny_}, L{flatPolar_},
|
|
1796
|
+
L{haversine_} and L{thomas_}.
|
|
1811
1797
|
|
|
1812
1798
|
@note: Functions L{vincentys_}, L{haversine_} and L{cosineLaw_}
|
|
1813
1799
|
produce equivalent results, but L{vincentys_} is suitable
|
pygeodesy/frechet.py
CHANGED
|
@@ -94,7 +94,7 @@ from pygeodesy.named import _name2__, _Named, _NamedTuple, _Pass
|
|
|
94
94
|
# from pygeodesy.namedTuples import PhiLam2Tuple # from .points
|
|
95
95
|
from pygeodesy.points import _distanceTo, _fractional, isscalar, \
|
|
96
96
|
PhiLam2Tuple, points2 as _points2, radians
|
|
97
|
-
from pygeodesy.props import property_doc_, property_RO
|
|
97
|
+
from pygeodesy.props import Property, property_doc_, property_RO
|
|
98
98
|
from pygeodesy.units import FIx, Float, Number_, _xUnit, _xUnits
|
|
99
99
|
from pygeodesy.unitsBase import _Str_degrees, _Str_meter, _Str_NN, \
|
|
100
100
|
_Str_radians, _Str_radians2
|
|
@@ -103,7 +103,7 @@ from collections import defaultdict as _defaultdict
|
|
|
103
103
|
# from math import radians # from .points
|
|
104
104
|
|
|
105
105
|
__all__ = _ALL_LAZY.frechet
|
|
106
|
-
__version__ = '24.05.
|
|
106
|
+
__version__ = '24.05.26'
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
def _fraction(fraction, n):
|
|
@@ -252,14 +252,14 @@ class Frechet(_Named):
|
|
|
252
252
|
# '''(INTERNAL) I{Must be overloaded}.'''
|
|
253
253
|
# self._notOverloaded(*args, **kwds)
|
|
254
254
|
|
|
255
|
-
@
|
|
255
|
+
@Property
|
|
256
256
|
def _func(self):
|
|
257
257
|
'''(INTERNAL) I{Must be overloaded}.'''
|
|
258
|
-
|
|
258
|
+
self._notOverloaded(**self.kwds)
|
|
259
259
|
|
|
260
|
-
@_func.
|
|
260
|
+
@_func.setter_ # PYCHOK setter_underscore!
|
|
261
261
|
def _func(self, func):
|
|
262
|
-
_formy._Propy(
|
|
262
|
+
return _formy._Propy(func, 4, self.kwds)
|
|
263
263
|
|
|
264
264
|
@property_RO
|
|
265
265
|
def kwds(self):
|
|
@@ -382,14 +382,14 @@ class _FrechetMeterRadians(Frechet):
|
|
|
382
382
|
'''
|
|
383
383
|
return self._discrete(point2s, fraction, _formy._radistance(self))
|
|
384
384
|
|
|
385
|
-
@
|
|
385
|
+
@Property
|
|
386
386
|
def _func_(self):
|
|
387
387
|
'''(INTERNAL) I{Must be overloaded}.'''
|
|
388
|
-
|
|
388
|
+
self._notOverloaded(**self.kwds)
|
|
389
389
|
|
|
390
|
-
@_func_.
|
|
390
|
+
@_func_.setter_ # PYCHOK setter_underscore!
|
|
391
391
|
def _func_(self, func):
|
|
392
|
-
_formy._Propy(
|
|
392
|
+
return _formy._Propy(func, 3, self.kwds)
|
|
393
393
|
|
|
394
394
|
|
|
395
395
|
class FrechetCosineAndoyerLambert(_FrechetMeterRadians):
|
|
@@ -507,7 +507,7 @@ class FrechetEquirectangular(Frechet):
|
|
|
507
507
|
|
|
508
508
|
@kwarg fraction_name__adjust_limit_wrap: Optional C{B{fraction}=None}
|
|
509
509
|
and C{B{name}=NN} and keyword arguments for
|
|
510
|
-
function L{pygeodesy.
|
|
510
|
+
function L{pygeodesy.equirectangular} I{with
|
|
511
511
|
default} C{B{limit}=0} for I{backward compatibility}.
|
|
512
512
|
|
|
513
513
|
@see: L{Frechet.__init__} for details about B{C{point1s}}, B{C{fraction}},
|
pygeodesy/fsums.py
CHANGED
|
@@ -25,11 +25,11 @@ 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
31
|
from pygeodesy.errors import _OverflowError, _TypeError, _UnexpectedError, \
|
|
32
|
-
_ValueError, _xError, _xError2,
|
|
32
|
+
_ValueError, _xError, _xError2, _xkwds_get1, \
|
|
33
33
|
_xkwds_pop2
|
|
34
34
|
# from pygeodesy.internals import _enquote # from .basics
|
|
35
35
|
from pygeodesy.interns import NN, _arg_, _COMMASPACE_, _DASH_, _DOT_, \
|
|
@@ -40,14 +40,14 @@ from pygeodesy.lazily import _ALL_LAZY, _getenv, _sys_version_info2
|
|
|
40
40
|
from pygeodesy.named import _name__, _name2__, _Named, _NamedTuple, \
|
|
41
41
|
_NotImplemented
|
|
42
42
|
from pygeodesy.props import _allPropertiesOf_n, deprecated_property_RO, \
|
|
43
|
-
Property_RO, property_RO
|
|
43
|
+
Property, Property_RO, property_RO
|
|
44
44
|
from pygeodesy.streprs import Fmt, fstr, unstr
|
|
45
45
|
# from pygeodesy.units import Float, Int # from .constants
|
|
46
46
|
|
|
47
47
|
from math import ceil as _ceil, fabs, floor as _floor # PYCHOK used! .ltp
|
|
48
48
|
|
|
49
49
|
__all__ = _ALL_LAZY.fsums
|
|
50
|
-
__version__ = '24.05.
|
|
50
|
+
__version__ = '24.05.29'
|
|
51
51
|
|
|
52
52
|
_add_op_ = _PLUS_ # in .auxilats.auxAngle
|
|
53
53
|
_eq_op_ = _EQUAL_ * 2 # _DEQUAL_
|
|
@@ -1105,6 +1105,26 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1105
1105
|
# raise self._Error(op, other, _AssertionError, txt__=signOf)
|
|
1106
1106
|
return DivMod2Tuple(q, self) # q is C{int} in Python 3+, but C{float} in Python 2-
|
|
1107
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
|
+
|
|
1108
1128
|
def _finite(self, other, op=None):
|
|
1109
1129
|
'''(INTERNAL) Return B{C{other}} if C{finite}.
|
|
1110
1130
|
'''
|
|
@@ -1149,7 +1169,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1149
1169
|
'''
|
|
1150
1170
|
return Fsum2Tuple(*self._fint2, **name)
|
|
1151
1171
|
|
|
1152
|
-
@
|
|
1172
|
+
@Property
|
|
1153
1173
|
def _fint2(self): # see ._fset
|
|
1154
1174
|
'''(INTERNAL) Get 2-tuple (C{int}, I{integer} residual).
|
|
1155
1175
|
'''
|
|
@@ -1159,6 +1179,13 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1159
1179
|
r = self._ps_1sum(i) if r and n > 1 else float(s - i)
|
|
1160
1180
|
return i, (r or INT0) # Fsum2Tuple?
|
|
1161
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
|
+
|
|
1162
1189
|
@deprecated_property_RO
|
|
1163
1190
|
def float_int(self): # PYCHOK no cover
|
|
1164
1191
|
'''DEPRECATED, use method C{Fsum.int_float}.'''
|
|
@@ -1243,7 +1270,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1243
1270
|
f = self._pow(other, other, op, **raiser_RESIDUAL)
|
|
1244
1271
|
return self._fset(f) # n=max(len(self), 1)
|
|
1245
1272
|
|
|
1246
|
-
@
|
|
1273
|
+
@Property
|
|
1247
1274
|
def _fprs(self):
|
|
1248
1275
|
'''(INTERNAL) Get and cache this instance' precision
|
|
1249
1276
|
running sum (C{float} or C{int}), ignoring C{residual}.
|
|
@@ -1254,7 +1281,13 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1254
1281
|
s, _ = self._fprs2
|
|
1255
1282
|
return s # ._fprs2.fsum
|
|
1256
1283
|
|
|
1257
|
-
@
|
|
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
|
|
1258
1291
|
def _fprs2(self):
|
|
1259
1292
|
'''(INTERNAL) Get and cache this instance' precision
|
|
1260
1293
|
running sum and residual (L{Fsum2Tuple}).
|
|
@@ -1278,6 +1311,12 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1278
1311
|
# assert self._ps is ps
|
|
1279
1312
|
return Fsum2Tuple(s, r)
|
|
1280
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
|
+
|
|
1281
1320
|
def fset_(self, *xs):
|
|
1282
1321
|
'''Replace this instance' value with all positional items.
|
|
1283
1322
|
|
|
@@ -1310,27 +1349,22 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1310
1349
|
s = float(self._finite(other, **op)) if op else other
|
|
1311
1350
|
self._ps[:] = s,
|
|
1312
1351
|
self._n = n or 1
|
|
1313
|
-
if up:
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
self.
|
|
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
|
|
1319
1359
|
else: # PYCHOK no cover
|
|
1320
|
-
op =
|
|
1360
|
+
op = _xkwds_get1(op, op=_fset_op_)
|
|
1321
1361
|
raise self._Error(op, other, _TypeError)
|
|
1322
1362
|
return self
|
|
1323
1363
|
|
|
1324
|
-
def _fset_ps(self, other
|
|
1364
|
+
def _fset_ps(self, other): # in .fmath
|
|
1325
1365
|
'''(INTERNAL) Set partials from a known C{scalar}, L{Fsum} or L{Fsum2Tuple}.
|
|
1326
1366
|
'''
|
|
1327
|
-
|
|
1328
|
-
self._ps[:] = other._ps
|
|
1329
|
-
self._n = n or other._n
|
|
1330
|
-
else: # assert isscalar(other)
|
|
1331
|
-
self._ps[:] = other,
|
|
1332
|
-
self._n = n or 1
|
|
1333
|
-
return self
|
|
1367
|
+
return self._fset(other, up=False)
|
|
1334
1368
|
|
|
1335
1369
|
def fsub(self, xs=()):
|
|
1336
1370
|
'''Subtract an iterable's items from this instance.
|
|
@@ -1765,7 +1799,7 @@ class Fsum(_Named): # sync __methods__ with .vector3dBase.Vector3dBase
|
|
|
1765
1799
|
return self._pow_2_3(s, x, other, op, **raiser_RESIDUAL)
|
|
1766
1800
|
|
|
1767
1801
|
def _ps_acc(self, ps, xs, up=True, **unused):
|
|
1768
|
-
'''(INTERNAL) Accumulate C{xs} scalars into list C{ps}.
|
|
1802
|
+
'''(INTERNAL) Accumulate C{xs} known scalars into list C{ps}.
|
|
1769
1803
|
'''
|
|
1770
1804
|
n = 0
|
|
1771
1805
|
_2s = _2sum
|
|
@@ -2192,7 +2226,7 @@ def fsum_(*xs, **floats):
|
|
|
2192
2226
|
|
|
2193
2227
|
@see: Function L{fsum<fsums.fsum>} for further details.
|
|
2194
2228
|
'''
|
|
2195
|
-
return _fsum(xs if
|
|
2229
|
+
return _fsum(xs if _xkwds_get1(floats, floats=False) is True else
|
|
2196
2230
|
_2floats(xs, origin=1)) if xs else _0_0 # PYCHOK yield
|
|
2197
2231
|
|
|
2198
2232
|
|
|
@@ -2227,7 +2261,7 @@ def fsum1_(*xs, **floats):
|
|
|
2227
2261
|
|
|
2228
2262
|
@see: Function L{fsum_<fsums.fsum_>} for further details.
|
|
2229
2263
|
'''
|
|
2230
|
-
return _fsum(_1primed(xs if
|
|
2264
|
+
return _fsum(_1primed(xs if _xkwds_get1(floats, floats=False) is True else
|
|
2231
2265
|
_2floats(xs, origin=1))) if xs else _0_0 # PYCHOK yield
|
|
2232
2266
|
|
|
2233
2267
|
|
pygeodesy/geodesicx/__init__.py
CHANGED
pygeodesy/geodesicx/__main__.py
CHANGED
|
@@ -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.
|
|
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=
|
|
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)
|
pygeodesy/geodesicx/gx.py
CHANGED
|
@@ -62,7 +62,7 @@ from pygeodesy.utily import atan2d as _atan2d_reverse, _unrollon, _Wrap, wrap360
|
|
|
62
62
|
from math import atan2, copysign, cos, degrees, fabs, radians, sqrt
|
|
63
63
|
|
|
64
64
|
__all__ = ()
|
|
65
|
-
__version__ = '24.05.
|
|
65
|
+
__version__ = '24.05.31'
|
|
66
66
|
|
|
67
67
|
_MAXIT1 = 20
|
|
68
68
|
_MAXIT2 = 10 + _MAXIT1 + MANT_DIG # MANT_DIG == C++ digits
|
|
@@ -150,9 +150,7 @@ class GeodesicExact(_GeodesicBase):
|
|
|
150
150
|
@raise GeodesicError: Invalid B{C{C4order}}.
|
|
151
151
|
'''
|
|
152
152
|
if name_C4Order:
|
|
153
|
-
|
|
154
|
-
if C4Order: # for backward compatibility
|
|
155
|
-
self.C4order = C4Order
|
|
153
|
+
C4order, name = _xkwds_pop2(name_C4Order, C4Order=C4order)
|
|
156
154
|
if name:
|
|
157
155
|
self.name = name
|
|
158
156
|
else:
|
|
@@ -318,7 +316,7 @@ class GeodesicExact(_GeodesicBase):
|
|
|
318
316
|
def _C4(nC4):
|
|
319
317
|
i, n, cs = 0, self.n, _C4coeffs(nC4)
|
|
320
318
|
_p = _polynomial
|
|
321
|
-
for r in range(nC4 + 1, 1, -1):
|
|
319
|
+
for r in range(nC4 + 1, 1, -1): # _reverange
|
|
322
320
|
for j in range(1, r):
|
|
323
321
|
j = j + i # (j - i - 1) order of polynomial
|
|
324
322
|
yield _p(n, cs, i, j) / cs[j]
|
pygeodesy/geodsolve.py
CHANGED
|
@@ -26,7 +26,7 @@ from pygeodesy.solveBase import _SolveBase, _SolveLineBase
|
|
|
26
26
|
from pygeodesy.utily import _unrollon, _Wrap, wrap360
|
|
27
27
|
|
|
28
28
|
__all__ = _ALL_LAZY.geodsolve
|
|
29
|
-
__version__ = '24.05.
|
|
29
|
+
__version__ = '24.05.31'
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class GeodSolve12Tuple(_GTuple):
|
|
@@ -262,7 +262,7 @@ class GeodesicLineSolve(_GeodesicSolveBase, _SolveLineBase):
|
|
|
262
262
|
_xinstanceof(GeodesicSolve, geodesic=geodesic)
|
|
263
263
|
if (caps & Caps.LINE_OFF): # copy to avoid updates
|
|
264
264
|
geodesic = geodesic.copy(deep=False, name=_UNDER_(NN, geodesic.name)) # NOT _under!
|
|
265
|
-
_SolveLineBase.__init__(self, geodesic, lat1, lon1, caps,
|
|
265
|
+
_SolveLineBase.__init__(self, geodesic, lat1, lon1, caps, azi1=azi1, **name)
|
|
266
266
|
try:
|
|
267
267
|
self.GeodSolve = geodesic.GeodSolve # geodesic or copy of geodesic
|
|
268
268
|
except GeodesicError:
|