pygeodesy 24.9.29__py2.py3-none-any.whl → 24.10.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.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/METADATA +15 -15
- {PyGeodesy-24.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/RECORD +56 -56
- pygeodesy/__init__.py +20 -19
- pygeodesy/__main__.py +5 -5
- pygeodesy/albers.py +12 -17
- pygeodesy/basics.py +38 -41
- pygeodesy/booleans.py +54 -46
- pygeodesy/cartesianBase.py +2 -2
- pygeodesy/constants.py +20 -16
- pygeodesy/datums.py +3 -3
- pygeodesy/dms.py +250 -270
- pygeodesy/ellipsoidalBase.py +2 -2
- pygeodesy/ellipsoidalBaseDI.py +10 -10
- pygeodesy/ellipsoidalNvector.py +4 -4
- pygeodesy/ellipsoidalVincenty.py +2 -2
- pygeodesy/ellipsoids.py +7 -48
- pygeodesy/elliptic.py +14 -14
- pygeodesy/errors.py +15 -10
- pygeodesy/etm.py +18 -2
- pygeodesy/fmath.py +188 -176
- pygeodesy/formy.py +4 -4
- pygeodesy/fstats.py +54 -56
- pygeodesy/fsums.py +304 -266
- pygeodesy/geodesici.py +43 -40
- pygeodesy/geodesicw.py +3 -3
- pygeodesy/geodesicx/gxarea.py +3 -2
- pygeodesy/geodsolve.py +73 -24
- pygeodesy/geohash.py +2 -2
- pygeodesy/geoids.py +28 -27
- pygeodesy/internals.py +156 -85
- pygeodesy/interns.py +23 -20
- pygeodesy/karney.py +61 -12
- pygeodesy/latlonBase.py +13 -15
- pygeodesy/lazily.py +206 -214
- pygeodesy/mgrs.py +13 -13
- pygeodesy/named.py +11 -10
- pygeodesy/nvectorBase.py +1 -1
- pygeodesy/points.py +2 -2
- pygeodesy/props.py +34 -13
- pygeodesy/rhumb/bases.py +5 -5
- pygeodesy/rhumb/solve.py +7 -8
- pygeodesy/solveBase.py +7 -25
- pygeodesy/sphericalBase.py +20 -23
- pygeodesy/sphericalNvector.py +24 -23
- pygeodesy/sphericalTrigonometry.py +9 -8
- pygeodesy/streprs.py +11 -8
- pygeodesy/trf.py +6 -4
- pygeodesy/triaxials.py +46 -9
- pygeodesy/units.py +4 -3
- pygeodesy/ups.py +6 -6
- pygeodesy/utily.py +2 -2
- pygeodesy/utm.py +2 -2
- pygeodesy/vector3d.py +5 -5
- pygeodesy/vector3dBase.py +4 -5
- {PyGeodesy-24.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/top_level.txt +0 -0
pygeodesy/geodesici.py
CHANGED
|
@@ -38,11 +38,10 @@ from pygeodesy.errors import GeodesicError, IntersectionError, _an, \
|
|
|
38
38
|
# from pygeodesy.errors import exception_chaining # _MODS
|
|
39
39
|
from pygeodesy.fmath import euclid, fdot
|
|
40
40
|
from pygeodesy.fsums import Fsum, fsum1_, _ceil
|
|
41
|
-
from pygeodesy.interns import NN, _A_, _B_, _c_, _COMMASPACE_, \
|
|
42
|
-
|
|
43
|
-
from pygeodesy.karney import Caps, _diff182, GDict, _sincos2de
|
|
44
|
-
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
45
|
-
_getenv, _PYGEODESY_INTERSECTTOOL_
|
|
41
|
+
from pygeodesy.interns import NN, _A_, _B_, _c_, _COMMASPACE_, _HASH_, \
|
|
42
|
+
_M_, _not_, _SPACE_, _too_
|
|
43
|
+
from pygeodesy.karney import Caps, _diff182, GDict, _sincos2de, _Xables
|
|
44
|
+
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
46
45
|
from pygeodesy.named import ADict, _NamedBase, _NamedTuple, _Pass
|
|
47
46
|
# from pygeodesy.namedTuples import _LL4Tuple # _MODS
|
|
48
47
|
from pygeodesy.props import deprecated_method, Property, \
|
|
@@ -57,7 +56,7 @@ from pygeodesy.utily import sincos2, atan2, fabs, radians
|
|
|
57
56
|
# from math import atan2, ceil as _ceil, fabs, radians # .fsums, .utily
|
|
58
57
|
|
|
59
58
|
__all__ = _ALL_LAZY.geodesici
|
|
60
|
-
__version__ = '24.
|
|
59
|
+
__version__ = '24.10.22'
|
|
61
60
|
|
|
62
61
|
_0t = 0, # int
|
|
63
62
|
_1_1t = -1, +1
|
|
@@ -470,8 +469,8 @@ class Intersectool(_IntersectBase, _SolveCapsBase):
|
|
|
470
469
|
_Names_ABs = _latA_, _lonA_, 'latB', 'lonB', _sAB_ # -C to stderr
|
|
471
470
|
_Names_XDict = 'sA', 'sB', _c_ # plus 'k' from -i or 'sX0' from -R
|
|
472
471
|
_o_alt = _o__, # Offset latA lonA aziA latB lonB aziB x0 y0
|
|
473
|
-
_Xable_name =
|
|
474
|
-
_Xable_path =
|
|
472
|
+
_Xable_name = _Xables.IntersectTool.__name__
|
|
473
|
+
_Xable_path = _Xables.IntersectTool()
|
|
475
474
|
|
|
476
475
|
def __init__(self, a_geodesic=None, f=None, **name):
|
|
477
476
|
'''New L{IntersectTool}.
|
|
@@ -1547,7 +1546,7 @@ if __name__ == '__main__': # MCCABE 14
|
|
|
1547
1546
|
ll4 += ll4.replace(_A_, _B_)
|
|
1548
1547
|
llz = _SPACE_(NN, _latA_, _lonA_, 'aziA')
|
|
1549
1548
|
llz2 = llz + llz.replace(_A_, _B_)
|
|
1550
|
-
return dict(opts='-Verbose|V--version|v--help|h--Tool|T--Check|C-R meter
|
|
1549
|
+
return dict(opts='-Verbose|V--version|v--help|h--Tool|T--Check|C-R <meter>-',
|
|
1551
1550
|
alts=((_c_ + llz2),
|
|
1552
1551
|
(_i_ + ll4),
|
|
1553
1552
|
(_m_ + ll4),
|
|
@@ -1587,8 +1586,8 @@ if __name__ == '__main__': # MCCABE 14
|
|
|
1587
1586
|
I = Intersectool() # PYCHOK I
|
|
1588
1587
|
if _V:
|
|
1589
1588
|
I.verbose = True
|
|
1590
|
-
if I.IntersectTool
|
|
1591
|
-
I.IntersectTool =
|
|
1589
|
+
if not _Xables.X_OK(I.IntersectTool):
|
|
1590
|
+
I.IntersectTool = _Xables.IntersectTool(_Xables.bin_)
|
|
1592
1591
|
elif _V:
|
|
1593
1592
|
_ = I.version
|
|
1594
1593
|
M, _T = None, True
|
|
@@ -1640,38 +1639,42 @@ if __name__ == '__main__': # MCCABE 14
|
|
|
1640
1639
|
for i, X in enumerate(X):
|
|
1641
1640
|
printf(_COLONSPACE_(Fmt.INDEX(m, i), repr(X)))
|
|
1642
1641
|
|
|
1642
|
+
def _examples():
|
|
1643
|
+
|
|
1644
|
+
from pygeodesy.internals import _usage_argv
|
|
1645
|
+
|
|
1646
|
+
s = _SPACE_(*_usage_argv(__file__))
|
|
1647
|
+
for t in ('-h', '-h -n',
|
|
1648
|
+
'-c 0 0 45 40 10 135',
|
|
1649
|
+
'-C -c 0 0 45 40 10 135',
|
|
1650
|
+
'-T -R 2.6e7 -c 0 0 45 40 10 135',
|
|
1651
|
+
'-c 50 -4 -147.7 0 0 90',
|
|
1652
|
+
'-C -c 50 -4 -147.7 0 0 90',
|
|
1653
|
+
'# % echo 0 0 10 10 50 -4 50S 4W | IntersectTool -i -p 0 -C',
|
|
1654
|
+
'# -631414 5988887 0 -3',
|
|
1655
|
+
'# -4.05187 -4.00000 -4.05187 -4.00000 0',
|
|
1656
|
+
'-m 0 0 10 10 50 -4 50S 4W',
|
|
1657
|
+
'-C -m 0 0 10 10 50 -4 50S 4W',
|
|
1658
|
+
'-i 0 0 10 10 50 -4 50S 4W',
|
|
1659
|
+
'-T -i 0 0 10 10 50 -4 50S 4W',
|
|
1660
|
+
'-C -i 0 0 10 10 50 -4 50S 4W',
|
|
1661
|
+
'-T -C -i 0 0 10 10 50 -4 50S 4W',
|
|
1662
|
+
'-V -T -i 0 0 10 10 50 -4 -50 -4',
|
|
1663
|
+
'-C -R 4e7 -c 50 -4 -147.7 0 0 90',
|
|
1664
|
+
'-T -C -R 4e7 -c 50 -4 -147.7 0 0 90',
|
|
1665
|
+
'-R 4e7 -i 0 0 10 10 50 -4 -50 -4',
|
|
1666
|
+
'-T -R 4e7 -i 0 0 10 10 50 -4 -50 -4'):
|
|
1667
|
+
if t.startswith(_HASH_):
|
|
1668
|
+
printf(t, nl=int(t[2] == '%'))
|
|
1669
|
+
else:
|
|
1670
|
+
printf(_SPACE_(_HASH_, s, t), nl=1)
|
|
1671
|
+
argv[1:] = t = t.split()
|
|
1672
|
+
_main(t)
|
|
1673
|
+
|
|
1643
1674
|
from sys import argv, stderr
|
|
1644
1675
|
try:
|
|
1645
1676
|
if len(argv) == 2 and argv[1] == __help_:
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
s = _SPACE_(*_usage_argv(__file__))
|
|
1649
|
-
for t in ('-h', '-h -n',
|
|
1650
|
-
'-c 0 0 45 40 10 135',
|
|
1651
|
-
'-C -c 0 0 45 40 10 135',
|
|
1652
|
-
'-T -R 2.6e7 -c 0 0 45 40 10 135',
|
|
1653
|
-
'-c 50 -4 -147.7 0 0 90',
|
|
1654
|
-
'-C -c 50 -4 -147.7 0 0 90',
|
|
1655
|
-
'# % echo 0 0 10 10 50 -4 50S 4W | IntersectTool -i -p 0 -C',
|
|
1656
|
-
'# -631414 5988887 0 -3',
|
|
1657
|
-
'# -4.05187 -4.00000 -4.05187 -4.00000 0',
|
|
1658
|
-
'-m 0 0 10 10 50 -4 50S 4W',
|
|
1659
|
-
'-C -m 0 0 10 10 50 -4 50S 4W',
|
|
1660
|
-
'-i 0 0 10 10 50 -4 50S 4W',
|
|
1661
|
-
'-T -i 0 0 10 10 50 -4 50S 4W',
|
|
1662
|
-
'-C -i 0 0 10 10 50 -4 50S 4W',
|
|
1663
|
-
'-T -C -i 0 0 10 10 50 -4 50S 4W',
|
|
1664
|
-
'-V -T -i 0 0 10 10 50 -4 -50 -4',
|
|
1665
|
-
'-C -R 4e7 -c 50 -4 -147.7 0 0 90',
|
|
1666
|
-
'-T -C -R 4e7 -c 50 -4 -147.7 0 0 90',
|
|
1667
|
-
'-R 4e7 -i 0 0 10 10 50 -4 -50 -4',
|
|
1668
|
-
'-T -R 4e7 -i 0 0 10 10 50 -4 -50 -4'):
|
|
1669
|
-
if t.startswith(_HASH_):
|
|
1670
|
-
printf(t, nl=int(t[2] == '%'))
|
|
1671
|
-
else:
|
|
1672
|
-
printf(_SPACE_(_HASH_, s, t), nl=1)
|
|
1673
|
-
argv[1:] = t = t.split()
|
|
1674
|
-
_main(t)
|
|
1677
|
+
_examples()
|
|
1675
1678
|
else:
|
|
1676
1679
|
_main(argv[1:])
|
|
1677
1680
|
|
pygeodesy/geodesicw.py
CHANGED
|
@@ -21,7 +21,7 @@ from pygeodesy.datums import _earth_datum, _WGS84, _EWGS84
|
|
|
21
21
|
from pygeodesy.errors import _AssertionError, GeodesicError, \
|
|
22
22
|
IntersectionError
|
|
23
23
|
from pygeodesy.fsums import Fsum, Fmt, unstr
|
|
24
|
-
from pygeodesy.internals import
|
|
24
|
+
from pygeodesy.internals import _DUNDER_nameof, _under
|
|
25
25
|
from pygeodesy.interns import NN, _DOT_, _SPACE_, _to_, _too_
|
|
26
26
|
from pygeodesy.karney import _atan2d, Caps, Direct9Tuple, GDict, \
|
|
27
27
|
Inverse10Tuple, _kWrapped
|
|
@@ -39,7 +39,7 @@ from contextlib import contextmanager
|
|
|
39
39
|
# from math import fabs # from .utily
|
|
40
40
|
|
|
41
41
|
__all__ = _ALL_LAZY.geodesicw
|
|
42
|
-
__version__ = '24.
|
|
42
|
+
__version__ = '24.10.14'
|
|
43
43
|
|
|
44
44
|
_plumb_ = 'plumb'
|
|
45
45
|
_TRIPS = 65
|
|
@@ -516,7 +516,7 @@ def _Intersecant2(gl, lat0, lon0, radius, tol=_TOL, form=F_D): # MCCABE in LatL
|
|
|
516
516
|
# (INTERNAL) Return the intersections of a circle at C{lat0, lon0}
|
|
517
517
|
# and a geodesic line as a 2-Tuple C{(P, Q)}, each a C{GDict}.
|
|
518
518
|
r = Radius_(radius)
|
|
519
|
-
n =
|
|
519
|
+
n = _DUNDER_nameof(_Intersecant2)[1:]
|
|
520
520
|
_P = gl.Position
|
|
521
521
|
_I = gl.geodesic.Inverse
|
|
522
522
|
_a = fabs
|
pygeodesy/geodesicx/gxarea.py
CHANGED
|
@@ -19,10 +19,11 @@ from __future__ import division as _; del _ # PYCHOK semicolon
|
|
|
19
19
|
|
|
20
20
|
from pygeodesy.basics import isodd, unsigned0
|
|
21
21
|
from pygeodesy.constants import NAN, _0_0, _0_5, _720_0
|
|
22
|
+
from pygeodesy.internals import printf
|
|
22
23
|
# from pygeodesy.interns import _COMMASPACE_ # from .lazily
|
|
23
24
|
from pygeodesy.karney import Area3Tuple, _diff182, GeodesicError, \
|
|
24
25
|
_norm180, _remainder, _sum3
|
|
25
|
-
from pygeodesy.lazily import _ALL_DOCS,
|
|
26
|
+
from pygeodesy.lazily import _ALL_DOCS, _COMMASPACE_
|
|
26
27
|
from pygeodesy.named import ADict, callername, _NamedBase, pairs
|
|
27
28
|
from pygeodesy.props import Property, Property_RO, property_RO
|
|
28
29
|
# from pygeodesy.streprs import pairs # from .named
|
|
@@ -30,7 +31,7 @@ from pygeodesy.props import Property, Property_RO, property_RO
|
|
|
30
31
|
from math import fmod as _fmod
|
|
31
32
|
|
|
32
33
|
__all__ = ()
|
|
33
|
-
__version__ = '24.
|
|
34
|
+
__version__ = '24.10.14'
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
class GeodesicAreaExact(_NamedBase):
|
pygeodesy/geodsolve.py
CHANGED
|
@@ -14,9 +14,8 @@ from pygeodesy.basics import _xinstanceof
|
|
|
14
14
|
# from pygeodesy.geodesicx import GeodesicAreaExact # _MODS
|
|
15
15
|
from pygeodesy.interns import NN, _UNDER_
|
|
16
16
|
from pygeodesy.karney import Caps, GeodesicError, GeodSolve12Tuple, \
|
|
17
|
-
_sincos2d, _0_0, NAN
|
|
18
|
-
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
19
|
-
_getenv, _PYGEODESY_GEODSOLVE_
|
|
17
|
+
_sincos2d, _Xables, _0_0, NAN
|
|
18
|
+
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
20
19
|
from pygeodesy.named import _name1__
|
|
21
20
|
from pygeodesy.namedTuples import Destination3Tuple, Distance3Tuple
|
|
22
21
|
from pygeodesy.props import Property, Property_RO, property_RO
|
|
@@ -24,7 +23,7 @@ from pygeodesy.solveBase import _SolveGDictBase, _SolveGDictLineBase
|
|
|
24
23
|
from pygeodesy.utily import _unrollon, _Wrap, wrap360
|
|
25
24
|
|
|
26
25
|
__all__ = _ALL_LAZY.geodsolve
|
|
27
|
-
__version__ = '24.
|
|
26
|
+
__version__ = '24.10.14'
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
class _GeodesicSolveBase(_SolveGDictBase):
|
|
@@ -33,8 +32,8 @@ class _GeodesicSolveBase(_SolveGDictBase):
|
|
|
33
32
|
_Error = GeodesicError
|
|
34
33
|
_Names_Direct = \
|
|
35
34
|
_Names_Inverse = GeodSolve12Tuple._Names_
|
|
36
|
-
_Xable_name =
|
|
37
|
-
_Xable_path =
|
|
35
|
+
_Xable_name = _Xables.GeodSolve.__name__
|
|
36
|
+
_Xable_path = _Xables.GeodSolve()
|
|
38
37
|
|
|
39
38
|
@Property_RO
|
|
40
39
|
def _b_option(self):
|
|
@@ -396,30 +395,32 @@ __all__ += _ALL_DOCS(_GeodesicSolveBase)
|
|
|
396
395
|
|
|
397
396
|
if __name__ == '__main__':
|
|
398
397
|
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
def _main():
|
|
399
|
+
from pygeodesy import printf
|
|
400
|
+
from sys import argv
|
|
401
401
|
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
gS = GeodesicSolve(name='Test')
|
|
403
|
+
gS.verbose = '--verbose' in argv # or '-v' in argv
|
|
404
404
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
if not _Xables.X_OK(gS.GeodSolve): # not set
|
|
406
|
+
gS.GeodSolve = _Xables.GeodSolve(_Xables.bin_)
|
|
407
|
+
printf('version: %s', gS.version)
|
|
408
408
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
r = gS.Direct(40.6, -73.8, 51, 5.5e6)
|
|
410
|
+
printf('Direct: %r', r, nl=1)
|
|
411
|
+
printf('Direct3: %r', gS.Direct3(40.6, -73.8, 51, 5.5e6))
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
printf('Inverse: %r', gS.Inverse( 40.6, -73.8, 51.6, -0.5), nl=1)
|
|
414
|
+
printf('Inverse1: %r', gS.Inverse1(40.6, -73.8, 51.6, -0.5))
|
|
415
|
+
printf('Inverse3: %r', gS.Inverse3(40.6, -73.8, 51.6, -0.5))
|
|
416
416
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
417
|
+
glS = GeodesicLineSolve(gS, 40.6, -73.8, 51, name='LineTest')
|
|
418
|
+
p = glS.Position(5.5e6)
|
|
419
|
+
printf('Position: %5s %r', p == r, p, nl=1)
|
|
420
|
+
p = glS.ArcPosition(49.475527)
|
|
421
|
+
printf('ArcPosition: %5s %r', p == r, p)
|
|
422
422
|
|
|
423
|
+
_main()
|
|
423
424
|
|
|
424
425
|
# % python3 -m pygeodesy.geodsolve
|
|
425
426
|
|
|
@@ -436,6 +437,21 @@ if __name__ == '__main__':
|
|
|
436
437
|
# ArcPosition: False GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141174, m12=4844148.669561, M12=0.650911, M21=0.651229, s12=5499999.948497, S12=39735074737272.734375)
|
|
437
438
|
|
|
438
439
|
|
|
440
|
+
# % python3 -m pygeodesy.geodsolve
|
|
441
|
+
|
|
442
|
+
# version: /opt/local/bin/GeodSolve: GeographicLib version 2.3
|
|
443
|
+
|
|
444
|
+
# Direct: GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, m12=4844148.703101, M12=0.650911, M21=0.651229, s12=5500000.0, S12=39735075134877.078125)
|
|
445
|
+
# Direct3: Destination3Tuple(lat=51.884565, lon=-1.141173, final=107.189397)
|
|
446
|
+
|
|
447
|
+
# Inverse: GDict(a12=49.94131, azi1=51.198883, azi2=107.821777, lat1=40.6, lat2=51.6, lon1=-73.8, lon2=-0.5, m12=4877684.602706, M12=0.64473, M21=0.645046, s12=5551759.400319, S12=40041368848742.53125)
|
|
448
|
+
# Inverse1: 49.94131021789904
|
|
449
|
+
# Inverse3: Distance3Tuple(distance=5551759.400319, initial=51.198883, final=107.821777)
|
|
450
|
+
|
|
451
|
+
# Position: False GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, s12=5500000.0)
|
|
452
|
+
# ArcPosition: False GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141174, s12=5499999.948497)
|
|
453
|
+
|
|
454
|
+
|
|
439
455
|
# % python3 -m pygeodesy.geodsolve --verbose
|
|
440
456
|
|
|
441
457
|
# GeodesicSolve 'Test' 1: /opt/local/bin/GeodSolve --version (invoke)
|
|
@@ -462,6 +478,39 @@ if __name__ == '__main__':
|
|
|
462
478
|
# Position: True GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, m12=4844148.703101, M12=0.650911, M21=0.651229, s12=5500000.0, S12=39735075134877.09375)
|
|
463
479
|
# ArcPosition: False GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141174, m12=4844148.669561, M12=0.650911, M21=0.651229, s12=5499999.948497, S12=39735074737272.734375)
|
|
464
480
|
|
|
481
|
+
|
|
482
|
+
# % python3 -m pygeodesy.geodsolve --verbose
|
|
483
|
+
|
|
484
|
+
# GeodesicSolve 'Test'@1: /opt/local/bin/GeodSolve --version (invoke)
|
|
485
|
+
# GeodesicSolve 'Test'@1: '/opt/local/bin/GeodSolve: GeographicLib version 2.3' (0, stdout/-err)
|
|
486
|
+
# GeodesicSolve 'Test'@1: /opt/local/bin/GeodSolve: GeographicLib version 2.3 (0)
|
|
487
|
+
# version: /opt/local/bin/GeodSolve: GeographicLib version 2.3
|
|
488
|
+
# GeodesicSolve 'Test'@2: /opt/local/bin/GeodSolve -f -E -p 10 \ 40.600000000000001 -73.799999999999997 51.0 5500000.0 (Direct)
|
|
489
|
+
# GeodesicSolve 'Test'@2: '40.600000000000001 -73.799999999999997 51.000000000000000 51.884564505606761 -1.141172861200843 107.189397162605871 5500000.0000000000 49.475527463251460 4844148.7031014860 0.65091056699808614 0.65122865892196569 39735075134877.078' (0, stdout/-err)
|
|
490
|
+
# GeodesicSolve 'Test'@2: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.0, lat2=51.884564505606761, lon2=-1.141172861200843, azi2=107.189397162605871, s12=5500000.0, a12=49.47552746325146, m12=4844148.703101486, M12=0.65091056699808614, M21=0.65122865892196569, S12=39735075134877.078 (0)
|
|
491
|
+
|
|
492
|
+
# Direct: GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, m12=4844148.703101, M12=0.650911, M21=0.651229, s12=5500000.0, S12=39735075134877.078125)
|
|
493
|
+
# GeodesicSolve 'Test'@3: /opt/local/bin/GeodSolve -f -E -p 10 \ 40.600000000000001 -73.799999999999997 51.0 5500000.0 (Direct3)
|
|
494
|
+
# GeodesicSolve 'Test'@3: '40.600000000000001 -73.799999999999997 51.000000000000000 51.884564505606761 -1.141172861200843 107.189397162605871 5500000.0000000000 49.475527463251460 4844148.7031014860 0.65091056699808614 0.65122865892196569 39735075134877.078' (0, stdout/-err)
|
|
495
|
+
# GeodesicSolve 'Test'@3: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.0, lat2=51.884564505606761, lon2=-1.141172861200843, azi2=107.189397162605871, s12=5500000.0, a12=49.47552746325146, m12=4844148.703101486, M12=0.65091056699808614, M21=0.65122865892196569, S12=39735075134877.078 (0)
|
|
496
|
+
# Direct3: Destination3Tuple(lat=51.884565, lon=-1.141173, final=107.189397)
|
|
497
|
+
# GeodesicSolve 'Test'@4: /opt/local/bin/GeodSolve -f -E -p 10 -i \ 40.600000000000001 -73.799999999999997 51.600000000000001 -0.5 (Inverse)
|
|
498
|
+
# GeodesicSolve 'Test'@4: '40.600000000000001 -73.799999999999997 51.198882845579824 51.600000000000001 -0.500000000000000 107.821776735514248 5551759.4003186813 49.941310217899037 4877684.6027061967 0.64472969205948238 0.64504567852134398 40041368848742.531' (0, stdout/-err)
|
|
499
|
+
# GeodesicSolve 'Test'@4: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.198882845579824, lat2=51.600000000000001, lon2=-0.5, azi2=107.821776735514248, s12=5551759.4003186813, a12=49.941310217899037, m12=4877684.6027061967, M12=0.64472969205948238, M21=0.64504567852134398, S12=40041368848742.531 (0)
|
|
500
|
+
|
|
501
|
+
# Inverse: GDict(a12=49.94131, azi1=51.198883, azi2=107.821777, lat1=40.6, lat2=51.6, lon1=-73.8, lon2=-0.5, m12=4877684.602706, M12=0.64473, M21=0.645046, s12=5551759.400319, S12=40041368848742.53125)
|
|
502
|
+
# GeodesicSolve 'Test'@5: /opt/local/bin/GeodSolve -f -E -p 10 -i \ 40.600000000000001 -73.799999999999997 51.600000000000001 -0.5 (Inverse1)
|
|
503
|
+
# GeodesicSolve 'Test'@5: '40.600000000000001 -73.799999999999997 51.198882845579824 51.600000000000001 -0.500000000000000 107.821776735514248 5551759.4003186813 49.941310217899037 4877684.6027061967 0.64472969205948238 0.64504567852134398 40041368848742.531' (0, stdout/-err)
|
|
504
|
+
# GeodesicSolve 'Test'@5: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.198882845579824, lat2=51.600000000000001, lon2=-0.5, azi2=107.821776735514248, s12=5551759.4003186813, a12=49.941310217899037, m12=4877684.6027061967, M12=0.64472969205948238, M21=0.64504567852134398, S12=40041368848742.531 (0)
|
|
505
|
+
# Inverse1: 49.94131021789904
|
|
506
|
+
# GeodesicSolve 'Test'@6: /opt/local/bin/GeodSolve -f -E -p 10 -i \ 40.600000000000001 -73.799999999999997 51.600000000000001 -0.5 (Inverse3)
|
|
507
|
+
# GeodesicSolve 'Test'@6: '40.600000000000001 -73.799999999999997 51.198882845579824 51.600000000000001 -0.500000000000000 107.821776735514248 5551759.4003186813 49.941310217899037 4877684.6027061967 0.64472969205948238 0.64504567852134398 40041368848742.531' (0, stdout/-err)
|
|
508
|
+
# GeodesicSolve 'Test'@6: lat1=40.600000000000001, lon1=-73.799999999999997, azi1=51.198882845579824, lat2=51.600000000000001, lon2=-0.5, azi2=107.821776735514248, s12=5551759.4003186813, a12=49.941310217899037, m12=4877684.6027061967, M12=0.64472969205948238, M21=0.64504567852134398, S12=40041368848742.531 (0)
|
|
509
|
+
# Inverse3: Distance3Tuple(distance=5551759.400319, initial=51.198883, final=107.821777)
|
|
510
|
+
|
|
511
|
+
# Position: False GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141173, s12=5500000.0)
|
|
512
|
+
# ArcPosition: False GDict(a12=49.475527, azi1=51.0, azi2=107.189397, lat1=40.6, lat2=51.884565, lon1=-73.8, lon2=-1.141174, s12=5499999.948497)
|
|
513
|
+
|
|
465
514
|
# **) MIT License
|
|
466
515
|
#
|
|
467
516
|
# Copyright (C) 2016-2024 -- mrJean1 at Gmail -- All Rights Reserved.
|
pygeodesy/geohash.py
CHANGED
|
@@ -7,7 +7,7 @@ Class L{Geohash} and several functions to encode, decode and inspect
|
|
|
7
7
|
C{geohashes} and optional L{Geohashed} caches.
|
|
8
8
|
|
|
9
9
|
Originally transcoded from JavaScript originals by I{(C) Chris Veness
|
|
10
|
-
2011-
|
|
10
|
+
2011-2024} and published under the same MIT Licence**, see
|
|
11
11
|
U{Geohashes<https://www.Movable-Type.co.UK/scripts/geohash.html>}.
|
|
12
12
|
|
|
13
13
|
@see: U{Geohash<https://WikiPedia.org/wiki/Geohash>}, I{Karney}'s C++
|
|
@@ -38,7 +38,7 @@ from pygeodesy.units import Degrees_, Int, Lat_, Lon_, Meter, Precision_, Str
|
|
|
38
38
|
from math import fabs, ldexp, log10, radians
|
|
39
39
|
|
|
40
40
|
__all__ = _ALL_LAZY.geohash
|
|
41
|
-
__version__ = '24.
|
|
41
|
+
__version__ = '24.10.12'
|
|
42
42
|
|
|
43
43
|
_formy = _MODS.into(formy=__name__)
|
|
44
44
|
_MASK5 = 16, 8, 4, 2, 1 # PYCHOK used!
|
pygeodesy/geoids.py
CHANGED
|
@@ -106,9 +106,9 @@ from pygeodesy.streprs import attrs, Fmt, fstr, pairs
|
|
|
106
106
|
from pygeodesy.units import Height, Int_, Lat, Lon
|
|
107
107
|
# from pygeodesy.utily import _Wrap # from .heights
|
|
108
108
|
|
|
109
|
-
from math import floor
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
from math import floor as _floor
|
|
110
|
+
# from os import SEEK_CUR, SEEK_SET # _MODS
|
|
111
|
+
# import os.path # _MODS
|
|
112
112
|
from struct import calcsize as _calcsize, unpack as _unpack
|
|
113
113
|
try:
|
|
114
114
|
from StringIO import StringIO as _BytesIO # reads bytes
|
|
@@ -118,7 +118,7 @@ except ImportError: # Python 3+
|
|
|
118
118
|
from io import BytesIO as _BytesIO # PYCHOK expected
|
|
119
119
|
|
|
120
120
|
__all__ = _ALL_LAZY.geoids
|
|
121
|
-
__version__ = '24.
|
|
121
|
+
__version__ = '24.10.11'
|
|
122
122
|
|
|
123
123
|
_assert_ = 'assert'
|
|
124
124
|
_bHASH_ = b'#'
|
|
@@ -463,7 +463,7 @@ class _GeoidBase(_HeightBase):
|
|
|
463
463
|
|
|
464
464
|
def _load(self, g, dtype, n, offset=0):
|
|
465
465
|
# numpy.fromfile, like .frombuffer
|
|
466
|
-
g.seek(offset,
|
|
466
|
+
g.seek(offset, _MODS.os.SEEK_SET)
|
|
467
467
|
return self.numpy.fromfile(g, dtype, n)
|
|
468
468
|
|
|
469
469
|
@Property_RO
|
|
@@ -545,8 +545,8 @@ class _GeoidBase(_HeightBase):
|
|
|
545
545
|
def _open(self, geoid, datum, kind, name, smooth):
|
|
546
546
|
# open the geoid file
|
|
547
547
|
try:
|
|
548
|
-
self._geoid =
|
|
549
|
-
self._sizeB =
|
|
548
|
+
self._geoid = _MODS.os.path.basename(geoid)
|
|
549
|
+
self._sizeB = _MODS.os.path.getsize(geoid)
|
|
550
550
|
g = open(geoid, _rb_)
|
|
551
551
|
except (IOError, OSError) as x:
|
|
552
552
|
raise GeoidError(geoid=geoid, cause=x)
|
|
@@ -988,21 +988,21 @@ class GeoidKarney(_GeoidBase):
|
|
|
988
988
|
p = self._pgm
|
|
989
989
|
if 0 < x < (p.nlon - 2) and 0 < y < (p.nlat - 2):
|
|
990
990
|
# read 4x4 ushorts, drop the 4 corners
|
|
991
|
-
|
|
992
|
-
e =
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
b =
|
|
991
|
+
S = _MODS.os.SEEK_SET
|
|
992
|
+
e = self._4endian
|
|
993
|
+
g = self._egm
|
|
994
|
+
n = self._4u2B
|
|
995
|
+
R = self._Ru2B
|
|
996
|
+
b = self._seek(y - 1, x - 1)
|
|
997
997
|
v = _unpack(e, g.read(n))[1:3]
|
|
998
998
|
b += R
|
|
999
|
-
g.seek(b,
|
|
999
|
+
g.seek(b, S)
|
|
1000
1000
|
v += _unpack(e, g.read(n))
|
|
1001
1001
|
b += R
|
|
1002
|
-
g.seek(b,
|
|
1002
|
+
g.seek(b, S)
|
|
1003
1003
|
v += _unpack(e, g.read(n))
|
|
1004
1004
|
b += R
|
|
1005
|
-
g.seek(b,
|
|
1005
|
+
g.seek(b, S)
|
|
1006
1006
|
v += _unpack(e, g.read(n))[1:3]
|
|
1007
1007
|
j = 1
|
|
1008
1008
|
|
|
@@ -1021,7 +1021,7 @@ class GeoidKarney(_GeoidBase):
|
|
|
1021
1021
|
def _ev(self, lat, lon): # PYCHOK expected
|
|
1022
1022
|
# interpolate the geoid height at grid (lat, lon)
|
|
1023
1023
|
fy, fx = self._g2yx2(lat, lon)
|
|
1024
|
-
y, x = int(
|
|
1024
|
+
y, x = int(_floor(fy)), int(_floor(fx))
|
|
1025
1025
|
fy -= y
|
|
1026
1026
|
fx -= x
|
|
1027
1027
|
H = self._ev2d(fy, fx, y, x) # PYCHOK ._ev2k or ._ev3k
|
|
@@ -1223,7 +1223,7 @@ class GeoidKarney(_GeoidBase):
|
|
|
1223
1223
|
p, g = self._pgm, self._egm
|
|
1224
1224
|
if g:
|
|
1225
1225
|
b = p.skip + (y * p.nlon + x) * self._u2B
|
|
1226
|
-
g.seek(b,
|
|
1226
|
+
g.seek(b, _MODS.os.SEEK_SET)
|
|
1227
1227
|
return b # position
|
|
1228
1228
|
raise GeoidError('closed file', txt=repr(p.egm)) # IOError
|
|
1229
1229
|
|
|
@@ -1551,11 +1551,11 @@ class _PGM(_Gpars):
|
|
|
1551
1551
|
t, c = 0, self._tmpfile()
|
|
1552
1552
|
# reading (s - n) rows, forward
|
|
1553
1553
|
for y in range(n, s): # PYCHOK y unused
|
|
1554
|
-
g.seek(z,
|
|
1554
|
+
g.seek(z, _MODS.os.SEEK_SET)
|
|
1555
1555
|
# Python 2 tmpfile.write returns None
|
|
1556
1556
|
t += c.write(g.read(r)) or r
|
|
1557
1557
|
if p: # wrap around to start of row
|
|
1558
|
-
g.seek(-q,
|
|
1558
|
+
g.seek(-q, _MODS.os.SEEK_CUR)
|
|
1559
1559
|
# assert(g.tell() == (z - w * self.u2B))
|
|
1560
1560
|
# Python 2 tmpfile.write returns None
|
|
1561
1561
|
t += c.write(g.read(p)) or p
|
|
@@ -1582,7 +1582,7 @@ class _PGM(_Gpars):
|
|
|
1582
1582
|
self.knots = k
|
|
1583
1583
|
self.skip = 0 # no header lines in c
|
|
1584
1584
|
|
|
1585
|
-
c.seek(0,
|
|
1585
|
+
c.seek(0, _MODS.os.SEEK_SET)
|
|
1586
1586
|
# c = open(c.name, _rb_) # reopen for numpy 1.8.0-
|
|
1587
1587
|
return c
|
|
1588
1588
|
|
|
@@ -1606,10 +1606,11 @@ class _PGM(_Gpars):
|
|
|
1606
1606
|
try:
|
|
1607
1607
|
from tempfile import NamedTemporaryFile as tmpfile
|
|
1608
1608
|
except ImportError: # Python 2.7.16-
|
|
1609
|
-
from os import tmpfile
|
|
1610
|
-
t =
|
|
1611
|
-
|
|
1612
|
-
f
|
|
1609
|
+
from _MODS.os import tmpfile
|
|
1610
|
+
t = _MODS.os.path.basename(self.pgm)
|
|
1611
|
+
t = _MODS.os.path.splitext(t)[0]
|
|
1612
|
+
f = tmpfile(mode='w+b', prefix=t or 'egm')
|
|
1613
|
+
f.seek(0, _MODS.os.SEEK_SET) # force overwrite
|
|
1613
1614
|
return f
|
|
1614
1615
|
|
|
1615
1616
|
@Property_RO
|
|
@@ -1649,7 +1650,7 @@ def egmGeoidHeights(GeoidHeights_dat):
|
|
|
1649
1650
|
dat = _BytesIO(dat)
|
|
1650
1651
|
|
|
1651
1652
|
try:
|
|
1652
|
-
dat.seek(0,
|
|
1653
|
+
dat.seek(0, _MODS.os.SEEK_SET) # reset
|
|
1653
1654
|
except AttributeError as x:
|
|
1654
1655
|
raise GeoidError(GeoidHeights_dat=type(dat), cause=x)
|
|
1655
1656
|
|
|
@@ -1666,7 +1667,7 @@ __all__ += _ALL_DOCS(_GeoidBase)
|
|
|
1666
1667
|
|
|
1667
1668
|
if __name__ == '__main__': # MCCABE 14
|
|
1668
1669
|
|
|
1669
|
-
from pygeodesy.internals import printf, _secs2str, _sys
|
|
1670
|
+
from pygeodesy.internals import printf, _secs2str, _versions, _sys
|
|
1670
1671
|
from time import time
|
|
1671
1672
|
|
|
1672
1673
|
_crop = ()
|