pygeodesy 25.4.8__py2.py3-none-any.whl → 25.4.25__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/__init__.py +30 -27
- pygeodesy/__main__.py +3 -3
- pygeodesy/albers.py +29 -36
- pygeodesy/auxilats/_CX_4.py +2 -2
- pygeodesy/auxilats/_CX_6.py +2 -2
- pygeodesy/auxilats/_CX_8.py +2 -2
- pygeodesy/auxilats/_CX_Rs.py +9 -9
- pygeodesy/auxilats/__init__.py +3 -3
- pygeodesy/auxilats/__main__.py +8 -6
- pygeodesy/auxilats/auxAngle.py +2 -2
- pygeodesy/auxilats/auxLat.py +5 -5
- pygeodesy/auxilats/auxily.py +5 -3
- pygeodesy/azimuthal.py +7 -6
- pygeodesy/basics.py +31 -17
- pygeodesy/booleans.py +12 -10
- pygeodesy/cartesianBase.py +21 -20
- pygeodesy/clipy.py +11 -10
- pygeodesy/constants.py +11 -10
- pygeodesy/css.py +14 -11
- pygeodesy/datums.py +8 -8
- pygeodesy/deprecated/bases.py +2 -2
- pygeodesy/deprecated/classes.py +2 -2
- pygeodesy/deprecated/consterns.py +4 -4
- pygeodesy/dms.py +8 -8
- pygeodesy/ecef.py +10 -7
- pygeodesy/elevations.py +9 -8
- pygeodesy/ellipsoidalBase.py +19 -8
- pygeodesy/ellipsoidalBaseDI.py +17 -15
- pygeodesy/ellipsoidalNvector.py +6 -3
- pygeodesy/ellipsoidalVincenty.py +4 -1
- pygeodesy/ellipsoids.py +167 -138
- pygeodesy/elliptic.py +9 -9
- pygeodesy/errors.py +44 -43
- pygeodesy/etm.py +7 -7
- pygeodesy/fmath.py +10 -9
- pygeodesy/formy.py +11 -12
- pygeodesy/frechet.py +216 -109
- pygeodesy/fstats.py +5 -4
- pygeodesy/fsums.py +78 -77
- pygeodesy/gars.py +4 -3
- pygeodesy/geodesici.py +15 -14
- pygeodesy/geodesicw.py +34 -32
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/__main__.py +11 -9
- pygeodesy/geodesicx/gx.py +30 -33
- pygeodesy/geodesicx/gxarea.py +2 -2
- pygeodesy/geodesicx/gxline.py +5 -5
- pygeodesy/geodsolve.py +18 -17
- pygeodesy/geohash.py +5 -5
- pygeodesy/geoids.py +34 -31
- pygeodesy/hausdorff.py +17 -13
- pygeodesy/heights.py +2 -4
- pygeodesy/internals.py +28 -44
- pygeodesy/interns.py +10 -7
- pygeodesy/iters.py +8 -8
- pygeodesy/karney.py +68 -62
- pygeodesy/ktm.py +5 -5
- pygeodesy/latlonBase.py +14 -18
- pygeodesy/lazily.py +65 -63
- pygeodesy/lcc.py +11 -9
- pygeodesy/ltp.py +8 -7
- pygeodesy/ltpTuples.py +2 -2
- pygeodesy/mgrs.py +7 -6
- pygeodesy/named.py +47 -31
- pygeodesy/nvectorBase.py +7 -7
- pygeodesy/osgr.py +9 -8
- pygeodesy/points.py +12 -10
- pygeodesy/props.py +25 -25
- pygeodesy/resections.py +11 -10
- pygeodesy/rhumb/__init__.py +1 -1
- pygeodesy/rhumb/aux_.py +7 -7
- pygeodesy/rhumb/bases.py +22 -20
- pygeodesy/rhumb/ekx.py +6 -6
- pygeodesy/rhumb/solve.py +15 -15
- pygeodesy/solveBase.py +3 -3
- pygeodesy/sphericalBase.py +6 -6
- pygeodesy/sphericalNvector.py +6 -5
- pygeodesy/sphericalTrigonometry.py +8 -7
- pygeodesy/streprs.py +14 -14
- pygeodesy/trf.py +14 -12
- pygeodesy/triaxials.py +29 -26
- pygeodesy/units.py +5 -4
- pygeodesy/unitsBase.py +5 -4
- pygeodesy/ups.py +3 -3
- pygeodesy/utily.py +4 -4
- pygeodesy/utmups.py +4 -4
- pygeodesy/utmupsBase.py +88 -18
- pygeodesy/vector2d.py +18 -11
- pygeodesy/vector3d.py +7 -6
- pygeodesy/webmercator.py +6 -5
- pygeodesy/wgrs.py +6 -5
- {pygeodesy-25.4.8.dist-info → pygeodesy-25.4.25.dist-info}/METADATA +27 -23
- pygeodesy-25.4.25.dist-info/RECORD +118 -0
- pygeodesy-25.4.8.dist-info/RECORD +0 -118
- {pygeodesy-25.4.8.dist-info → pygeodesy-25.4.25.dist-info}/WHEEL +0 -0
- {pygeodesy-25.4.8.dist-info → pygeodesy-25.4.25.dist-info}/top_level.txt +0 -0
pygeodesy/basics.py
CHANGED
|
@@ -20,8 +20,8 @@ from pygeodesy.errors import _AttributeError, _ImportError, _NotImplementedError
|
|
|
20
20
|
_TypeError, _TypesError, _ValueError, _xAssertionError, \
|
|
21
21
|
_xkwds_get1
|
|
22
22
|
# from pygeodesy.fsums import _isFsum_2Tuple # _MODS
|
|
23
|
-
from pygeodesy.internals import _0_0, _enquote, _getenv, _passarg,
|
|
24
|
-
_version_info
|
|
23
|
+
from pygeodesy.internals import _0_0, _enquote, _envPYGEODESY, _getenv, _passarg, \
|
|
24
|
+
_PYGEODESY_ENV, typename, _version_info
|
|
25
25
|
from pygeodesy.interns import MISSING, NN, _1_, _by_, _COMMA_, _DOT_, _DEPRECATED_, \
|
|
26
26
|
_ELLIPSIS4_, _EQUAL_, _in_, _invalid_, _N_A_, _not_, \
|
|
27
27
|
_not_scalar_, _odd_, _SPACE_, _UNDER_, _version_
|
|
@@ -37,7 +37,7 @@ from math import copysign as _copysign
|
|
|
37
37
|
# import inspect as _inspect # _MODS
|
|
38
38
|
|
|
39
39
|
__all__ = _ALL_LAZY.basics
|
|
40
|
-
__version__ = '25.
|
|
40
|
+
__version__ = '25.04.14'
|
|
41
41
|
|
|
42
42
|
_below_ = 'below'
|
|
43
43
|
_list_tuple_types = (list, tuple)
|
|
@@ -312,17 +312,23 @@ def iscomplex(obj, both=False):
|
|
|
312
312
|
return False
|
|
313
313
|
|
|
314
314
|
|
|
315
|
-
def isDEPRECATED(obj):
|
|
316
|
-
'''Is B{C{obj}}ect a C{DEPRECATED}
|
|
315
|
+
def isDEPRECATED(obj, outer=1):
|
|
316
|
+
'''Is B{C{obj}}ect or its outer C{type} a C{DEPRECATED}
|
|
317
|
+
class, constant, method or function?
|
|
317
318
|
|
|
318
319
|
@return: C{True} if C{DEPRECATED}, {False} if not or
|
|
319
320
|
C{None} if undetermined.
|
|
320
321
|
'''
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
r = None
|
|
323
|
+
for _ in range(max(0, outer) + 1):
|
|
324
|
+
try: # inspect.getdoc(obj)
|
|
325
|
+
if _DEPRECATED_ in obj.__doc__:
|
|
326
|
+
return True
|
|
327
|
+
r = False
|
|
328
|
+
except AttributeError:
|
|
329
|
+
pass
|
|
330
|
+
obj = type(obj)
|
|
331
|
+
return r
|
|
326
332
|
|
|
327
333
|
|
|
328
334
|
def isfloat(obj, both=False):
|
|
@@ -352,6 +358,13 @@ except AttributeError: # Python 2-
|
|
|
352
358
|
and not obj[:1].isdigit())
|
|
353
359
|
|
|
354
360
|
|
|
361
|
+
def _isin(obj, *objs):
|
|
362
|
+
'''(INTERNAL) Return C{bool(obj in objs)} with C{True} and C{False} matching.
|
|
363
|
+
'''
|
|
364
|
+
return any(o is obj for o in objs) or \
|
|
365
|
+
any(o == obj for o in objs if not isbool(o))
|
|
366
|
+
|
|
367
|
+
|
|
355
368
|
def isinstanceof(obj, *Classes):
|
|
356
369
|
'''Is B{C{obj}}ect an instance of one of the C{Classes}?
|
|
357
370
|
|
|
@@ -905,8 +918,8 @@ def _xiterablen(obj):
|
|
|
905
918
|
def _xiterror(obj, _xwhich):
|
|
906
919
|
'''(INTERNAL) Helper for C{_xinterable} and C{_xiterablen}.
|
|
907
920
|
'''
|
|
908
|
-
t =
|
|
909
|
-
raise _TypeError(repr(obj), txt=t)
|
|
921
|
+
t = typename(_xwhich)[2:] # less '_x'
|
|
922
|
+
raise _TypeError(repr(obj), txt=_not_(t))
|
|
910
923
|
|
|
911
924
|
|
|
912
925
|
def _xnumpy(where, *required):
|
|
@@ -928,13 +941,13 @@ def _xor(x, *xs):
|
|
|
928
941
|
return x
|
|
929
942
|
|
|
930
943
|
|
|
931
|
-
def _xpackages(
|
|
944
|
+
def _xpackages(_xhich):
|
|
932
945
|
'''(INTERNAL) Check dependency to be excluded.
|
|
933
946
|
'''
|
|
934
947
|
if _XPACKAGES: # PYCHOK no cover
|
|
935
|
-
n =
|
|
948
|
+
n = typename(_xhich)[2:] # less '_x'
|
|
936
949
|
if n.lower() in _XPACKAGES:
|
|
937
|
-
E =
|
|
950
|
+
E = _PYGEODESY_ENV(_xpackages_)
|
|
938
951
|
x = _SPACE_(n, _in_, E)
|
|
939
952
|
e = _enquote(_getenv(E, NN))
|
|
940
953
|
raise ImportError(_EQUAL_(x, e))
|
|
@@ -984,7 +997,7 @@ def _xversion(package, where, *required, **name):
|
|
|
984
997
|
if required:
|
|
985
998
|
t = _version_info(package)
|
|
986
999
|
if t[:len(required)] < required:
|
|
987
|
-
t = _SPACE_(package
|
|
1000
|
+
t = _SPACE_(typename(package),
|
|
988
1001
|
_version_, _DOT_(*t),
|
|
989
1002
|
_below_, _DOT_(*required),
|
|
990
1003
|
_req_d_by(where, **name))
|
|
@@ -1011,7 +1024,8 @@ else: # Python 3.10+
|
|
|
1011
1024
|
def _zip(*args):
|
|
1012
1025
|
return zip(*args, strict=True)
|
|
1013
1026
|
|
|
1014
|
-
|
|
1027
|
+
_xpackages_ = typename(_xpackages).lstrip(_UNDER_)
|
|
1028
|
+
_XPACKAGES = _splituple(_envPYGEODESY(_xpackages_).lower()) # test/bases._X_OK
|
|
1015
1029
|
|
|
1016
1030
|
# **) MIT License
|
|
1017
1031
|
#
|
pygeodesy/booleans.py
CHANGED
|
@@ -17,12 +17,14 @@ 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 _isin, isodd, issubclassof, map2, \
|
|
21
|
+
_xscalar, typename
|
|
21
22
|
from pygeodesy.constants import EPS, EPS2, INT0, _0_0, _0_5, _1_0
|
|
22
23
|
from pygeodesy.errors import ClipError, _IsnotError, _TypeError, \
|
|
23
24
|
_ValueError, _xattr, _xkwds_get, _xkwds_pop2
|
|
24
25
|
from pygeodesy.fmath import favg, fdot_, hypot, hypot2
|
|
25
26
|
# from pygeodesy.fsums import fsum1 # _MODS
|
|
27
|
+
# from pygeodesy.internals import typename # from .basics
|
|
26
28
|
from pygeodesy.interns import NN, _BANG_, _clipid_, _COMMASPACE_, \
|
|
27
29
|
_composite_, _DOT_, _duplicate_, _e_, \
|
|
28
30
|
_ELLIPSIS_, _few_, _height_, _lat_, _LatLon_, \
|
|
@@ -43,7 +45,7 @@ from pygeodesy.utily import fabs, _unrollon, _Wrap
|
|
|
43
45
|
# from math import fabs # from .utily
|
|
44
46
|
|
|
45
47
|
__all__ = _ALL_LAZY.booleans
|
|
46
|
-
__version__ = '
|
|
48
|
+
__version__ = '25.04.14'
|
|
47
49
|
|
|
48
50
|
_0EPS = EPS # near-zero, positive
|
|
49
51
|
_EPS0 = -EPS # near-zero, negative
|
|
@@ -352,11 +354,11 @@ class LatLonFHP(_LatLonBool):
|
|
|
352
354
|
def _isduplicate(self):
|
|
353
355
|
# Is this point a I{duplicate} intersection?
|
|
354
356
|
p = self._dupof
|
|
355
|
-
return bool(p and
|
|
356
|
-
and
|
|
357
|
-
and
|
|
358
|
-
# and p._alpha
|
|
359
|
-
and self._alpha
|
|
357
|
+
return bool(p and self._linked
|
|
358
|
+
and p is not self
|
|
359
|
+
and p == self
|
|
360
|
+
# and _isin(p._alpha, None, self._alpha)
|
|
361
|
+
and _isin(self._alpha, _0_0, p._alpha))
|
|
360
362
|
|
|
361
363
|
# @property_RO
|
|
362
364
|
# def _isduplicated(self):
|
|
@@ -940,7 +942,7 @@ class _CompositeBase(_Named):
|
|
|
940
942
|
c = Fmt.SQUARE(c) if c > 1 else NN
|
|
941
943
|
n = Fmt.SQUARE(len(self))
|
|
942
944
|
t = Fmt.PAREN(self) # XXX not unstr
|
|
943
|
-
return NN(self.
|
|
945
|
+
return NN(self.typename, c, n, t)
|
|
944
946
|
|
|
945
947
|
def __str__(self):
|
|
946
948
|
'''String C{str} of this composite.
|
|
@@ -1051,7 +1053,7 @@ class _CompositeBase(_Named):
|
|
|
1051
1053
|
def _kwds(self, op, **more):
|
|
1052
1054
|
# Get all keyword arguments as C{dict}.
|
|
1053
1055
|
kwds = dict(raiser=self.raiser, eps=self.eps,
|
|
1054
|
-
name=self.name or op
|
|
1056
|
+
name=self.name or typename(op))
|
|
1055
1057
|
kwds.update(more)
|
|
1056
1058
|
return kwds
|
|
1057
1059
|
|
|
@@ -1105,7 +1107,7 @@ class _CompositeBase(_Named):
|
|
|
1105
1107
|
def _sum(self, other, op):
|
|
1106
1108
|
# Combine this and an C{other} composite
|
|
1107
1109
|
LL = self._LL
|
|
1108
|
-
sp = self.copy(name=self.name or op
|
|
1110
|
+
sp = self.copy(name=self.name or typename(op))
|
|
1109
1111
|
sp._clips, sid = (), INT0 # new clips
|
|
1110
1112
|
for cp in (self, other):
|
|
1111
1113
|
for c in cp._clips:
|
pygeodesy/cartesianBase.py
CHANGED
|
@@ -10,17 +10,18 @@ U{https://www.Movable-Type.co.UK/scripts/latlong-vectors.html} and
|
|
|
10
10
|
U{https://www.Movable-Type.co.UK/scripts/geodesy/docs/latlon-ellipsoidal.js.html}.
|
|
11
11
|
'''
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
from pygeodesy.basics import _isin, _xinstanceof, typename
|
|
14
14
|
from pygeodesy.constants import EPS, EPS0, INT0, PI2, _isfinite, isnear0, \
|
|
15
15
|
_0_0, _1_0, _N_1_0, _2_0, _4_0, _6_0
|
|
16
16
|
from pygeodesy.datums import Datum, _earth_ellipsoid, _spherical_datum, \
|
|
17
|
-
Transform, _WGS84
|
|
17
|
+
Transform, _WGS84
|
|
18
18
|
# from pygeodesy.ecef import EcefKarney # _MODS
|
|
19
19
|
from pygeodesy.errors import _IsnotError, _TypeError, _ValueError, _xattr, \
|
|
20
20
|
_xdatum, _xkwds, _xkwds_get, _xkwds_pop2
|
|
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.internals import typename # from .basics
|
|
24
25
|
from pygeodesy.interns import _COMMASPACE_, _datum_, _no_, _phi_
|
|
25
26
|
from pygeodesy.interns import _ellipsoidal_, _spherical_ # PYCHOK used!
|
|
26
27
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
@@ -30,8 +31,7 @@ from pygeodesy.namedTuples import LatLon4Tuple, _NamedTupleTo , Vector3Tuple, \
|
|
|
30
31
|
# from pygeodesy.nvectorBase import _N_vector # _MODS
|
|
31
32
|
from pygeodesy.props import deprecated_method, Property, Property_RO, property_doc_, \
|
|
32
33
|
property_RO, _update_all
|
|
33
|
-
# from pygeodesy
|
|
34
|
-
# tienstra7 # _MODS
|
|
34
|
+
# from pygeodesy import resections as _resections # _MODS.into
|
|
35
35
|
# from pygeodesy.streprs import Fmt # from .fsums
|
|
36
36
|
# from pygeodesy.triaxials import Triaxial_ # _MODS
|
|
37
37
|
from pygeodesy.units import Degrees, Height, _heigHt, _isMeter, Meter, Radians
|
|
@@ -43,10 +43,11 @@ from pygeodesy.vector3d import Vector3d, _xyzhdlln4
|
|
|
43
43
|
# from math import degrees, fabs, radians, sqrt # from .fmath, .utily
|
|
44
44
|
|
|
45
45
|
__all__ = _ALL_LAZY.cartesianBase
|
|
46
|
-
__version__ = '
|
|
46
|
+
__version__ = '25.04.21'
|
|
47
47
|
|
|
48
|
-
_r_
|
|
49
|
-
|
|
48
|
+
_r_ = 'r'
|
|
49
|
+
_resections = _MODS.into(resections=__name__)
|
|
50
|
+
_theta_ = 'theta'
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
class CartesianBase(Vector3d, _NamedLocal):
|
|
@@ -112,8 +113,8 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
112
113
|
|
|
113
114
|
@see: Function L{pygeodesy.cassini} for references and more details.
|
|
114
115
|
'''
|
|
115
|
-
return
|
|
116
|
-
|
|
116
|
+
return _resections.cassini(self, pointB, pointC, alpha, beta,
|
|
117
|
+
useZ=useZ, datum=self.datum)
|
|
117
118
|
|
|
118
119
|
@deprecated_method
|
|
119
120
|
def collins(self, pointB, pointC, alpha, beta, useZ=False):
|
|
@@ -148,8 +149,8 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
148
149
|
|
|
149
150
|
@see: Function L{pygeodesy.collins5} for references and more details.
|
|
150
151
|
'''
|
|
151
|
-
return
|
|
152
|
-
|
|
152
|
+
return _resections.collins5(self, pointB, pointC, alpha, beta,
|
|
153
|
+
useZ=useZ, datum=self.datum)
|
|
153
154
|
|
|
154
155
|
@deprecated_method
|
|
155
156
|
def convertDatum(self, datum2, **datum):
|
|
@@ -304,7 +305,7 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
304
305
|
|
|
305
306
|
@raise TypeError: Invalid or undefined B{C{earth}} or C{datum}.
|
|
306
307
|
'''
|
|
307
|
-
n = self.height3
|
|
308
|
+
n = typename(self.height3)
|
|
308
309
|
d = self.datum if earth is None else _spherical_datum(earth, name=n)
|
|
309
310
|
c, h = self, _heigHt(self, height)
|
|
310
311
|
if h and d:
|
|
@@ -357,7 +358,7 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
357
358
|
|
|
358
359
|
@see: Methods L{Ellipsoid.height4} and L{Triaxial_.height4} for more information.
|
|
359
360
|
'''
|
|
360
|
-
n = self.height4
|
|
361
|
+
n = typename(self.height4)
|
|
361
362
|
d = self.datum if earth is None else earth
|
|
362
363
|
if normal and d is self.datum:
|
|
363
364
|
r = self._height4
|
|
@@ -504,8 +505,8 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
504
505
|
|
|
505
506
|
@see: Function L{pygeodesy.pierlot} for references and more details.
|
|
506
507
|
'''
|
|
507
|
-
return
|
|
508
|
-
|
|
508
|
+
return _resections.pierlot(self, point2, point3, alpha12, alpha23,
|
|
509
|
+
useZ=useZ, eps=eps, datum=self.datum)
|
|
509
510
|
|
|
510
511
|
def pierlotx(self, point2, point3, alpha1, alpha2, alpha3, useZ=False):
|
|
511
512
|
'''3-Point resection between this and two other points using U{Pierlot
|
|
@@ -531,8 +532,8 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
531
532
|
|
|
532
533
|
@see: Function L{pygeodesy.pierlotx} for references and more details.
|
|
533
534
|
'''
|
|
534
|
-
return
|
|
535
|
-
|
|
535
|
+
return _resections.pierlotx(self, point2, point3, alpha1, alpha2, alpha3,
|
|
536
|
+
useZ=useZ, datum=self.datum)
|
|
536
537
|
|
|
537
538
|
def Roc2(self, earth=None):
|
|
538
539
|
'''Compute this cartesian's I{normal} and I{pseudo, z-based} radius of curvature.
|
|
@@ -605,8 +606,8 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
605
606
|
|
|
606
607
|
@see: Function L{pygeodesy.tienstra7} for references and more details.
|
|
607
608
|
'''
|
|
608
|
-
return
|
|
609
|
-
|
|
609
|
+
return _resections.tienstra7(self, pointB, pointC, alpha, beta, gamma,
|
|
610
|
+
useZ=useZ, datum=self.datum)
|
|
610
611
|
|
|
611
612
|
@deprecated_method
|
|
612
613
|
def to2ab(self): # PYCHOK no cover
|
|
@@ -659,7 +660,7 @@ class CartesianBase(Vector3d, _NamedLocal):
|
|
|
659
660
|
'''
|
|
660
661
|
_xinstanceof(Datum, datum2=datum2)
|
|
661
662
|
|
|
662
|
-
c = self if datum
|
|
663
|
+
c = self if _isin(datum, None, self.datum) else \
|
|
663
664
|
self.toDatum(datum)
|
|
664
665
|
|
|
665
666
|
i, d = False, c.datum
|
pygeodesy/clipy.py
CHANGED
|
@@ -12,11 +12,12 @@ I{Greiner-Hormann} and L{clipSH} and L{clipSH3} I{Sutherland-Hodgeman}.
|
|
|
12
12
|
# make sure int/int division yields float quotient, see .basics
|
|
13
13
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
from pygeodesy.basics import len2, typename
|
|
16
16
|
from pygeodesy.constants import EPS, _0_0, _1_0
|
|
17
17
|
from pygeodesy.errors import _AssertionError, ClipError, PointsError
|
|
18
|
-
from pygeodesy.fmath import fabs,
|
|
18
|
+
from pygeodesy.fmath import fabs, Fsum
|
|
19
19
|
# from pygeodesy.fsums import Fsum # from .fmath
|
|
20
|
+
# from pygeodesy.internals import typename # from .basics
|
|
20
21
|
from pygeodesy.interns import NN, _clipid_, _convex_, _DOT_, _end_, _few_, \
|
|
21
22
|
_fi_, _height_, _i_, _invalid_, _j_, _lat_, \
|
|
22
23
|
_lon_, _near_, _not_, _points_, _start_, _too_
|
|
@@ -30,7 +31,7 @@ from pygeodesy.units import Bool, FIx, HeightX, Lat, Lon, Number_
|
|
|
30
31
|
# from math import fabs # from .fmath
|
|
31
32
|
|
|
32
33
|
__all__ = _ALL_LAZY.clipy
|
|
33
|
-
__version__ = '
|
|
34
|
+
__version__ = '25.04.14'
|
|
34
35
|
|
|
35
36
|
_fj_ = 'fj'
|
|
36
37
|
_original_ = 'original'
|
|
@@ -126,7 +127,7 @@ class _CS(_Named):
|
|
|
126
127
|
# elif c & _CS._XR:
|
|
127
128
|
# return self.lat4(p, self._xr)
|
|
128
129
|
# # should never get here
|
|
129
|
-
# raise _AssertionError(self._DOT_(self.clip4
|
|
130
|
+
# raise _AssertionError(self._DOT_(typename(self.clip4)))
|
|
130
131
|
|
|
131
132
|
def code4(self, p): # compute code for point p
|
|
132
133
|
if p.lat < self._yb:
|
|
@@ -168,7 +169,7 @@ class _CS(_Named):
|
|
|
168
169
|
|
|
169
170
|
def nop4(self, b, p): # PYCHOK no cover
|
|
170
171
|
if p: # should never get here
|
|
171
|
-
raise _AssertionError(self._DOT_(self.nop4
|
|
172
|
+
raise _AssertionError(self._DOT_(typename(self.nop4)))
|
|
172
173
|
return _CS._IN, self.nop4, b, p
|
|
173
174
|
|
|
174
175
|
|
|
@@ -202,7 +203,7 @@ def clipCS4(points, lowerleft, upperight, closed=False, inull=False):
|
|
|
202
203
|
@raise PointsError: Insufficient number of B{C{points}}.
|
|
203
204
|
'''
|
|
204
205
|
T4 = ClipCS4Tuple
|
|
205
|
-
cs = _CS(lowerleft, upperight, name=clipCS4
|
|
206
|
+
cs = _CS(lowerleft, upperight, name=typename(clipCS4))
|
|
206
207
|
n, pts = _pts2(points, closed, inull)
|
|
207
208
|
|
|
208
209
|
i, m = _imdex2(closed, n)
|
|
@@ -398,7 +399,7 @@ def clipLB6(points, lowerleft, upperight, closed=False, inull=False):
|
|
|
398
399
|
U{Liang-Barsky algorithm<https://WikiPedia.org/wiki/Liang-Barsky_algorithm>}.
|
|
399
400
|
'''
|
|
400
401
|
xl, yb, \
|
|
401
|
-
xr, yt = _box4(lowerleft, upperight, clipLB6
|
|
402
|
+
xr, yt = _box4(lowerleft, upperight, typename(clipLB6))
|
|
402
403
|
n, pts = _pts2(points, closed, inull)
|
|
403
404
|
|
|
404
405
|
T6 = ClipLB6Tuple
|
|
@@ -578,7 +579,7 @@ class _SH(_Named):
|
|
|
578
579
|
fx = float(p2.lon - x)
|
|
579
580
|
d = fy * dx - fx * dy # fdot((fx, fy), dx, -dy)
|
|
580
581
|
if fabs(d) < EPS: # PYCHOK no cover
|
|
581
|
-
raise _AssertionError(self._DOT_(self.intersect
|
|
582
|
+
raise _AssertionError(self._DOT_(typename(self.intersect)))
|
|
582
583
|
d = Fsum(self._xy, -y * dx, x * dy).fover(d)
|
|
583
584
|
y += d * fy
|
|
584
585
|
x += d * fx
|
|
@@ -644,7 +645,7 @@ def clipSH(points, corners, closed=False, inull=False):
|
|
|
644
645
|
|
|
645
646
|
@raise PointsError: Insufficient number of B{C{points}}.
|
|
646
647
|
'''
|
|
647
|
-
sh = _SH(corners, name=clipSH
|
|
648
|
+
sh = _SH(corners, name=typename(clipSH))
|
|
648
649
|
n, pts = sh.clip2(points, closed, inull)
|
|
649
650
|
for i in range(n):
|
|
650
651
|
p, _ = sh.clipped2(pts[i])
|
|
@@ -671,7 +672,7 @@ def clipSH3(points, corners, closed=False, inull=False):
|
|
|
671
672
|
|
|
672
673
|
@raise PointsError: Insufficient number of B{C{points}} or B{C{corners}}.
|
|
673
674
|
'''
|
|
674
|
-
sh = _SH(corners, name=clipSH3
|
|
675
|
+
sh = _SH(corners, name=typename(clipSH3))
|
|
675
676
|
n, pts = sh.clip2(points, closed, inull)
|
|
676
677
|
if n > 1:
|
|
677
678
|
T3 = ClipSH3Tuple
|
pygeodesy/constants.py
CHANGED
|
@@ -13,8 +13,8 @@ from __future__ import division as _; del _ # PYCHOK semicolon
|
|
|
13
13
|
from pygeodesy.basics import _copysign, isbool, iscomplex, isint
|
|
14
14
|
from pygeodesy.errors import _xError, _xError2, _xkwds_get1, _xkwds_item2
|
|
15
15
|
# from pygeodesy.fsums import _isFsum_2Tuple # _MODS
|
|
16
|
-
from pygeodesy.internals import _0_0, _100_0
|
|
17
|
-
from pygeodesy.interns import _INF_, _NAN_
|
|
16
|
+
from pygeodesy.internals import _0_0, _100_0, typename
|
|
17
|
+
from pygeodesy.interns import _DMAIN_, _INF_, _NAN_
|
|
18
18
|
from pygeodesy.lazily import _ALL_MODS as _MODS, _ALL_LAZY
|
|
19
19
|
# from pygeodesy.streprs import Fmt # from .unitsBase
|
|
20
20
|
from pygeodesy.unitsBase import Float, Int, Radius, Fmt
|
|
@@ -26,7 +26,7 @@ except ImportError: # Python 2-
|
|
|
26
26
|
_inf, _nan = float(_INF_), float(_NAN_)
|
|
27
27
|
|
|
28
28
|
__all__ = _ALL_LAZY.constants
|
|
29
|
-
__version__ = '
|
|
29
|
+
__version__ = '25.04.14'
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def _copysign_0_0(y):
|
|
@@ -360,7 +360,7 @@ def isfinite(obj):
|
|
|
360
360
|
return _iscfinite(obj)
|
|
361
361
|
if _MODS.fsums._isFsum_2Tuple(obj): # OverflowError
|
|
362
362
|
return obj.is_finite()
|
|
363
|
-
raise _xError(x, Fmt.PAREN(isfinite
|
|
363
|
+
raise _xError(x, Fmt.PAREN(typename(isfinite), obj))
|
|
364
364
|
|
|
365
365
|
|
|
366
366
|
def isint0(obj, both=False):
|
|
@@ -493,13 +493,14 @@ def _umod_PI2(rad):
|
|
|
493
493
|
return (rad % PI2) or _0_0
|
|
494
494
|
|
|
495
495
|
|
|
496
|
-
if __name__ ==
|
|
496
|
+
if __name__ == _DMAIN_:
|
|
497
497
|
|
|
498
|
-
def _main():
|
|
498
|
+
def _main(locals):
|
|
499
499
|
from pygeodesy import itemsorted, printf
|
|
500
|
+
from pygeodesy.interns import _DALL_, _UNDER_
|
|
500
501
|
|
|
501
502
|
t = n = v = []
|
|
502
|
-
for n, v in itemsorted(locals
|
|
503
|
+
for n, v in itemsorted(locals):
|
|
503
504
|
if isinstance(v, (Float, Int, Radius)):
|
|
504
505
|
printf('%9s: %r', n, v.toRepr(std=False))
|
|
505
506
|
if v.name != n:
|
|
@@ -508,10 +509,10 @@ if __name__ == '__main__':
|
|
|
508
509
|
raise AssertionError('%r is not %r' % (n, v))
|
|
509
510
|
if not n.startswith(_UNDER_):
|
|
510
511
|
t.append(n)
|
|
511
|
-
t.append(float_
|
|
512
|
-
printf('
|
|
512
|
+
t.append(typename(float_))
|
|
513
|
+
printf('%s = %r', _DALL_, tuple(t))
|
|
513
514
|
|
|
514
|
-
_main()
|
|
515
|
+
_main(locals())
|
|
515
516
|
|
|
516
517
|
# **) MIT License
|
|
517
518
|
#
|
pygeodesy/css.py
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
u'''Cassini-Soldner (CSS) projection.
|
|
5
5
|
|
|
6
|
-
Classes L{CassiniSoldner}, L{Css} and L{CSSError}
|
|
7
|
-
U{geographiclib <https://PyPI.org/project/geographiclib>} Python package
|
|
8
|
-
installed.
|
|
6
|
+
Classes L{CassiniSoldner}, L{Css} and L{CSSError} use I{Charles Karney}'s
|
|
7
|
+
U{geographiclib <https://PyPI.org/project/geographiclib>} Python package
|
|
8
|
+
if installed, see property L{CassiniSoldner.geodesic}.
|
|
9
9
|
'''
|
|
10
10
|
|
|
11
|
-
from pygeodesy.basics import islistuple, neg, _xinstanceof,
|
|
11
|
+
from pygeodesy.basics import _isin, islistuple, neg, _xinstanceof, \
|
|
12
|
+
_xsubclassof
|
|
12
13
|
from pygeodesy.constants import _umod_360, _0_0, _0_5, _90_0
|
|
13
14
|
from pygeodesy.datums import _ellipsoidal_datum, _WGS84
|
|
14
15
|
from pygeodesy.ellipsoidalBase import LatLonEllipsoidalBase as _LLEB
|
|
@@ -33,7 +34,7 @@ from pygeodesy.units import Azimuth, Degrees, Easting, Height, _heigHt, \
|
|
|
33
34
|
# from math import fabs # from .karney
|
|
34
35
|
|
|
35
36
|
__all__ = _ALL_LAZY.css
|
|
36
|
-
__version__ = '
|
|
37
|
+
__version__ = '25.04.14'
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
def _CS0(cs0):
|
|
@@ -76,7 +77,7 @@ class CassiniSoldner(_NamedBase):
|
|
|
76
77
|
|
|
77
78
|
@raise CSSError: Invalid B{C{lat}} or B{C{lon}}.
|
|
78
79
|
'''
|
|
79
|
-
if
|
|
80
|
+
if not _isin(datum, None, self._datum):
|
|
80
81
|
self._datum = _xellipsoidal(datum=_ellipsoidal_datum(datum, **name))
|
|
81
82
|
if name:
|
|
82
83
|
self.name = name
|
|
@@ -217,9 +218,10 @@ class CassiniSoldner(_NamedBase):
|
|
|
217
218
|
@Property
|
|
218
219
|
def geodesic(self):
|
|
219
220
|
'''Get this projection's I{wrapped} U{geodesic.Geodesic
|
|
220
|
-
<https://GeographicLib.SourceForge.io/Python/doc/code.html>}
|
|
221
|
+
<https://GeographicLib.SourceForge.io/Python/doc/code.html>} from
|
|
221
222
|
I{Karney}'s U{geographiclib<https://PyPI.org/project/geographiclib>}
|
|
222
|
-
package
|
|
223
|
+
package if installed, otherwise an I{exact} L{GeodesicExact
|
|
224
|
+
<pygeodesy.geodesicx.GeodesicExact>} instance.
|
|
223
225
|
'''
|
|
224
226
|
g = self._geodesic
|
|
225
227
|
if g is None:
|
|
@@ -247,7 +249,8 @@ class CassiniSoldner(_NamedBase):
|
|
|
247
249
|
|
|
248
250
|
@Property_RO
|
|
249
251
|
def isExact(self):
|
|
250
|
-
'''Return C{True} if this projection's geodesic is L{GeodesicExact
|
|
252
|
+
'''Return C{True} if this projection's geodesic is L{GeodesicExact
|
|
253
|
+
<pygeodesy.geodesicx.GeodesicExact>}.
|
|
251
254
|
'''
|
|
252
255
|
return isinstance(self.geodesic, _MODS.geodesicx.GeodesicExact)
|
|
253
256
|
|
|
@@ -306,8 +309,8 @@ class CassiniSoldner(_NamedBase):
|
|
|
306
309
|
|
|
307
310
|
g = self.geodesic
|
|
308
311
|
self._meridian = m = g.Line(Lat_(lat0=lat0, Error=CSSError),
|
|
309
|
-
Lon_(lon0=lon0, Error=CSSError),
|
|
310
|
-
|
|
312
|
+
Lon_(lon0=lon0, Error=CSSError),
|
|
313
|
+
_0_0, caps=g.STANDARD_LINE | g.LINE_OFF)
|
|
311
314
|
self._latlon0 = LatLon2Tuple(m.lat1, m.lon1)
|
|
312
315
|
s, c = _sincos2d(m.lat1) # == self.lat0 == self.LatitudeOrigin()
|
|
313
316
|
self._sb0, self._cb0 = _norm2(s * g.f1, c)
|
pygeodesy/datums.py
CHANGED
|
@@ -67,7 +67,7 @@ datum, q.v. U{"A Guide to Coordinate Systems in Great Britain", Section 6
|
|
|
67
67
|
# make sure int/int division yields float quotient, see .basics
|
|
68
68
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
69
69
|
|
|
70
|
-
from pygeodesy.basics import islistuple, map2, neg, _xinstanceof, _zip
|
|
70
|
+
from pygeodesy.basics import _isin, islistuple, map2, neg, _xinstanceof, _zip
|
|
71
71
|
from pygeodesy.constants import R_M, _float as _F, _0_0, _1_0, _2_0, _8_0, _3600_0
|
|
72
72
|
# from pygeodesy.ellipsoidalBase import CartesianEllipsoidalBase as _CEB, \
|
|
73
73
|
# LatLonEllipsoidalBase as _LLEB # MODS
|
|
@@ -77,10 +77,10 @@ from pygeodesy.errors import _IsnotError, _TypeError, _xellipsoidall, _xkwds, _x
|
|
|
77
77
|
from pygeodesy.fmath import fdot, fmean, Fmt, _operator
|
|
78
78
|
from pygeodesy.internals import _passarg, _under
|
|
79
79
|
from pygeodesy.interns import NN, _a_, _Airy1830_, _AiryModified_, _BAR_, _Bessel1841_, \
|
|
80
|
-
_Clarke1866_, _Clarke1880IGN_, _COMMASPACE_, _DOT_,
|
|
81
|
-
_ellipsoid_, _ellipsoidal_, _GRS80_, _Intl1924_,
|
|
82
|
-
_Krassovski1940_, _Krassowsky1940_, _NAD27_, _NAD83_,
|
|
83
|
-
_PLUS_, _Sphere_, _spherical_, _transform_, _UNDER_, \
|
|
80
|
+
_Clarke1866_, _Clarke1880IGN_, _COMMASPACE_, _DMAIN_,_DOT_, \
|
|
81
|
+
_earth_, _ellipsoid_, _ellipsoidal_, _GRS80_, _Intl1924_, \
|
|
82
|
+
_MINUS_, _Krassovski1940_, _Krassowsky1940_, _NAD27_, _NAD83_, \
|
|
83
|
+
_s_, _PLUS_, _Sphere_, _spherical_, _transform_, _UNDER_, \
|
|
84
84
|
_WGS72_, _WGS84_
|
|
85
85
|
from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
|
|
86
86
|
from pygeodesy.named import _lazyNamedEnumItem as _lazy, _name__, _name2__, _NamedEnum, \
|
|
@@ -94,7 +94,7 @@ from pygeodesy.units import _isRadius, Radius_, radians
|
|
|
94
94
|
# import operator as _operator # from .fmath
|
|
95
95
|
|
|
96
96
|
__all__ = _ALL_LAZY.datums
|
|
97
|
-
__version__ = '
|
|
97
|
+
__version__ = '25.04.14'
|
|
98
98
|
|
|
99
99
|
_a_ellipsoid_ = _UNDER_(_a_, _ellipsoid_)
|
|
100
100
|
_BD72_ = 'BD72'
|
|
@@ -510,7 +510,7 @@ def _earth_datum(inst, a_earth, f=None, raiser=_a_ellipsoid_, **name): # in .ka
|
|
|
510
510
|
E, n, D = _EnD3((a_earth, f), name)
|
|
511
511
|
if raiser and not E:
|
|
512
512
|
raise _TypeError(f=f, **{raiser: a_earth})
|
|
513
|
-
elif a_earth
|
|
513
|
+
elif _isin(a_earth, None, _EWGS84, _WGS84) and inst._datum is _WGS84:
|
|
514
514
|
return
|
|
515
515
|
elif isinstance(a_earth, Datum):
|
|
516
516
|
E, n, D = None, NN, a_earth
|
|
@@ -721,7 +721,7 @@ _WGS84 = Datums.WGS84
|
|
|
721
721
|
assert _WGS84.ellipsoid is _EWGS84
|
|
722
722
|
# assert _WGS84.transform.isunity
|
|
723
723
|
|
|
724
|
-
if __name__ ==
|
|
724
|
+
if __name__ == _DMAIN_:
|
|
725
725
|
|
|
726
726
|
from pygeodesy.interns import _COMMA_, _NL_, _NLATvar_
|
|
727
727
|
from pygeodesy import printf
|
pygeodesy/deprecated/bases.py
CHANGED
|
@@ -9,11 +9,11 @@ from pygeodesy.latlonBase import LatLonBase as _LatLonBase
|
|
|
9
9
|
from pygeodesy.lazily import _ALL_DEPRECATED
|
|
10
10
|
|
|
11
11
|
__all__ = _ALL_DEPRECATED.deprecated_bases
|
|
12
|
-
__version__ = '
|
|
12
|
+
__version__ = '25.04.09'
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class LatLonHeightBase(_LatLonBase): # PYCHOK no cover
|
|
16
|
-
'''
|
|
16
|
+
'''DEPRECATED on 2021.02.10, use (INTERNAL) class L{pygeodesy.latlonBase.LatLonBase}.'''
|
|
17
17
|
pass
|
|
18
18
|
|
|
19
19
|
|
pygeodesy/deprecated/classes.py
CHANGED
|
@@ -22,7 +22,7 @@ from pygeodesy.trf import TRFXform7Tuple as _TRFXform7Tuple
|
|
|
22
22
|
from pygeodesy.units import Bearing, Int, Lamd, Lat, Lon, Meter, Phid
|
|
23
23
|
|
|
24
24
|
__all__ = _ALL_DEPRECATED.deprecated_classes
|
|
25
|
-
__version__ = '
|
|
25
|
+
__version__ = '25.04.11'
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class _Deprecated_NamedTuple(_NamedTuple):
|
|
@@ -349,7 +349,7 @@ class UtmUps4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover
|
|
|
349
349
|
|
|
350
350
|
|
|
351
351
|
class XDist(ADict):
|
|
352
|
-
'''DEPRECATED on 2024.07.02, use class L{
|
|
352
|
+
'''DEPRECATED on 2024.07.02, use class L{ADict}.'''
|
|
353
353
|
def __init__(self, *args, **kwds): # PYCHOK no cover
|
|
354
354
|
deprecated_class(self.__class__)
|
|
355
355
|
ADict.__init__(self, *args, **kwds)
|
|
@@ -9,21 +9,21 @@ from pygeodesy.lazily import _ALL_DEPRECATED
|
|
|
9
9
|
from pygeodesy.units import Float, Int, Str
|
|
10
10
|
|
|
11
11
|
__all__ = _ALL_DEPRECATED.deprecated_consterns
|
|
12
|
-
__version__ = '
|
|
12
|
+
__version__ = '25.04.09'
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class _Deprecated_Float(Float):
|
|
16
|
-
'''DEPRECATED on 2023.09.12, don't use.'''
|
|
16
|
+
'''DEPRECATED on 2023.09.12, I{don't use}.'''
|
|
17
17
|
pass
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class _Deprecated_Int(Int):
|
|
21
|
-
'''DEPRECATED on 2023.09.12, don't use.'''
|
|
21
|
+
'''DEPRECATED on 2023.09.12, I{don't use}.'''
|
|
22
22
|
pass
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class _Deprecated_Str(Str):
|
|
26
|
-
'''DEPRECATED on 2023.09.12, don't use.'''
|
|
26
|
+
'''DEPRECATED on 2023.09.12, I{don't use}.'''
|
|
27
27
|
pass
|
|
28
28
|
|
|
29
29
|
|