pygeodesy 24.10.24__py2.py3-none-any.whl → 24.12.12__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.10.24.dist-info → PyGeodesy-24.12.12.dist-info}/METADATA +6 -6
- PyGeodesy-24.12.12.dist-info/RECORD +118 -0
- {PyGeodesy-24.10.24.dist-info → PyGeodesy-24.12.12.dist-info}/WHEEL +1 -1
- pygeodesy/__init__.py +5 -5
- pygeodesy/__main__.py +1 -1
- pygeodesy/albers.py +5 -5
- pygeodesy/auxilats/_CX_4.py +1 -1
- pygeodesy/auxilats/_CX_6.py +1 -1
- pygeodesy/auxilats/_CX_8.py +1 -1
- pygeodesy/auxilats/_CX_Rs.py +1 -1
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/__main__.py +1 -1
- pygeodesy/auxilats/auxAngle.py +5 -5
- pygeodesy/auxilats/auxDLat.py +6 -6
- pygeodesy/auxilats/auxDST.py +2 -2
- pygeodesy/auxilats/auxLat.py +5 -5
- pygeodesy/auxilats/auxily.py +2 -2
- pygeodesy/azimuthal.py +55 -65
- pygeodesy/basics.py +35 -34
- pygeodesy/booleans.py +37 -37
- pygeodesy/cartesianBase.py +26 -65
- pygeodesy/clipy.py +1 -1
- pygeodesy/constants.py +7 -7
- pygeodesy/css.py +8 -9
- pygeodesy/datums.py +1 -1
- pygeodesy/deprecated/__init__.py +2 -2
- pygeodesy/deprecated/bases.py +1 -1
- pygeodesy/deprecated/classes.py +10 -10
- pygeodesy/deprecated/consterns.py +1 -1
- pygeodesy/deprecated/datum.py +1 -1
- pygeodesy/deprecated/functions.py +23 -13
- pygeodesy/deprecated/nvector.py +1 -1
- pygeodesy/deprecated/rhumbBase.py +1 -1
- pygeodesy/deprecated/rhumbaux.py +1 -1
- pygeodesy/deprecated/rhumbsolve.py +1 -1
- pygeodesy/deprecated/rhumbx.py +1 -1
- pygeodesy/dms.py +1 -1
- pygeodesy/ecef.py +63 -69
- pygeodesy/elevations.py +1 -1
- pygeodesy/ellipsoidalBase.py +106 -121
- pygeodesy/ellipsoidalBaseDI.py +115 -119
- pygeodesy/ellipsoidalExact.py +36 -38
- pygeodesy/ellipsoidalGeodSolve.py +1 -1
- pygeodesy/ellipsoidalKarney.py +1 -1
- pygeodesy/ellipsoidalNvector.py +1 -1
- pygeodesy/ellipsoidalVincenty.py +6 -5
- pygeodesy/ellipsoids.py +7 -8
- pygeodesy/elliptic.py +6 -6
- pygeodesy/epsg.py +1 -1
- pygeodesy/errors.py +25 -25
- pygeodesy/etm.py +84 -76
- pygeodesy/fmath.py +54 -51
- pygeodesy/formy.py +74 -106
- pygeodesy/frechet.py +1 -1
- pygeodesy/fstats.py +1 -1
- pygeodesy/fsums.py +82 -72
- pygeodesy/gars.py +1 -1
- pygeodesy/geodesici.py +4 -4
- pygeodesy/geodesicw.py +16 -15
- pygeodesy/geodesicx/_C4_24.py +2 -2
- pygeodesy/geodesicx/_C4_27.py +2 -2
- pygeodesy/geodesicx/_C4_30.py +2 -2
- pygeodesy/geodesicx/__init__.py +3 -3
- pygeodesy/geodesicx/__main__.py +1 -1
- pygeodesy/geodesicx/gx.py +6 -5
- pygeodesy/geodesicx/gxarea.py +2 -2
- pygeodesy/geodesicx/gxbases.py +2 -2
- pygeodesy/geodesicx/gxline.py +16 -12
- pygeodesy/geodsolve.py +8 -17
- pygeodesy/geohash.py +1 -1
- pygeodesy/geoids.py +6 -6
- pygeodesy/hausdorff.py +1 -1
- pygeodesy/heights.py +3 -3
- pygeodesy/internals.py +64 -80
- pygeodesy/interns.py +2 -3
- pygeodesy/iters.py +1 -1
- pygeodesy/karney.py +4 -4
- pygeodesy/ktm.py +20 -21
- pygeodesy/latlonBase.py +296 -346
- pygeodesy/lazily.py +15 -15
- pygeodesy/lcc.py +5 -5
- pygeodesy/ltp.py +55 -59
- pygeodesy/ltpTuples.py +208 -192
- pygeodesy/mgrs.py +9 -10
- pygeodesy/named.py +153 -3
- pygeodesy/namedTuples.py +58 -7
- pygeodesy/nvectorBase.py +122 -105
- pygeodesy/osgr.py +10 -13
- pygeodesy/points.py +1 -1
- pygeodesy/props.py +3 -3
- pygeodesy/resections.py +26 -26
- pygeodesy/rhumb/__init__.py +2 -2
- pygeodesy/rhumb/aux_.py +2 -2
- pygeodesy/rhumb/bases.py +2 -2
- pygeodesy/rhumb/ekx.py +4 -4
- pygeodesy/rhumb/solve.py +4 -4
- pygeodesy/simplify.py +291 -403
- pygeodesy/solveBase.py +1 -1
- pygeodesy/sphericalBase.py +1 -1
- pygeodesy/sphericalNvector.py +84 -127
- pygeodesy/sphericalTrigonometry.py +66 -71
- pygeodesy/streprs.py +10 -5
- pygeodesy/trf.py +1 -1
- pygeodesy/triaxials.py +23 -16
- pygeodesy/units.py +17 -17
- pygeodesy/unitsBase.py +1 -1
- pygeodesy/ups.py +4 -4
- pygeodesy/utily.py +202 -145
- pygeodesy/utm.py +10 -10
- pygeodesy/utmups.py +1 -1
- pygeodesy/utmupsBase.py +1 -1
- pygeodesy/vector2d.py +17 -17
- pygeodesy/vector3d.py +32 -23
- pygeodesy/vector3dBase.py +22 -19
- pygeodesy/webmercator.py +5 -5
- pygeodesy/wgrs.py +5 -5
- PyGeodesy-24.10.24.dist-info/RECORD +0 -118
- {PyGeodesy-24.10.24.dist-info → PyGeodesy-24.12.12.dist-info}/top_level.txt +0 -0
pygeodesy/formy.py
CHANGED
|
@@ -6,12 +6,12 @@ u'''Formulary of basic geodesy functions and approximations.
|
|
|
6
6
|
# make sure int/int division yields float quotient, see .basics
|
|
7
7
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
8
8
|
|
|
9
|
-
# from pygeodesy.basics import
|
|
9
|
+
# from pygeodesy.basics import _args_kwds_count2, _copysign # from .constants
|
|
10
10
|
# from pygeodesy.cartesianBase import CartesianBase # _MODS
|
|
11
11
|
from pygeodesy.constants import EPS, EPS0, EPS1, PI, PI2, PI3, PI_2, R_M, \
|
|
12
12
|
_0_0s, float0_, isnon0, remainder, _umod_PI2, \
|
|
13
13
|
_0_0, _0_125, _0_25, _0_5, _1_0, _2_0, _4_0, \
|
|
14
|
-
_32_0, _90_0, _180_0, _360_0
|
|
14
|
+
_32_0, _90_0, _180_0, _360_0, _copysign
|
|
15
15
|
from pygeodesy.datums import Datum, Ellipsoid, _ellipsoidal_datum, \
|
|
16
16
|
_mean_radius, _spherical_datum, _WGS84, _EWGS84
|
|
17
17
|
# from pygeodesy.ellipsoids import Ellipsoid, _EWGS84 # from .datums
|
|
@@ -26,30 +26,47 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
|
|
|
26
26
|
from pygeodesy.named import _name__, _name2__, _NamedTuple, _xnamed, \
|
|
27
27
|
_DUNDER_nameof
|
|
28
28
|
from pygeodesy.namedTuples import Bearing2Tuple, Distance4Tuple, LatLon2Tuple, \
|
|
29
|
-
Intersection3Tuple, PhiLam2Tuple
|
|
29
|
+
Intersection3Tuple, PhiLam2Tuple
|
|
30
30
|
# from pygeodesy.streprs import Fmt, unstr # from .fsums
|
|
31
31
|
# from pygeodesy.triaxials import _hartzell3 # _MODS
|
|
32
|
-
from pygeodesy.units import _isHeight, _isRadius, Bearing, Degrees_,
|
|
33
|
-
Distance_, Height, Lamd, Lat, Lon, Meter_,
|
|
34
|
-
Radians, Radians_, Radius, Radius_, Scalar, _100km
|
|
35
|
-
from pygeodesy.utily import acos1,
|
|
36
|
-
tan_2, sincos2, sincos2_,
|
|
32
|
+
from pygeodesy.units import _isDegrees, _isHeight, _isRadius, Bearing, Degrees_, \
|
|
33
|
+
Distance, Distance_, Height, Lamd, Lat, Lon, Meter_, \
|
|
34
|
+
Phid, Radians, Radians_, Radius, Radius_, Scalar, _100km
|
|
35
|
+
from pygeodesy.utily import acos1, atan2, atan2b, degrees2m, _loneg, m2degrees, \
|
|
36
|
+
tan_2, sincos2, sincos2_, _Wrap
|
|
37
37
|
# from pygeodesy.vector3d import _otherV3d # _MODS
|
|
38
38
|
# from pygeodesy.vector3dBase import _xyz_y_z3 # _MODS
|
|
39
39
|
# from pygeodesy import ellipsoidalExact, ellipsoidalKarney, vector3d, \
|
|
40
40
|
# sphericalNvector, sphericalTrigonometry # _MODS
|
|
41
41
|
|
|
42
42
|
from contextlib import contextmanager
|
|
43
|
-
from math import asin, atan,
|
|
43
|
+
from math import asin, atan, cos, degrees, fabs, radians, sin, sqrt # pow
|
|
44
44
|
|
|
45
45
|
__all__ = _ALL_LAZY.formy
|
|
46
|
-
__version__ = '24.
|
|
46
|
+
__version__ = '24.12.06'
|
|
47
47
|
|
|
48
48
|
_RADIANS2 = (PI / _180_0)**2 # degrees- to radians-squared
|
|
49
49
|
_ratio_ = 'ratio'
|
|
50
50
|
_xline_ = 'xline'
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
def angle2chord(rad, radius=R_M):
|
|
54
|
+
'''Get the chord length of a (central) angle or I{angular} distance.
|
|
55
|
+
|
|
56
|
+
@arg rad: Central angle (C{radians}).
|
|
57
|
+
@kwarg radius: Mean earth radius (C{meter}, conventionally), datum (L{Datum}) or ellipsoid
|
|
58
|
+
(L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}) to use or C{None}.
|
|
59
|
+
|
|
60
|
+
@return: Chord length (C{meter}, same units as B{C{radius}} or if C{B{radius} is None}, C{radians}).
|
|
61
|
+
|
|
62
|
+
@see: Function L{chord2angle}, method L{intermediateChordTo<sphericalNvector.LatLon.intermediateChordTo>} and
|
|
63
|
+
U{great-circle-distance<https://WikiPedia.org/wiki/Great-circle_distance#Relation_between_central_angle_and_chord_length>}.
|
|
64
|
+
'''
|
|
65
|
+
d = _isDegrees(rad, iscalar=False)
|
|
66
|
+
r = sin((radians(rad) if d else rad) / _2_0) * _2_0
|
|
67
|
+
return (degrees(r) if d else r) if radius is None else (_mean_radius(radius) * r)
|
|
68
|
+
|
|
69
|
+
|
|
53
70
|
def _anti2(a, b, n_2, n, n2):
|
|
54
71
|
'''(INTERNAL) Helper for C{antipode} and C{antipode_}.
|
|
55
72
|
'''
|
|
@@ -161,6 +178,30 @@ def _bearingTo2(p1, p2, wrap=False): # for points.ispolar, sphericalTrigonometr
|
|
|
161
178
|
name__=_bearingTo2)
|
|
162
179
|
|
|
163
180
|
|
|
181
|
+
def chord2angle(chord, radius=R_M):
|
|
182
|
+
'''Get the (central) angle from a chord length or distance.
|
|
183
|
+
|
|
184
|
+
@arg chord: Length or distance (C{meter}, same units as B{C{radius}}).
|
|
185
|
+
@kwarg radius: Mean earth radius (C{meter}, conventionally), datum (L{Datum}) or
|
|
186
|
+
ellipsoid (L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}) to use.
|
|
187
|
+
|
|
188
|
+
@return: Angle (C{radians} with sign of B{C{chord}}) or C{0} if C{B{radius}=0}.
|
|
189
|
+
|
|
190
|
+
@note: The angle will exceed C{PI} if C{B{chord} > B{radius} * 2}.
|
|
191
|
+
|
|
192
|
+
@see: Function L{angle2chord}.
|
|
193
|
+
'''
|
|
194
|
+
m = _mean_radius(radius)
|
|
195
|
+
r = fabs(chord / (m * _2_0)) if m > 0 else _0_0
|
|
196
|
+
if r:
|
|
197
|
+
i = int(r)
|
|
198
|
+
if i > 0:
|
|
199
|
+
r -= i
|
|
200
|
+
i *= PI
|
|
201
|
+
r = asin(r) + i
|
|
202
|
+
return _copysign(r * _2_0, chord)
|
|
203
|
+
|
|
204
|
+
|
|
164
205
|
def compassAngle(lat1, lon1, lat2, lon2, adjust=True, wrap=False):
|
|
165
206
|
'''Return the angle from North for the direction vector M{(lon2 - lon1,
|
|
166
207
|
lat2 - lat1)} between two points.
|
|
@@ -424,7 +465,7 @@ def _ellipsoidal(earth, where):
|
|
|
424
465
|
|
|
425
466
|
|
|
426
467
|
def equirectangular(lat1, lon1, lat2, lon2, radius=R_M, **adjust_limit_wrap):
|
|
427
|
-
'''
|
|
468
|
+
'''Approximate the distance between two points using the U{Equirectangular Approximation
|
|
428
469
|
/ Projection<https://www.Movable-Type.co.UK/scripts/latlong.html#equirectangular>}.
|
|
429
470
|
|
|
430
471
|
@arg lat1: Start latitude (C{degrees}).
|
|
@@ -449,14 +490,14 @@ def equirectangular(lat1, lon1, lat2, lon2, radius=R_M, **adjust_limit_wrap):
|
|
|
449
490
|
|
|
450
491
|
|
|
451
492
|
def _equirectangular(lat1, lon1, lat2, lon2, **adjust_limit_wrap):
|
|
452
|
-
'''(INTERNAL) Helper for
|
|
453
|
-
|
|
493
|
+
'''(INTERNAL) Helper for classes L{frechet._FrechetMeterRadians} and
|
|
494
|
+
L{hausdorff._HausdorffMeterRedians}.
|
|
454
495
|
'''
|
|
455
496
|
return equirectangular4(lat1, lon1, lat2, lon2, **adjust_limit_wrap).distance2 * _RADIANS2
|
|
456
497
|
|
|
457
498
|
|
|
458
499
|
def equirectangular4(lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False):
|
|
459
|
-
'''
|
|
500
|
+
'''Approximate the distance between two points using the U{Equirectangular Approximation
|
|
460
501
|
/ Projection<https://www.Movable-Type.co.UK/scripts/latlong.html#equirectangular>}.
|
|
461
502
|
|
|
462
503
|
This approximation is valid for short distance of several hundred Km or Miles, see
|
|
@@ -473,10 +514,10 @@ def equirectangular4(lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False):
|
|
|
473
514
|
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll B{C{lat2}} and B{C{lon2}}
|
|
474
515
|
(C{bool}).
|
|
475
516
|
|
|
476
|
-
@return: A L{Distance4Tuple}C{(distance2, delta_lat, delta_lon, unroll_lon2)}
|
|
477
|
-
in C{degrees squared}.
|
|
517
|
+
@return: A L{Distance4Tuple}C{(distance2, delta_lat, delta_lon, unroll_lon2)} with
|
|
518
|
+
C{distance2} in C{degrees squared}.
|
|
478
519
|
|
|
479
|
-
@raise LimitError:
|
|
520
|
+
@raise LimitError: The lat- or longitudinal delta exceeds the B{C{-limit..limit}}
|
|
480
521
|
range and L{limiterrors<pygeodesy.limiterrors>} is C{True}.
|
|
481
522
|
|
|
482
523
|
@see: U{Local, flat earth approximation<https://www.EdWilliams.org/avform.htm#flat>},
|
|
@@ -485,7 +526,10 @@ def equirectangular4(lat1, lon1, lat2, lon2, adjust=True, limit=45, wrap=False):
|
|
|
485
526
|
L{thomas} and L{vincentys} and methods L{Ellipsoid.distance2}, C{LatLon.distanceTo*}
|
|
486
527
|
and C{LatLon.equirectangularTo}.
|
|
487
528
|
'''
|
|
488
|
-
|
|
529
|
+
if wrap:
|
|
530
|
+
d_lon, lat2, ulon2 = _Wrap.latlon3(lon1, lat2, lon2, wrap)
|
|
531
|
+
else:
|
|
532
|
+
d_lon, ulon2 = (lon2 - lon1), lon2
|
|
489
533
|
d_lat = lat2 - lat1
|
|
490
534
|
|
|
491
535
|
if limit and limit > 0 and limiterrors():
|
|
@@ -996,18 +1040,16 @@ def hartzell(pov, los=False, earth=_WGS84, **name_LatLon_and_kwds):
|
|
|
996
1040
|
|
|
997
1041
|
def haversine(lat1, lon1, lat2, lon2, radius=R_M, wrap=False):
|
|
998
1042
|
'''Compute the distance between two (spherical) points using the
|
|
999
|
-
U{Haversine<https://www.Movable-Type.co.UK/scripts/latlong.html>}
|
|
1000
|
-
formula.
|
|
1043
|
+
U{Haversine<https://www.Movable-Type.co.UK/scripts/latlong.html>} formula.
|
|
1001
1044
|
|
|
1002
1045
|
@arg lat1: Start latitude (C{degrees}).
|
|
1003
1046
|
@arg lon1: Start longitude (C{degrees}).
|
|
1004
1047
|
@arg lat2: End latitude (C{degrees}).
|
|
1005
1048
|
@arg lon2: End longitude (C{degrees}).
|
|
1006
|
-
@kwarg radius: Mean earth radius (C{meter}), datum (L{Datum})
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
B{C{lat2}} and B{C{lon2}} (C{bool}).
|
|
1049
|
+
@kwarg radius: Mean earth radius (C{meter}), datum (L{Datum}) or ellipsoid
|
|
1050
|
+
(L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}) to use.
|
|
1051
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} and unroll B{C{lat2}} and
|
|
1052
|
+
B{C{lon2}} (C{bool}).
|
|
1011
1053
|
|
|
1012
1054
|
@return: Distance (C{meter}, same units as B{C{radius}}).
|
|
1013
1055
|
|
|
@@ -1026,9 +1068,8 @@ def haversine(lat1, lon1, lat2, lon2, radius=R_M, wrap=False):
|
|
|
1026
1068
|
|
|
1027
1069
|
|
|
1028
1070
|
def haversine_(phi2, phi1, lam21):
|
|
1029
|
-
'''Compute the I{angular} distance between two (spherical) points
|
|
1030
|
-
|
|
1031
|
-
formula.
|
|
1071
|
+
'''Compute the I{angular} distance between two (spherical) points using the
|
|
1072
|
+
U{Haversine<https://www.Movable-Type.co.UK/scripts/latlong.html>} formula.
|
|
1032
1073
|
|
|
1033
1074
|
@arg phi2: End latitude (C{radians}).
|
|
1034
1075
|
@arg phi1: Start latitude (C{radians}).
|
|
@@ -1156,7 +1197,7 @@ class _idllmn6(object): # see also .geodesicw._wargs, .latlonBase._toCartesian3
|
|
|
1156
1197
|
m = _MODS.ellipsoidalKarney
|
|
1157
1198
|
except ImportError:
|
|
1158
1199
|
m = _MODS.ellipsoidalExact
|
|
1159
|
-
_i = m._intersections2 if s else m._intersection3 #
|
|
1200
|
+
_i = m._intersections2 if s else m._intersection3 # ellipsoidalBaseDI
|
|
1160
1201
|
else:
|
|
1161
1202
|
raise _TypeError(datum=datum)
|
|
1162
1203
|
yield _i, d, lat2, lon2, m, n
|
|
@@ -1231,7 +1272,8 @@ def intersection2(lat1, lon1, bearing1,
|
|
|
1231
1272
|
|
|
1232
1273
|
else:
|
|
1233
1274
|
t = _i(m.LatLon(lat1, lon1, datum=d), b1,
|
|
1234
|
-
m.LatLon(lat2, lon2, datum=d), b2,
|
|
1275
|
+
m.LatLon(lat2, lon2, datum=d), b2,
|
|
1276
|
+
LatLon=None, height=0, wrap=False)
|
|
1235
1277
|
if isinstance(t, Intersection3Tuple): # ellipsoidal
|
|
1236
1278
|
t, _, _ = t
|
|
1237
1279
|
t = LatLon2Tuple(t.lat, t.lon, name=n)
|
|
@@ -1394,24 +1436,6 @@ def isnormal_(phi, lam, eps=0):
|
|
|
1394
1436
|
return (PI_2 - fabs(phi)) >= eps and (PI - fabs(lam)) >= eps
|
|
1395
1437
|
|
|
1396
1438
|
|
|
1397
|
-
def latlon2n_xyz(lat, lon, **name):
|
|
1398
|
-
'''Convert lat-, longitude to C{n-vector} (I{normal} to the
|
|
1399
|
-
earth's surface) X, Y and Z components.
|
|
1400
|
-
|
|
1401
|
-
@arg lat: Latitude (C{degrees}).
|
|
1402
|
-
@arg lon: Longitude (C{degrees}).
|
|
1403
|
-
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
1404
|
-
|
|
1405
|
-
@return: A L{Vector3Tuple}C{(x, y, z)}.
|
|
1406
|
-
|
|
1407
|
-
@see: Function L{philam2n_xyz}.
|
|
1408
|
-
|
|
1409
|
-
@note: These are C{n-vector} x, y and z components,
|
|
1410
|
-
I{NOT} geocentric ECEF x, y and z coordinates!
|
|
1411
|
-
'''
|
|
1412
|
-
return _2n_xyz(name, *sincos2d_(lat, lon))
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
1439
|
def _normal2(a, b, n_2, n, n2):
|
|
1416
1440
|
'''(INTERNAL) Helper for C{normal} and C{normal_}.
|
|
1417
1441
|
'''
|
|
@@ -1457,44 +1481,6 @@ def normal_(phi, lam, **name):
|
|
|
1457
1481
|
name=_name__(name, name__=normal_))
|
|
1458
1482
|
|
|
1459
1483
|
|
|
1460
|
-
def _2n_xyz(name, sa, ca, sb, cb): # name always **name
|
|
1461
|
-
'''(INTERNAL) Helper for C{latlon2n_xyz} and C{philam2n_xyz}.
|
|
1462
|
-
'''
|
|
1463
|
-
# Kenneth Gade eqn 3, but using right-handed
|
|
1464
|
-
# vector x -> 0°E,0°N, y -> 90°E,0°N, z -> 90°N
|
|
1465
|
-
return Vector3Tuple(ca * cb, ca * sb, sa, **name)
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
def n_xyz2latlon(x, y, z, **name):
|
|
1469
|
-
'''Convert C{n-vector} components to lat- and longitude in C{degrees}.
|
|
1470
|
-
|
|
1471
|
-
@arg x: X component (C{scalar}).
|
|
1472
|
-
@arg y: Y component (C{scalar}).
|
|
1473
|
-
@arg z: Z component (C{scalar}).
|
|
1474
|
-
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
1475
|
-
|
|
1476
|
-
@return: A L{LatLon2Tuple}C{(lat, lon)}.
|
|
1477
|
-
|
|
1478
|
-
@see: Function L{n_xyz2philam}.
|
|
1479
|
-
'''
|
|
1480
|
-
return LatLon2Tuple(atan2d(z, hypot(x, y)), atan2d(y, x), **name)
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
def n_xyz2philam(x, y, z, **name):
|
|
1484
|
-
'''Convert C{n-vector} components to lat- and longitude in C{radians}.
|
|
1485
|
-
|
|
1486
|
-
@arg x: X component (C{scalar}).
|
|
1487
|
-
@arg y: Y component (C{scalar}).
|
|
1488
|
-
@arg z: Z component (C{scalar}).
|
|
1489
|
-
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
1490
|
-
|
|
1491
|
-
@return: A L{PhiLam2Tuple}C{(phi, lam)}.
|
|
1492
|
-
|
|
1493
|
-
@see: Function L{n_xyz2latlon}.
|
|
1494
|
-
'''
|
|
1495
|
-
return PhiLam2Tuple(atan2(z, hypot(x, y)), atan2(y, x), **name)
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
1484
|
def _opposes(d, m, n, n2):
|
|
1499
1485
|
'''(INTERNAL) Helper for C{opposing} and C{opposing_}.
|
|
1500
1486
|
'''
|
|
@@ -1535,24 +1521,6 @@ def opposing_(radians1, radians2, margin=PI_2):
|
|
|
1535
1521
|
return _opposes(radians2 - radians1, m, PI, PI2)
|
|
1536
1522
|
|
|
1537
1523
|
|
|
1538
|
-
def philam2n_xyz(phi, lam, **name):
|
|
1539
|
-
'''Convert lat-, longitude to C{n-vector} (I{normal} to the
|
|
1540
|
-
earth's surface) X, Y and Z components.
|
|
1541
|
-
|
|
1542
|
-
@arg phi: Latitude (C{radians}).
|
|
1543
|
-
@arg lam: Longitude (C{radians}).
|
|
1544
|
-
@kwarg name: Optional name (C{str}).
|
|
1545
|
-
|
|
1546
|
-
@return: A L{Vector3Tuple}C{(x, y, z)}.
|
|
1547
|
-
|
|
1548
|
-
@see: Function L{latlon2n_xyz}.
|
|
1549
|
-
|
|
1550
|
-
@note: These are C{n-vector} x, y and z components,
|
|
1551
|
-
I{NOT} geocentric ECEF x, y and z coordinates!
|
|
1552
|
-
'''
|
|
1553
|
-
return _2n_xyz(name, *sincos2_(phi, lam))
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
1524
|
def _Propy(func, nargs, kwds):
|
|
1557
1525
|
'''(INTERNAL) Helper for the C{frechet.[-]Frechet**} and
|
|
1558
1526
|
C{hausdorff.[-]Hausdorff*} classes.
|
|
@@ -1648,7 +1616,7 @@ def _radistance(inst):
|
|
|
1648
1616
|
def _scale_deg(lat1, lat2): # degrees
|
|
1649
1617
|
# scale factor cos(mean of lats) for delta lon
|
|
1650
1618
|
m = fabs(lat1 + lat2) * _0_5
|
|
1651
|
-
return cos(radians(m)) if m <
|
|
1619
|
+
return cos(radians(m)) if m < _90_0 else _0_0
|
|
1652
1620
|
|
|
1653
1621
|
|
|
1654
1622
|
def _scale_rad(phi1, phi2): # radians, by .frechet, .hausdorff, .heights
|
|
@@ -1809,7 +1777,7 @@ def vincentys_(phi2, phi1, lam21):
|
|
|
1809
1777
|
|
|
1810
1778
|
# **) MIT License
|
|
1811
1779
|
#
|
|
1812
|
-
# Copyright (C) 2016-
|
|
1780
|
+
# Copyright (C) 2016-2025 -- mrJean1 at Gmail -- All Rights Reserved.
|
|
1813
1781
|
#
|
|
1814
1782
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
1815
1783
|
# copy of this software and associated documentation files (the "Software"),
|
pygeodesy/frechet.py
CHANGED
|
@@ -856,7 +856,7 @@ class Frechet6Tuple(_NamedTuple):
|
|
|
856
856
|
|
|
857
857
|
# **) MIT License
|
|
858
858
|
#
|
|
859
|
-
# Copyright (C) 2016-
|
|
859
|
+
# Copyright (C) 2016-2025 -- mrJean1 at Gmail -- All Rights Reserved.
|
|
860
860
|
#
|
|
861
861
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
862
862
|
# copy of this software and associated documentation files (the "Software"),
|
pygeodesy/fstats.py
CHANGED
|
@@ -803,7 +803,7 @@ __all__ += _ALL_DOCS(_FstatsBase, _FstatsNamed)
|
|
|
803
803
|
|
|
804
804
|
# **) MIT License
|
|
805
805
|
#
|
|
806
|
-
# Copyright (C) 2021-
|
|
806
|
+
# Copyright (C) 2021-2025 -- mrJean1 at Gmail -- All Rights Reserved.
|
|
807
807
|
#
|
|
808
808
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
|
809
809
|
# copy of this software and associated documentation files (the "Software"),
|