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.
- {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/METADATA +2 -2
- PyGeodesy-24.5.24.dist-info/RECORD +116 -0
- pygeodesy/__init__.py +16 -12
- pygeodesy/__main__.py +9 -10
- pygeodesy/albers.py +42 -42
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/__main__.py +7 -10
- pygeodesy/auxilats/auxAngle.py +32 -31
- pygeodesy/auxilats/auxLat.py +81 -51
- pygeodesy/azimuthal.py +123 -124
- pygeodesy/basics.py +165 -176
- pygeodesy/booleans.py +14 -15
- pygeodesy/cartesianBase.py +25 -23
- pygeodesy/clipy.py +3 -3
- pygeodesy/constants.py +8 -6
- pygeodesy/css.py +50 -42
- pygeodesy/datums.py +50 -48
- pygeodesy/dms.py +6 -6
- pygeodesy/ecef.py +27 -27
- pygeodesy/elevations.py +2 -2
- pygeodesy/ellipsoidalBase.py +28 -27
- pygeodesy/ellipsoidalBaseDI.py +8 -7
- pygeodesy/ellipsoidalNvector.py +11 -12
- pygeodesy/ellipsoids.py +41 -35
- pygeodesy/elliptic.py +12 -10
- pygeodesy/epsg.py +4 -3
- pygeodesy/errors.py +35 -13
- pygeodesy/etm.py +62 -53
- pygeodesy/fmath.py +48 -41
- pygeodesy/formy.py +93 -65
- pygeodesy/frechet.py +117 -102
- pygeodesy/fstats.py +52 -46
- pygeodesy/fsums.py +169 -145
- pygeodesy/gars.py +10 -9
- pygeodesy/geodesicw.py +32 -30
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/__main__.py +4 -4
- pygeodesy/geodesicx/gx.py +40 -32
- pygeodesy/geodesicx/gxarea.py +15 -12
- pygeodesy/geodesicx/gxbases.py +3 -4
- pygeodesy/geodesicx/gxline.py +6 -8
- pygeodesy/geodsolve.py +28 -26
- pygeodesy/geohash.py +47 -44
- pygeodesy/geoids.py +37 -35
- pygeodesy/hausdorff.py +112 -99
- pygeodesy/heights.py +136 -129
- pygeodesy/internals.py +576 -0
- pygeodesy/interns.py +6 -207
- pygeodesy/iters.py +22 -19
- pygeodesy/karney.py +18 -15
- pygeodesy/ktm.py +31 -24
- pygeodesy/latlonBase.py +12 -11
- pygeodesy/lazily.py +140 -218
- pygeodesy/lcc.py +24 -25
- pygeodesy/ltp.py +83 -71
- pygeodesy/ltpTuples.py +7 -5
- pygeodesy/mgrs.py +5 -4
- pygeodesy/named.py +136 -49
- pygeodesy/namedTuples.py +33 -25
- pygeodesy/nvectorBase.py +10 -9
- pygeodesy/osgr.py +14 -12
- pygeodesy/points.py +13 -13
- pygeodesy/props.py +7 -7
- pygeodesy/rhumb/__init__.py +1 -1
- pygeodesy/rhumb/bases.py +3 -2
- pygeodesy/rhumb/solve.py +2 -2
- pygeodesy/solveBase.py +8 -7
- pygeodesy/sphericalTrigonometry.py +5 -5
- pygeodesy/streprs.py +8 -7
- pygeodesy/trf.py +8 -8
- pygeodesy/triaxials.py +67 -63
- pygeodesy/units.py +48 -50
- pygeodesy/unitsBase.py +24 -11
- pygeodesy/ups.py +7 -6
- pygeodesy/utily.py +4 -4
- pygeodesy/utm.py +53 -52
- pygeodesy/utmupsBase.py +11 -8
- pygeodesy/vector2d.py +6 -7
- pygeodesy/vector3d.py +16 -17
- pygeodesy/vector3dBase.py +5 -5
- PyGeodesy-24.5.8.dist-info/RECORD +0 -115
- {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/top_level.txt +0 -0
pygeodesy/booleans.py
CHANGED
|
@@ -17,7 +17,7 @@ C{reverse-difference}, C{sum} and C{union}.
|
|
|
17
17
|
# make sure int/int division yields float quotient, see .basics
|
|
18
18
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
19
19
|
|
|
20
|
-
from pygeodesy.basics import isodd, issubclassof, map2,
|
|
20
|
+
from pygeodesy.basics import isodd, issubclassof, map2, _xscalar
|
|
21
21
|
from pygeodesy.constants import EPS, EPS2, INT0, _0_0, _0_5, _1_0
|
|
22
22
|
from pygeodesy.errors import ClipError, _IsnotError, _TypeError, \
|
|
23
23
|
_ValueError, _xattr, _xkwds_get
|
|
@@ -25,13 +25,14 @@ from pygeodesy.fmath import favg, hypot, hypot2
|
|
|
25
25
|
# from pygeodesy.fsums import fsum1 # _MODS
|
|
26
26
|
from pygeodesy.interns import NN, _BANG_, _clip_, _clipid_, _COMMASPACE_, \
|
|
27
27
|
_composite_, _DOT_, _e_, _ELLIPSIS_, _few_, \
|
|
28
|
-
_height_, _lat_,_LatLon_, _lon_, _not_, \
|
|
28
|
+
_height_, _lat_, _LatLon_, _lon_, _not_, \
|
|
29
29
|
_points_, _SPACE_, _too_, _X_, _x_, \
|
|
30
30
|
_B_, _d_, _R_ # PYCHOK used!
|
|
31
31
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
32
32
|
from pygeodesy.latlonBase import LatLonBase, \
|
|
33
33
|
LatLon2Tuple, Property_RO, property_RO
|
|
34
|
-
from pygeodesy.named import
|
|
34
|
+
from pygeodesy.named import _name__, _Named, _NotImplemented, \
|
|
35
|
+
Fmt, pairs, unstr
|
|
35
36
|
# from pygeodesy.namedTuples import LatLon2Tupe # from .latlonBase
|
|
36
37
|
# from pygeodesy.points import boundsOf # _MODS
|
|
37
38
|
# from pygeodesy.props import Property_RO, property_RO # from .latlonBase
|
|
@@ -42,7 +43,7 @@ from pygeodesy.utily import fabs, _unrollon, _Wrap
|
|
|
42
43
|
# from math import fabs # from .utily
|
|
43
44
|
|
|
44
45
|
__all__ = _ALL_LAZY.booleans
|
|
45
|
-
__version__ = '24.
|
|
46
|
+
__version__ = '24.05.24'
|
|
46
47
|
|
|
47
48
|
_0_EPS = EPS # near-zero, positive
|
|
48
49
|
_EPS_0 = -EPS # near-zero, negative
|
|
@@ -124,7 +125,7 @@ class _LatLonBool(_Named):
|
|
|
124
125
|
_prev = None # link to the previous vertex
|
|
125
126
|
|
|
126
127
|
def __init__(self, lat_ll, lon=None, height=0, clipid=INT0,
|
|
127
|
-
wrap=False, name
|
|
128
|
+
wrap=False, **name):
|
|
128
129
|
'''New C{LatLon[FHP|GH]} from separate C{lat}, C{lon}, C{height}
|
|
129
130
|
and C{clipid} scalars or from a previous C{LatLon[FHP|GH]},
|
|
130
131
|
a C{Clip[FHP|GH]4Tuple} or some other C{LatLon} instance.
|
|
@@ -330,7 +331,7 @@ class LatLonFHP(_LatLonBool):
|
|
|
330
331
|
return self.x * other.x + self.y * other.y
|
|
331
332
|
|
|
332
333
|
def __rmul__(self, other): # scalar product
|
|
333
|
-
|
|
334
|
+
_xscalar(other=other)
|
|
334
335
|
return self.__class__(self.y * other, self.x * other)
|
|
335
336
|
|
|
336
337
|
def _e_x_str(self, t): # PYCHOK no cover
|
|
@@ -883,10 +884,10 @@ class _CompositeBase(_Named):
|
|
|
883
884
|
_raiser = False
|
|
884
885
|
_xtend = False
|
|
885
886
|
|
|
886
|
-
def __init__(self, lls,
|
|
887
|
+
def __init__(self, lls, kind=NN, eps=EPS, **name):
|
|
887
888
|
'''(INTERNAL) See L{BooleanFHP} and L{BooleanGH}.
|
|
888
889
|
'''
|
|
889
|
-
n = name
|
|
890
|
+
n = _name__(name, _or_nameof=lls)
|
|
890
891
|
if n:
|
|
891
892
|
self.name = n
|
|
892
893
|
if kind:
|
|
@@ -1801,7 +1802,7 @@ class BooleanFHP(_CompositeFHP, _BooleanBase):
|
|
|
1801
1802
|
'''
|
|
1802
1803
|
_kind = _boolean_
|
|
1803
1804
|
|
|
1804
|
-
def __init__(self, lls, raiser=False, eps=EPS, name
|
|
1805
|
+
def __init__(self, lls, raiser=False, eps=EPS, **name):
|
|
1805
1806
|
'''New L{BooleanFHP} operand for I{boolean} operation.
|
|
1806
1807
|
|
|
1807
1808
|
@arg lls: The polygon points and clips (iterable of L{LatLonFHP}s,
|
|
@@ -1811,8 +1812,7 @@ class BooleanFHP(_CompositeFHP, _BooleanBase):
|
|
|
1811
1812
|
units as the B{C{lls}} coordinates).
|
|
1812
1813
|
@kwarg name: Optional name (C{str}).
|
|
1813
1814
|
'''
|
|
1814
|
-
_CompositeFHP.__init__(self, lls, raiser=raiser,
|
|
1815
|
-
eps=eps, name=name)
|
|
1815
|
+
_CompositeFHP.__init__(self, lls, raiser=raiser, eps=eps, **name)
|
|
1816
1816
|
|
|
1817
1817
|
def __isub__(self, other):
|
|
1818
1818
|
'''Not implemented.'''
|
|
@@ -1864,7 +1864,7 @@ class BooleanGH(_CompositeGH, _BooleanBase):
|
|
|
1864
1864
|
'''
|
|
1865
1865
|
_kind = _boolean_
|
|
1866
1866
|
|
|
1867
|
-
def __init__(self, lls, raiser=True, xtend=False, eps=EPS, name
|
|
1867
|
+
def __init__(self, lls, raiser=True, xtend=False, eps=EPS, **name):
|
|
1868
1868
|
'''New L{BooleanFHP} operand for I{boolean} operation.
|
|
1869
1869
|
|
|
1870
1870
|
@arg lls: The polygon points and clips (iterable of L{LatLonGH}s,
|
|
@@ -1876,8 +1876,7 @@ class BooleanGH(_CompositeGH, _BooleanBase):
|
|
|
1876
1876
|
units as the B{C{lls}} coordinates).
|
|
1877
1877
|
@kwarg name: Optional name (C{str}).
|
|
1878
1878
|
'''
|
|
1879
|
-
_CompositeGH.__init__(self, lls, raiser=raiser, xtend=xtend,
|
|
1880
|
-
eps=eps, name=name)
|
|
1879
|
+
_CompositeGH.__init__(self, lls, raiser=raiser, xtend=xtend, eps=eps, **name)
|
|
1881
1880
|
|
|
1882
1881
|
def _boolean(self, other, s_entry, c_entry, op):
|
|
1883
1882
|
# One C{BooleanGH} operation.
|
|
@@ -1921,7 +1920,7 @@ def _alpha4(a):
|
|
|
1921
1920
|
def _Cps(Cp, composites_points, where):
|
|
1922
1921
|
# Yield composites and points as a C{Cp} composite.
|
|
1923
1922
|
try:
|
|
1924
|
-
kwds = dict(kind=_points_,
|
|
1923
|
+
kwds = dict(kind=_points_, name__=where)
|
|
1925
1924
|
for cp in composites_points:
|
|
1926
1925
|
yield cp if isBoolean(cp) else Cp(cp, **kwds)
|
|
1927
1926
|
except (AttributeError, ClipError, TypeError, ValueError) as x:
|
pygeodesy/cartesianBase.py
CHANGED
|
@@ -21,10 +21,10 @@ from pygeodesy.errors import _IsnotError, _TypeError, _ValueError, \
|
|
|
21
21
|
from pygeodesy.fmath import cbrt, hypot, hypot_, hypot2, fabs, sqrt # hypot
|
|
22
22
|
# from pygeodesy.formy import _hartzell # _MODS
|
|
23
23
|
from pygeodesy.fsums import fsumf_, Fmt
|
|
24
|
-
from pygeodesy.interns import
|
|
24
|
+
from pygeodesy.interns import _COMMASPACE_, _phi_
|
|
25
25
|
from pygeodesy.interns import _ellipsoidal_, _spherical_ # PYCHOK used!
|
|
26
26
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
27
|
-
from pygeodesy.named import _NamedTuple, _Pass
|
|
27
|
+
from pygeodesy.named import _name__, _name2__, _NamedTuple, _Pass
|
|
28
28
|
from pygeodesy.namedTuples import LatLon4Tuple, Vector3Tuple, Vector4Tuple, \
|
|
29
29
|
Bearing2Tuple # PYCHOK .sphericalBase
|
|
30
30
|
# from pygeodesy.nvectorBase import _N_vector # _MODS
|
|
@@ -43,7 +43,7 @@ from pygeodesy.vector3d import Vector3d, _xyzhdn3
|
|
|
43
43
|
# from math import atan2, degrees, fabs, radians, sqrt # from .fmath, .utily
|
|
44
44
|
|
|
45
45
|
__all__ = _ALL_LAZY.cartesianBase
|
|
46
|
-
__version__ = '24.
|
|
46
|
+
__version__ = '24.05.24'
|
|
47
47
|
|
|
48
48
|
_r_ = 'r'
|
|
49
49
|
_theta_ = 'theta'
|
|
@@ -55,7 +55,7 @@ class CartesianBase(Vector3d):
|
|
|
55
55
|
_datum = None # L{Datum}, to be overriden
|
|
56
56
|
_height = None # height (L{Height}), set or approximated
|
|
57
57
|
|
|
58
|
-
def __init__(self, x_xyz, y=None, z=None, datum=None, ll=None, name
|
|
58
|
+
def __init__(self, x_xyz, y=None, z=None, datum=None, ll=None, **name):
|
|
59
59
|
'''New C{Cartesian...}.
|
|
60
60
|
|
|
61
61
|
@arg x_xyz: Cartesian X coordinate (C{scalar}) or a C{Cartesian},
|
|
@@ -67,15 +67,15 @@ class CartesianBase(Vector3d):
|
|
|
67
67
|
@kwarg datum: Optional datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2}
|
|
68
68
|
or L{a_f2Tuple}).
|
|
69
69
|
@kwarg ll: Optional, original latlon (C{LatLon}).
|
|
70
|
-
@kwarg name: Optional name (C{str}).
|
|
70
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
71
71
|
|
|
72
72
|
@raise TypeError: Non-scalar B{C{x_xyz}}, B{C{y}} or B{C{z}} coordinate
|
|
73
73
|
or B{C{x_xyz}} not a C{Cartesian}, L{Ecef9Tuple},
|
|
74
74
|
L{Vector3Tuple} or L{Vector4Tuple} or B{C{datum}} is
|
|
75
75
|
not a L{Datum}.
|
|
76
76
|
'''
|
|
77
|
-
h, d, n = _xyzhdn3(x_xyz, None, datum, ll)
|
|
78
|
-
Vector3d.__init__(self, x_xyz, y=y, z=z, ll=ll, name=
|
|
77
|
+
h, d, n = _xyzhdn3(x_xyz, None, datum, ll, **name)
|
|
78
|
+
Vector3d.__init__(self, x_xyz, y=y, z=z, ll=ll, name=n)
|
|
79
79
|
if h is not None:
|
|
80
80
|
self._height = Height(h)
|
|
81
81
|
if d is not None:
|
|
@@ -325,7 +325,7 @@ class CartesianBase(Vector3d):
|
|
|
325
325
|
try:
|
|
326
326
|
r = self.datum.ellipsoid.height4(self, normal=True)
|
|
327
327
|
except (AttributeError, ValueError): # no datum, null cartesian,
|
|
328
|
-
r = Vector4Tuple(self.x, self.y, self.z, 0,
|
|
328
|
+
r = Vector4Tuple(self.x, self.y, self.z, 0, name__=self.height4)
|
|
329
329
|
return r
|
|
330
330
|
|
|
331
331
|
def height4(self, earth=None, normal=True, **Cartesian_and_kwds):
|
|
@@ -840,7 +840,7 @@ class CartesianBase(Vector3d):
|
|
|
840
840
|
else:
|
|
841
841
|
# if inverse and d != _WGS84:
|
|
842
842
|
# raise _ValueError(inverse=inverse, datum=d,
|
|
843
|
-
#
|
|
843
|
+
# txt_not_=_WGS84.name)
|
|
844
844
|
xyz = transform.transform(*self.xyz, inverse=inverse)
|
|
845
845
|
c = self.dup(xyz=xyz, datum=datum or self.datum)
|
|
846
846
|
return c
|
|
@@ -871,12 +871,12 @@ class RadiusThetaPhi3Tuple(_NamedTuple):
|
|
|
871
871
|
_Names_ = (_r_, _theta_, _phi_)
|
|
872
872
|
_Units_ = ( Meter, _Pass, _Pass)
|
|
873
873
|
|
|
874
|
-
def toCartesian(self,
|
|
874
|
+
def toCartesian(self, **name_Cartesian_and_kwds):
|
|
875
875
|
'''Convert this L{RadiusThetaPhi3Tuple} to a cartesian C{(x, y, z)} vector.
|
|
876
876
|
|
|
877
|
-
@kwarg
|
|
878
|
-
|
|
879
|
-
|
|
877
|
+
@kwarg name_Cartesian_and_kwds: Optional C{B{name}=NN}, overriding this
|
|
878
|
+
name and optional class C{B{Cartesian}=None} and additional
|
|
879
|
+
C{B{Cartesian}} keyword arguments.
|
|
880
880
|
|
|
881
881
|
@return: A C{B{Cartesian}(x, y, z)} instance or if no C{B{Cartesian}} keyword
|
|
882
882
|
argument is given, a L{Vector3Tuple}C{(x, y, z)} with C{x}, C{y}
|
|
@@ -886,9 +886,10 @@ class RadiusThetaPhi3Tuple(_NamedTuple):
|
|
|
886
886
|
'''
|
|
887
887
|
r, t, p = self
|
|
888
888
|
t, p, _ = _toRadians(self, t, p)
|
|
889
|
-
|
|
889
|
+
n, kwds = _name2__(name_Cartesian_and_kwds, _or_nameof=self)
|
|
890
|
+
return rtp2xyz_(r, t, p, name=n, **kwds)
|
|
890
891
|
|
|
891
|
-
def toDegrees(self, name
|
|
892
|
+
def toDegrees(self, **name):
|
|
892
893
|
'''Convert this L{RadiusThetaPhi3Tuple}'s angles to L{Degrees}.
|
|
893
894
|
|
|
894
895
|
@kwarg name: Optional name (C{str}), overriding this name.
|
|
@@ -899,20 +900,20 @@ class RadiusThetaPhi3Tuple(_NamedTuple):
|
|
|
899
900
|
r, t, p = self
|
|
900
901
|
t, p, _ = _toDegrees(self, t, p)
|
|
901
902
|
return _ or self.classof(r, Degrees(theta=t), Degrees(phi=p),
|
|
902
|
-
name=name
|
|
903
|
+
name=_name__(name, _or_nameof=self))
|
|
903
904
|
|
|
904
|
-
def toRadians(self, name
|
|
905
|
+
def toRadians(self, **name):
|
|
905
906
|
'''Convert this L{RadiusThetaPhi3Tuple}'s angles to L{Radians}.
|
|
906
907
|
|
|
907
|
-
@kwarg name: Optional name (C{str})
|
|
908
|
+
@kwarg name: Optional, overriding C{B{name}=NN} (C{str}).
|
|
908
909
|
|
|
909
|
-
@return: L{RadiusThetaPhi3Tuple}C{(r, theta, phi)} with
|
|
910
|
-
and C{phi} both in L{Radians}.
|
|
910
|
+
@return: L{RadiusThetaPhi3Tuple}C{(r, theta, phi)} with
|
|
911
|
+
C{theta} and C{phi} both in L{Radians}.
|
|
911
912
|
'''
|
|
912
913
|
r, t, p = self
|
|
913
914
|
t, p, _ = _toRadians(self, t, p)
|
|
914
915
|
return _ or self.classof(r, Radians(theta=t), Radians(phi=p),
|
|
915
|
-
name=name
|
|
916
|
+
name=_name__(name, _or_nameof=self))
|
|
916
917
|
|
|
917
918
|
|
|
918
919
|
def rtp2xyz(r_rtp, *theta_phi, **name_Cartesian_and_kwds):
|
|
@@ -974,8 +975,9 @@ def rtp2xyz_(r_rtp, *theta_phi, **name_Cartesian_and_kwds):
|
|
|
974
975
|
else:
|
|
975
976
|
x = y = z = r
|
|
976
977
|
|
|
977
|
-
def _n_C_kwds3(
|
|
978
|
-
|
|
978
|
+
def _n_C_kwds3(Cartesian=None, **name_kwds):
|
|
979
|
+
n, kwds = _name2__(**name_kwds)
|
|
980
|
+
return n, Cartesian, kwds
|
|
979
981
|
|
|
980
982
|
n, C, kwds = _n_C_kwds3(**name_Cartesian_and_kwds)
|
|
981
983
|
c = Vector3Tuple(x, y, z, name=n) if C is None else \
|
pygeodesy/clipy.py
CHANGED
|
@@ -30,7 +30,7 @@ from pygeodesy.units import Bool, FIx, HeightX, Lat, Lon, Number_
|
|
|
30
30
|
# from math import fabs # from .fmath
|
|
31
31
|
|
|
32
32
|
__all__ = _ALL_LAZY.clipy
|
|
33
|
-
__version__ = '23.05.
|
|
33
|
+
__version__ = '23.05.18'
|
|
34
34
|
|
|
35
35
|
_fj_ = 'fj'
|
|
36
36
|
_original_ = 'original'
|
|
@@ -284,7 +284,7 @@ def clipFHP4(points, corners, closed=False, inull=False, raiser=False, eps=EPS):
|
|
|
284
284
|
L{clipGH4}.
|
|
285
285
|
'''
|
|
286
286
|
P = _MODS.booleans._CompositeFHP(points, kind=_points_, raiser=raiser,
|
|
287
|
-
|
|
287
|
+
eps=eps, name__=clipFHP4)
|
|
288
288
|
Q = _4corners(corners)
|
|
289
289
|
return P._clip(Q, Union=False, Clas=ClipFHP4Tuple, closed=closed,
|
|
290
290
|
inull=inull, raiser=P._raiser, eps=eps)
|
|
@@ -334,7 +334,7 @@ def clipGH4(points, corners, closed=False, inull=False, raiser=True, xtend=False
|
|
|
334
334
|
and function L{clipFHP4}.
|
|
335
335
|
'''
|
|
336
336
|
S = _MODS.booleans._CompositeGH(points, raiser=raiser, xtend=xtend, eps=eps,
|
|
337
|
-
|
|
337
|
+
name__=clipGH4, kind=_points_)
|
|
338
338
|
C = _4corners(corners)
|
|
339
339
|
return S._clip(C, False, False, Clas=ClipGH4Tuple, closed=closed, inull=inull,
|
|
340
340
|
raiser=S._raiser, xtend=S._xtend, eps=eps)
|
pygeodesy/constants.py
CHANGED
|
@@ -9,12 +9,13 @@ L{pygeodesy.isnon0} and L{pygeodesy.remainder}.
|
|
|
9
9
|
# make sure int/int division yields float quotient, see .basics
|
|
10
10
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
11
11
|
|
|
12
|
-
from pygeodesy.basics import
|
|
12
|
+
from pygeodesy.basics import _copysign, isbool, iscomplex, isint, _0_0
|
|
13
13
|
from pygeodesy.errors import _xError, _xError2, _xkwds_get, _xkwds_item2
|
|
14
|
+
# from pygeodesy.internals import _0_0 # from .basics
|
|
14
15
|
from pygeodesy.interns import _INF_, _NAN_, _UNDER_
|
|
15
|
-
# from pygeodesy.lazily import _ALL_LAZY # from .
|
|
16
|
+
# from pygeodesy.lazily import _ALL_LAZY # from .unitsBase
|
|
16
17
|
# from pygeodesy.streprs import Fmt # from .unitsBase
|
|
17
|
-
from pygeodesy.unitsBase import Float, Int, Radius, Fmt
|
|
18
|
+
from pygeodesy.unitsBase import Float, Int, Radius, _ALL_LAZY, Fmt
|
|
18
19
|
|
|
19
20
|
from math import fabs, isinf, isnan, pi as _PI, sqrt
|
|
20
21
|
try:
|
|
@@ -23,7 +24,7 @@ except ImportError: # Python 2-
|
|
|
23
24
|
_inf, _nan = float(_INF_), float(_NAN_)
|
|
24
25
|
|
|
25
26
|
__all__ = _ALL_LAZY.constants
|
|
26
|
-
__version__ = '24.
|
|
27
|
+
__version__ = '24.05.14'
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
def _copysign_0_0(y):
|
|
@@ -355,8 +356,9 @@ def isint0(obj, both=False):
|
|
|
355
356
|
@return: C{True} if B{C{obj}} is L{INT0}, C{int(0)} or
|
|
356
357
|
C{float(0)}, C{False} otherwise.
|
|
357
358
|
'''
|
|
358
|
-
return (obj is INT0 or obj is int(0) or
|
|
359
|
-
|
|
359
|
+
return (obj is INT0 or obj is int(0) or
|
|
360
|
+
bool(both and (not obj) and isint(obj, both=True))) and \
|
|
361
|
+
not isbool(obj)
|
|
360
362
|
|
|
361
363
|
|
|
362
364
|
def isnear0(x, eps0=EPS0):
|
pygeodesy/css.py
CHANGED
|
@@ -14,14 +14,14 @@ from pygeodesy.datums import _ellipsoidal_datum, _WGS84
|
|
|
14
14
|
from pygeodesy.ellipsoidalBase import LatLonEllipsoidalBase as _LLEB
|
|
15
15
|
from pygeodesy.errors import _ValueError, _xdatum, _xellipsoidal, \
|
|
16
16
|
_xattr, _xkwds
|
|
17
|
-
from pygeodesy.interns import
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
from pygeodesy.interns import _azimuth_, _COMMASPACE_, _easting_, \
|
|
18
|
+
_lat_, _lon_, _m_, _name_, _northing_, \
|
|
19
|
+
_reciprocal_, _SPACE_
|
|
20
20
|
from pygeodesy.interns import _C_ # PYCHOK used!
|
|
21
21
|
from pygeodesy.karney import _atan2d, _copysign, _diff182, _norm2, \
|
|
22
22
|
_norm180, _signBit, _sincos2d, fabs
|
|
23
23
|
from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
|
|
24
|
-
from pygeodesy.named import _NamedBase, _NamedTuple
|
|
24
|
+
from pygeodesy.named import _name2__, _NamedBase, _NamedTuple
|
|
25
25
|
from pygeodesy.namedTuples import EasNor2Tuple, EasNor3Tuple, \
|
|
26
26
|
LatLon2Tuple, LatLon4Tuple, _LL4Tuple
|
|
27
27
|
from pygeodesy.props import deprecated_Property_RO, Property, \
|
|
@@ -33,7 +33,7 @@ from pygeodesy.units import Bearing, Degrees, Easting, Height, _heigHt, \
|
|
|
33
33
|
# from math import fabs # from .karney
|
|
34
34
|
|
|
35
35
|
__all__ = _ALL_LAZY.css
|
|
36
|
-
__version__ = '24.
|
|
36
|
+
__version__ = '24.05.24'
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
def _CS0(cs0):
|
|
@@ -65,19 +65,19 @@ class CassiniSoldner(_NamedBase):
|
|
|
65
65
|
_meridian = None
|
|
66
66
|
_sb0 = _0_0
|
|
67
67
|
|
|
68
|
-
def __init__(self, lat0, lon0, datum=_WGS84, name
|
|
68
|
+
def __init__(self, lat0, lon0, datum=_WGS84, **name):
|
|
69
69
|
'''New L{CassiniSoldner} projection.
|
|
70
70
|
|
|
71
71
|
@arg lat0: Latitude of center point (C{degrees90}).
|
|
72
72
|
@arg lon0: Longitude of center point (C{degrees180}).
|
|
73
73
|
@kwarg datum: Optional datum or ellipsoid (L{Datum},
|
|
74
74
|
L{Ellipsoid}, L{Ellipsoid2} or L{a_f2Tuple}).
|
|
75
|
-
@kwarg name: Optional name (C{str}).
|
|
75
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
76
76
|
|
|
77
77
|
@raise CSSError: Invalid B{C{lat}} or B{C{lon}}.
|
|
78
78
|
'''
|
|
79
79
|
if datum not in (None, self._datum):
|
|
80
|
-
self._datum = _xellipsoidal(datum=_ellipsoidal_datum(datum, name
|
|
80
|
+
self._datum = _xellipsoidal(datum=_ellipsoidal_datum(datum, **name))
|
|
81
81
|
if name:
|
|
82
82
|
self.name = name
|
|
83
83
|
|
|
@@ -125,13 +125,14 @@ class CassiniSoldner(_NamedBase):
|
|
|
125
125
|
|
|
126
126
|
f = flattening
|
|
127
127
|
|
|
128
|
-
def forward(self, lat, lon, name
|
|
128
|
+
def forward(self, lat, lon, **name):
|
|
129
129
|
'''Convert an (ellipsoidal) geodetic location to Cassini-Soldner
|
|
130
130
|
easting and northing.
|
|
131
131
|
|
|
132
132
|
@arg lat: Latitude of the location (C{degrees90}).
|
|
133
133
|
@arg lon: Longitude of the location (C{degrees180}).
|
|
134
|
-
@kwarg name:
|
|
134
|
+
@kwarg name: Optional C{B{name}=NN} inlieu of this projection's
|
|
135
|
+
name (C{str}).
|
|
135
136
|
|
|
136
137
|
@return: An L{EasNor2Tuple}C{(easting, northing)}.
|
|
137
138
|
|
|
@@ -140,16 +141,17 @@ class CassiniSoldner(_NamedBase):
|
|
|
140
141
|
|
|
141
142
|
@raise CSSError: Invalid B{C{lat}} or B{C{lon}}.
|
|
142
143
|
'''
|
|
143
|
-
t = self.forward6(lat, lon, name
|
|
144
|
+
t = self.forward6(lat, lon, **name)
|
|
144
145
|
return EasNor2Tuple(t.easting, t.northing, name=t.name)
|
|
145
146
|
|
|
146
|
-
def forward4(self, lat, lon, name
|
|
147
|
+
def forward4(self, lat, lon, **name):
|
|
147
148
|
'''Convert an (ellipsoidal) geodetic location to Cassini-Soldner
|
|
148
149
|
easting and northing.
|
|
149
150
|
|
|
150
151
|
@arg lat: Latitude of the location (C{degrees90}).
|
|
151
152
|
@arg lon: Longitude of the location (C{degrees180}).
|
|
152
|
-
@kwarg name:
|
|
153
|
+
@kwarg name: Optional B{C{name}=NN} inlieu of this projection's
|
|
154
|
+
name (C{str}).
|
|
153
155
|
|
|
154
156
|
@return: An L{EasNorAziRk4Tuple}C{(easting, northing,
|
|
155
157
|
azimuth, reciprocal)}.
|
|
@@ -159,17 +161,18 @@ class CassiniSoldner(_NamedBase):
|
|
|
159
161
|
|
|
160
162
|
@raise CSSError: Invalid B{C{lat}} or B{C{lon}}.
|
|
161
163
|
'''
|
|
162
|
-
t = self.forward6(lat, lon, name
|
|
164
|
+
t = self.forward6(lat, lon, **name)
|
|
163
165
|
return EasNorAziRk4Tuple(t.easting, t.northing,
|
|
164
166
|
t.azimuth, t.reciprocal, name=t.name)
|
|
165
167
|
|
|
166
|
-
def forward6(self, lat, lon, name
|
|
168
|
+
def forward6(self, lat, lon, **name):
|
|
167
169
|
'''Convert an (ellipsoidal) geodetic location to Cassini-Soldner
|
|
168
170
|
easting and northing.
|
|
169
171
|
|
|
170
172
|
@arg lat: Latitude of the location (C{degrees90}).
|
|
171
173
|
@arg lon: Longitude of the location (C{degrees180}).
|
|
172
|
-
@kwarg name:
|
|
174
|
+
@kwarg name: Optional B{C{name}=NN} inlieu of this projection's
|
|
175
|
+
name (C{str}).
|
|
173
176
|
|
|
174
177
|
@return: An L{EasNorAziRkEqu6Tuple}C{(easting, northing,
|
|
175
178
|
azimuth, reciprocal, equatorarc, equatorazimuth)}.
|
|
@@ -209,7 +212,7 @@ class CassiniSoldner(_NamedBase):
|
|
|
209
212
|
n = self._meridian.ArcPosition(d, g.DISTANCE).s12
|
|
210
213
|
# n = self._meridian._GenPosition(True, d, g.DISTANCE)[4]
|
|
211
214
|
return EasNorAziRkEqu6Tuple(e, n, z, rk, p.a1, p.azi0,
|
|
212
|
-
|
|
215
|
+
name=self._name__(name))
|
|
213
216
|
|
|
214
217
|
@Property
|
|
215
218
|
def geodesic(self):
|
|
@@ -309,20 +312,21 @@ class CassiniSoldner(_NamedBase):
|
|
|
309
312
|
s, c = _sincos2d(m.lat1) # == self.lat0 == self.LatitudeOrigin()
|
|
310
313
|
self._sb0, self._cb0 = _norm2(s * g.f1, c)
|
|
311
314
|
|
|
312
|
-
def reverse(self, easting, northing,
|
|
315
|
+
def reverse(self, easting, northing, LatLon=None, **LatLon_kwds_name):
|
|
313
316
|
'''Convert a Cassini-Soldner location to (ellipsoidal) geodetic
|
|
314
317
|
lat- and longitude.
|
|
315
318
|
|
|
316
319
|
@arg easting: Easting of the location (C{meter}).
|
|
317
320
|
@arg northing: Northing of the location (C{meter}).
|
|
318
|
-
@kwarg
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
@kwarg LatLon: Optional, ellipsoidal class to return the geodetic
|
|
322
|
+
location as (C{LatLon}) or C{None}.
|
|
323
|
+
@kwarg LatLon_kwds_name: Optional (C{LatLon}) keyword arguments,
|
|
324
|
+
ignored if C{B{LatLon} is None} and optional
|
|
325
|
+
C{B{name}=NN} inlieu of this this projection's
|
|
326
|
+
name (C{str}).
|
|
323
327
|
|
|
324
|
-
@return: Geodetic location B{C{LatLon}} or if B{C{LatLon}}
|
|
325
|
-
|
|
328
|
+
@return: Geodetic location B{C{LatLon}} or if B{C{LatLon}} is C{None},
|
|
329
|
+
a L{LatLon2Tuple}C{(lat, lon)}.
|
|
326
330
|
|
|
327
331
|
@raise CSSError: Ellipsoidal mismatch of B{C{LatLon}} and this projection.
|
|
328
332
|
|
|
@@ -331,23 +335,25 @@ class CassiniSoldner(_NamedBase):
|
|
|
331
335
|
@see: Method L{CassiniSoldner.reverse4}, L{CassiniSoldner.forward}.
|
|
332
336
|
L{CassiniSoldner.forward4} and L{CassiniSoldner.forward6}.
|
|
333
337
|
'''
|
|
334
|
-
|
|
338
|
+
n, kwds = _name2__(LatLon_kwds_name, _or_nameof=self)
|
|
339
|
+
r = self.reverse4(easting, northing, name=n)
|
|
335
340
|
if LatLon is None:
|
|
336
341
|
r = LatLon2Tuple(r.lat, r.lon, name=r.name) # PYCHOK expected
|
|
337
342
|
else:
|
|
338
343
|
_xsubclassof(_LLEB, LatLon=LatLon)
|
|
339
|
-
kwds = _xkwds(
|
|
344
|
+
kwds = _xkwds(kwds, datum=self.datum, name=r.name)
|
|
340
345
|
r = LatLon(r.lat, r.lon, **kwds) # PYCHOK expected
|
|
341
346
|
self._datumatch(r)
|
|
342
347
|
return r
|
|
343
348
|
|
|
344
|
-
def reverse4(self, easting, northing, name
|
|
349
|
+
def reverse4(self, easting, northing, **name):
|
|
345
350
|
'''Convert a Cassini-Soldner location to (ellipsoidal) geodetic
|
|
346
351
|
lat- and longitude.
|
|
347
352
|
|
|
348
353
|
@arg easting: Easting of the location (C{meter}).
|
|
349
354
|
@arg northing: Northing of the location (C{meter}).
|
|
350
|
-
@kwarg name:
|
|
355
|
+
@kwarg name: Optional B{C{name}=NN} inlieu of this projection's
|
|
356
|
+
name (C{str}).
|
|
351
357
|
|
|
352
358
|
@return: A L{LatLonAziRk4Tuple}C{(lat, lon, azimuth, reciprocal)}.
|
|
353
359
|
|
|
@@ -361,7 +367,7 @@ class CassiniSoldner(_NamedBase):
|
|
|
361
367
|
# include z azimuth of easting direction and rk reciprocal
|
|
362
368
|
# of azimuthal northing scale (see C++ member Direct() 5/6
|
|
363
369
|
# <https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1Geodesic.html>)
|
|
364
|
-
return LatLonAziRk4Tuple(r.lat2, r.lon2, z, r.M12, name=
|
|
370
|
+
return LatLonAziRk4Tuple(r.lat2, r.lon2, z, r.M12, name=self._name__(name))
|
|
365
371
|
|
|
366
372
|
toLatLon = reverse # XXX not reverse4
|
|
367
373
|
|
|
@@ -396,7 +402,7 @@ class Css(_NamedBase):
|
|
|
396
402
|
_height = 0 # height (C{meter})
|
|
397
403
|
_northing = _0_0 # northing (C{float})
|
|
398
404
|
|
|
399
|
-
def __init__(self, e, n, h=0, cs0=None, name
|
|
405
|
+
def __init__(self, e, n, h=0, cs0=None, **name):
|
|
400
406
|
'''New L{Css} Cassini-Soldner position.
|
|
401
407
|
|
|
402
408
|
@arg e: Easting (C{meter}).
|
|
@@ -404,7 +410,7 @@ class Css(_NamedBase):
|
|
|
404
410
|
@kwarg h: Optional height (C{meter}).
|
|
405
411
|
@kwarg cs0: Optional, the Cassini-Soldner projection
|
|
406
412
|
(L{CassiniSoldner}).
|
|
407
|
-
@kwarg name: Optional name (C{str}).
|
|
413
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
408
414
|
|
|
409
415
|
@return: The Cassini-Soldner location (L{Css}).
|
|
410
416
|
|
|
@@ -447,20 +453,21 @@ class Css(_NamedBase):
|
|
|
447
453
|
_update_all(self)
|
|
448
454
|
self._cs0 = cs0
|
|
449
455
|
|
|
450
|
-
# def dup(self,
|
|
456
|
+
# def dup(self, **e_n_h_cs0_name): # PYCHOK signature
|
|
451
457
|
# '''Duplicate this position with some attributes modified.
|
|
452
458
|
#
|
|
453
|
-
# @kwarg
|
|
454
|
-
#
|
|
455
|
-
#
|
|
456
|
-
#
|
|
459
|
+
# @kwarg e_n_h_cs0_name: Use keyword argument C{B{e}=...},
|
|
460
|
+
# C{B{n}=...}, C{B{h}=...} and/or C{B{cs0}=...}
|
|
461
|
+
# to override the current C{easting}, C{northing}
|
|
462
|
+
# C{height} or C{cs0} projectio, respectively and
|
|
463
|
+
# an optional C{B{name}=NN} (C{str}).
|
|
457
464
|
# '''
|
|
458
465
|
# def _args_kwds(e=None, n=None, **kwds):
|
|
459
466
|
# return (e, n), kwds
|
|
460
467
|
#
|
|
461
468
|
# kwds = _xkwds(e_n_h_cs0, e=self.easting, n=self.northing,
|
|
462
469
|
# h=self.height, cs0=self.cs0,
|
|
463
|
-
# name=name
|
|
470
|
+
# name=_name__(name, _or_nameof(self)))
|
|
464
471
|
# args, kwds = _args_kwds(**kwds)
|
|
465
472
|
# return self.__class__(*args, **kwds) # .classof
|
|
466
473
|
|
|
@@ -596,7 +603,7 @@ class LatLonAziRk4Tuple(_NamedTuple):
|
|
|
596
603
|
_Units_ = ( Lat_, Lon_, Bearing, Scalar)
|
|
597
604
|
|
|
598
605
|
|
|
599
|
-
def toCss(latlon, cs0=None, height=None, Css=Css, name
|
|
606
|
+
def toCss(latlon, cs0=None, height=None, Css=Css, **name):
|
|
600
607
|
'''Convert an (ellipsoidal) geodetic point to a Cassini-Soldner
|
|
601
608
|
location.
|
|
602
609
|
|
|
@@ -605,8 +612,9 @@ def toCss(latlon, cs0=None, height=None, Css=Css, name=NN):
|
|
|
605
612
|
(L{CassiniSoldner}).
|
|
606
613
|
@kwarg height: Optional height for the point, overriding the
|
|
607
614
|
default height (C{meter}).
|
|
608
|
-
@kwarg Css: Optional class to return the location (L{Css}) or
|
|
609
|
-
|
|
615
|
+
@kwarg Css: Optional class to return the location (L{Css}) or
|
|
616
|
+
C{None}.
|
|
617
|
+
@kwarg name: Optional B{C{Css}} C{B{name}=NN} (C{str}).
|
|
610
618
|
|
|
611
619
|
@return: The Cassini-Soldner location (B{C{Css}}) or an
|
|
612
620
|
L{EasNor3Tuple}C{(easting, northing, height)}
|
|
@@ -627,7 +635,7 @@ def toCss(latlon, cs0=None, height=None, Css=Css, name=NN):
|
|
|
627
635
|
|
|
628
636
|
c = cs.forward4(latlon.lat, latlon.lon)
|
|
629
637
|
h = _heigHt(latlon, height)
|
|
630
|
-
n = name
|
|
638
|
+
n = latlon._name__(name)
|
|
631
639
|
|
|
632
640
|
if Css is None:
|
|
633
641
|
r = EasNor3Tuple(c.easting, c.northing, h, name=n)
|