pygeodesy 24.6.9__py2.py3-none-any.whl → 24.7.7__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.6.9.dist-info → PyGeodesy-24.7.7.dist-info}/METADATA +2 -2
- PyGeodesy-24.7.7.dist-info/RECORD +117 -0
- pygeodesy/__init__.py +39 -32
- pygeodesy/__main__.py +6 -1
- pygeodesy/albers.py +2 -2
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/auxAngle.py +40 -39
- pygeodesy/auxilats/auxDLat.py +3 -2
- pygeodesy/auxilats/auxLat.py +16 -18
- pygeodesy/auxilats/auxily.py +1 -1
- pygeodesy/azimuthal.py +10 -10
- pygeodesy/basics.py +16 -4
- pygeodesy/booleans.py +4 -4
- pygeodesy/cartesianBase.py +11 -14
- pygeodesy/css.py +14 -18
- pygeodesy/datums.py +6 -6
- pygeodesy/deprecated/__init__.py +1 -1
- pygeodesy/deprecated/classes.py +25 -4
- pygeodesy/deprecated/datum.py +3 -3
- pygeodesy/deprecated/functions.py +6 -8
- pygeodesy/dms.py +23 -27
- pygeodesy/ecef.py +4 -4
- pygeodesy/elevations.py +4 -4
- pygeodesy/ellipsoidalBase.py +23 -28
- pygeodesy/ellipsoidalBaseDI.py +19 -23
- pygeodesy/ellipsoidalExact.py +3 -3
- pygeodesy/ellipsoidalGeodSolve.py +15 -23
- pygeodesy/ellipsoidalKarney.py +37 -60
- pygeodesy/ellipsoidalNvector.py +38 -44
- pygeodesy/ellipsoidalVincenty.py +11 -14
- pygeodesy/ellipsoids.py +107 -101
- pygeodesy/errors.py +109 -48
- pygeodesy/etm.py +32 -44
- pygeodesy/formy.py +55 -58
- pygeodesy/frechet.py +18 -20
- pygeodesy/fsums.py +3 -3
- pygeodesy/gars.py +3 -4
- pygeodesy/geodesici.py +1696 -0
- pygeodesy/geodesicw.py +15 -15
- pygeodesy/geodesicx/__init__.py +4 -4
- pygeodesy/geodesicx/gx.py +34 -55
- pygeodesy/geodesicx/gxbases.py +20 -8
- pygeodesy/geodesicx/gxline.py +93 -88
- pygeodesy/geodsolve.py +108 -59
- pygeodesy/geohash.py +26 -34
- pygeodesy/geoids.py +28 -37
- pygeodesy/hausdorff.py +17 -18
- pygeodesy/heights.py +2 -2
- pygeodesy/internals.py +46 -13
- pygeodesy/interns.py +2 -2
- pygeodesy/karney.py +78 -15
- pygeodesy/ktm.py +13 -16
- pygeodesy/latlonBase.py +17 -19
- pygeodesy/lazily.py +28 -25
- pygeodesy/lcc.py +28 -31
- pygeodesy/ltp.py +7 -8
- pygeodesy/ltpTuples.py +71 -73
- pygeodesy/mgrs.py +8 -9
- pygeodesy/named.py +19 -10
- pygeodesy/nvectorBase.py +9 -10
- pygeodesy/osgr.py +9 -9
- pygeodesy/points.py +6 -6
- pygeodesy/rhumb/__init__.py +1 -1
- pygeodesy/rhumb/aux_.py +5 -5
- pygeodesy/rhumb/bases.py +30 -31
- pygeodesy/rhumb/ekx.py +3 -4
- pygeodesy/rhumb/solve.py +21 -22
- pygeodesy/solveBase.py +177 -123
- pygeodesy/sphericalBase.py +10 -11
- pygeodesy/sphericalNvector.py +13 -13
- pygeodesy/sphericalTrigonometry.py +86 -97
- pygeodesy/streprs.py +4 -34
- pygeodesy/triaxials.py +48 -43
- pygeodesy/units.py +208 -275
- pygeodesy/unitsBase.py +115 -107
- pygeodesy/ups.py +26 -31
- pygeodesy/utily.py +8 -8
- pygeodesy/utm.py +35 -40
- pygeodesy/utmups.py +43 -46
- pygeodesy/utmupsBase.py +8 -9
- pygeodesy/vector3d.py +26 -27
- pygeodesy/vector3dBase.py +6 -7
- pygeodesy/webmercator.py +19 -21
- pygeodesy/wgrs.py +18 -20
- PyGeodesy-24.6.9.dist-info/RECORD +0 -116
- {PyGeodesy-24.6.9.dist-info → PyGeodesy-24.7.7.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.6.9.dist-info → PyGeodesy-24.7.7.dist-info}/top_level.txt +0 -0
pygeodesy/unitsBase.py
CHANGED
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
u'''Basic C{Float}, C{Int} and C{Str}ing units classes.
|
|
5
5
|
'''
|
|
6
6
|
|
|
7
|
-
from pygeodesy.
|
|
8
|
-
from pygeodesy.
|
|
9
|
-
|
|
10
|
-
_radius_, _UNDER_,
|
|
11
|
-
|
|
12
|
-
from pygeodesy.
|
|
7
|
+
from pygeodesy.basics import isstr, issubclassof, _xsubclassof
|
|
8
|
+
from pygeodesy.errors import _IsnotError, _UnexpectedError, UnitError, _XError
|
|
9
|
+
from pygeodesy.interns import NN, _degrees_, _degrees2_, _invalid_, _meter_, \
|
|
10
|
+
_radians_, _radians2_, _radius_, _UNDER_, _units_, \
|
|
11
|
+
_std_ # PYCHOK used!
|
|
12
|
+
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS
|
|
13
|
+
from pygeodesy.named import modulename, _Named, property_doc_
|
|
13
14
|
# from pygeodesy.props import property_doc_ # from .named
|
|
14
15
|
from pygeodesy.streprs import Fmt, fstr
|
|
15
16
|
|
|
16
17
|
__all__ = _ALL_LAZY.unitsBase
|
|
17
|
-
__version__ = '24.06.
|
|
18
|
+
__version__ = '24.06.15'
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class _NamedUnit(_Named):
|
|
@@ -23,6 +24,56 @@ class _NamedUnit(_Named):
|
|
|
23
24
|
_std_repr = True # set below
|
|
24
25
|
_units = None
|
|
25
26
|
|
|
27
|
+
def __new__(cls, typ, arg, name, Error=UnitError, **name_arg):
|
|
28
|
+
'''(INTERNAL) Return a named C{typ.__new__(cls, arg)} instance.
|
|
29
|
+
'''
|
|
30
|
+
if name_arg:
|
|
31
|
+
name, arg = _NamedUnit._arg_name_arg2(arg, name, **name_arg)
|
|
32
|
+
try: # assert typ in cls.__mro__
|
|
33
|
+
self = typ.__new__(cls, arg)
|
|
34
|
+
if name:
|
|
35
|
+
self.name = name
|
|
36
|
+
except Exception as x:
|
|
37
|
+
raise _NamedUnit._Error(cls, arg, name, Error, cause=x)
|
|
38
|
+
return self
|
|
39
|
+
|
|
40
|
+
@staticmethod
|
|
41
|
+
def _arg_name_arg2(arg, name=NN, name__=None, **name_arg): # in .units
|
|
42
|
+
'''(INTERNAL) Get the 2-tuple C{(name, arg)}.
|
|
43
|
+
'''
|
|
44
|
+
if name_arg:
|
|
45
|
+
if len(name_arg) > 1:
|
|
46
|
+
raise _UnexpectedError(**name_arg)
|
|
47
|
+
for name, arg in name_arg.items(): # next(iter(.items()))
|
|
48
|
+
break
|
|
49
|
+
elif name:
|
|
50
|
+
pass
|
|
51
|
+
elif name__ is not None:
|
|
52
|
+
name = name__.__name__
|
|
53
|
+
return name, arg
|
|
54
|
+
|
|
55
|
+
@staticmethod # PYCHOK unused suffix
|
|
56
|
+
def _Error(cls, arg, name, Error=UnitError, suffix=NN, # unused
|
|
57
|
+
txt=_invalid_, cause=None, **name_arg):
|
|
58
|
+
'''(INTERNAL) Return a C{_NamedUnit} error with explanation.
|
|
59
|
+
|
|
60
|
+
@returns: An B{C{Error}} instance.
|
|
61
|
+
'''
|
|
62
|
+
kwds, x = {}, cause
|
|
63
|
+
if x is not None: # caught exception
|
|
64
|
+
if Error is UnitError: # and isError(x)
|
|
65
|
+
Error = type(x) # i.e. not overridden
|
|
66
|
+
if txt is _invalid_:
|
|
67
|
+
txt = str(x) # i.e. not overridden
|
|
68
|
+
kwds.update(cause=x)
|
|
69
|
+
if name_arg:
|
|
70
|
+
try:
|
|
71
|
+
name, arg = _NamedUnit._arg_name_arg2(arg, name, **name_arg)
|
|
72
|
+
except Exception: # ignore, same error?
|
|
73
|
+
kwds.update(name_arg)
|
|
74
|
+
n = name if name else modulename(cls).lstrip(_UNDER_)
|
|
75
|
+
return _XError(Error, n, arg, txt=txt, **kwds)
|
|
76
|
+
|
|
26
77
|
@property_doc_(' standard C{repr} or named C{toRepr} representation.')
|
|
27
78
|
def std_repr(self):
|
|
28
79
|
'''Get the representation (C{bool}, C{True} means standard).
|
|
@@ -61,29 +112,20 @@ class Float(float, _NamedUnit):
|
|
|
61
112
|
'''
|
|
62
113
|
# _std_repr = True # set below
|
|
63
114
|
|
|
64
|
-
def __new__(cls, arg=None, name=NN,
|
|
65
|
-
'''New C{Ffloat}
|
|
115
|
+
def __new__(cls, arg=None, name=NN, **Error_name_arg):
|
|
116
|
+
'''New, named C{Ffloat}.
|
|
66
117
|
|
|
67
|
-
@kwarg arg: The value (any C{type}
|
|
68
|
-
@kwarg name: Optional
|
|
69
|
-
@kwarg
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
of separate B{C{arg}} and B{C{name}} ones.
|
|
118
|
+
@kwarg arg: The value (any C{type} acceptable to C{float}).
|
|
119
|
+
@kwarg name: Optional name (C{str}).
|
|
120
|
+
@kwarg Error_name_arg: Optional C{B{Error}=UnitError} to raise
|
|
121
|
+
and optional C{name=arg} keyword argument, inlieu
|
|
122
|
+
of separate B{C{arg}} and B{C{name}} ones.
|
|
73
123
|
|
|
74
|
-
@returns: A C{Float}
|
|
124
|
+
@returns: A named C{Float}.
|
|
75
125
|
|
|
76
126
|
@raise Error: Invalid B{C{arg}}.
|
|
77
127
|
'''
|
|
78
|
-
|
|
79
|
-
name, arg = _arg_name_arg2(arg, **name_arg)
|
|
80
|
-
try:
|
|
81
|
-
self = float.__new__(cls, arg)
|
|
82
|
-
if name:
|
|
83
|
-
_NamedUnit.name.fset(self, name) # see _Named.name
|
|
84
|
-
except Exception as x: # XXX not ... as x:
|
|
85
|
-
raise _Error(cls, arg, name, Error, x=x)
|
|
86
|
-
return self
|
|
128
|
+
return _NamedUnit.__new__(cls, float, arg, name, **Error_name_arg)
|
|
87
129
|
|
|
88
130
|
def __repr__(self): # to avoid MRO(float)
|
|
89
131
|
'''Return a representation of this C{Float}.
|
|
@@ -100,10 +142,11 @@ class Float(float, _NamedUnit):
|
|
|
100
142
|
def __str__(self): # to avoid MRO(float)
|
|
101
143
|
'''Return this C{Float} as standard C{str}.
|
|
102
144
|
'''
|
|
103
|
-
#
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
#
|
|
145
|
+
# must use super(Float, self)... since super()... only works
|
|
146
|
+
# for Python 3+ and float.__str__(self) invokes .__repr__(self);
|
|
147
|
+
# calling self.toRepr(std=True) super(Float, self).__repr__()
|
|
148
|
+
# mimicks this bhavior
|
|
149
|
+
|
|
107
150
|
# XXX the default number of decimals is 10-12 when using
|
|
108
151
|
# float.__str__(self) with both python 3.8+ and 2.7-, but
|
|
109
152
|
# float.__repr__(self) shows DIG decimals in python2.7!
|
|
@@ -116,20 +159,19 @@ class Float(float, _NamedUnit):
|
|
|
116
159
|
@kwarg std: If C{True} return the standard C{repr},
|
|
117
160
|
otherwise the named representation (C{bool}).
|
|
118
161
|
|
|
119
|
-
@see:
|
|
120
|
-
L{
|
|
162
|
+
@see: Function L{fstr<pygeodesy.streprs.fstr>} and methods
|
|
163
|
+
L{Float.__repr__}, L{Float.toStr} for further details.
|
|
121
164
|
'''
|
|
122
|
-
#
|
|
123
|
-
# super()
|
|
124
|
-
# return super(Float, self).__repr__() if std else \
|
|
165
|
+
# must use super(Float, self)... since super()... only works for
|
|
166
|
+
# Python 3+; return super(Float, self).__repr__() if std else \
|
|
125
167
|
return float.__repr__(self) if std else \
|
|
126
168
|
self._toRepr(self.toStr(**prec_fmt_ints))
|
|
127
169
|
|
|
128
170
|
def toStr(self, prec=12, fmt=Fmt.g, ints=False): # PYCHOK prec=8, ...
|
|
129
171
|
'''Format this C{Float} as C{str}.
|
|
130
172
|
|
|
131
|
-
@see:
|
|
132
|
-
for
|
|
173
|
+
@see: Function L{fstr<pygeodesy.streprs.fstr>} and method
|
|
174
|
+
L{Float.__repr__} and for further information.
|
|
133
175
|
'''
|
|
134
176
|
return fstr(self, prec=prec, fmt=fmt, ints=ints)
|
|
135
177
|
|
|
@@ -139,29 +181,20 @@ class Int(int, _NamedUnit):
|
|
|
139
181
|
'''
|
|
140
182
|
# _std_repr = True # set below
|
|
141
183
|
|
|
142
|
-
def __new__(cls, arg=None, name=NN,
|
|
143
|
-
'''New C{Int}
|
|
184
|
+
def __new__(cls, arg=None, name=NN, **Error_name_arg):
|
|
185
|
+
'''New, named C{Int}.
|
|
144
186
|
|
|
145
|
-
@kwarg arg: The value (any C{type}
|
|
146
|
-
@kwarg name: Optional
|
|
147
|
-
@kwarg
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
of separate B{C{arg}} and B{C{name}} ones.
|
|
187
|
+
@kwarg arg: The value (any C{type} acceptable to C{int}).
|
|
188
|
+
@kwarg name: Optional name (C{str}).
|
|
189
|
+
@kwarg Error_name_arg: Optional C{B{Error}=UnitError} to raise
|
|
190
|
+
and optional C{name=arg} keyword argument, inlieu
|
|
191
|
+
of separate B{C{arg}} and B{C{name}} ones.
|
|
151
192
|
|
|
152
|
-
@returns:
|
|
193
|
+
@returns: A named C{Int}.
|
|
153
194
|
|
|
154
195
|
@raise Error: Invalid B{C{arg}}.
|
|
155
196
|
'''
|
|
156
|
-
|
|
157
|
-
name, arg = _arg_name_arg2(arg, **name_arg)
|
|
158
|
-
try:
|
|
159
|
-
self = int.__new__(cls, arg)
|
|
160
|
-
if name:
|
|
161
|
-
_NamedUnit.name.fset(self, name) # see _Named.name
|
|
162
|
-
except Exception as x: # XXX not ... as x:
|
|
163
|
-
raise _Error(cls, arg, name, Error, x=x)
|
|
164
|
-
return self
|
|
197
|
+
return _NamedUnit.__new__(cls, int, arg, name, **Error_name_arg)
|
|
165
198
|
|
|
166
199
|
def __repr__(self): # to avoid MRO(int)
|
|
167
200
|
'''Return a representation of this named C{int}.
|
|
@@ -215,32 +248,23 @@ class Str(str, _NamedUnit):
|
|
|
215
248
|
'''
|
|
216
249
|
# _std_repr = True # set below
|
|
217
250
|
|
|
218
|
-
def __new__(cls, arg=None, name=NN,
|
|
219
|
-
'''New
|
|
251
|
+
def __new__(cls, arg=None, name=NN, **Error_name_arg):
|
|
252
|
+
'''New, named and callable C{Str}.
|
|
220
253
|
|
|
221
254
|
@kwarg cls: This class (C{Str} or sub-class).
|
|
222
|
-
@kwarg arg: The value (any C{type}
|
|
223
|
-
@kwarg name: Optional
|
|
224
|
-
@kwarg
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
of separate B{C{arg}} and B{C{name}} ones.
|
|
255
|
+
@kwarg arg: The value (any C{type} acceptable to C{str}).
|
|
256
|
+
@kwarg name: Optional name (C{str}).
|
|
257
|
+
@kwarg Error_name_arg: Optional C{B{Error}=UnitError} to raise
|
|
258
|
+
and optional C{name=arg} keyword argument, inlieu
|
|
259
|
+
of separate B{C{arg}} and B{C{name}} ones.
|
|
228
260
|
|
|
229
|
-
@returns: A L{Str}
|
|
261
|
+
@returns: A named L{Str}.
|
|
230
262
|
|
|
231
263
|
@raise Error: Invalid B{C{arg}}.
|
|
232
264
|
|
|
233
|
-
@see: Callable, not
|
|
265
|
+
@see: Callable, not nameable class L{Str_<pygeodesy.interns.Str_>}.
|
|
234
266
|
'''
|
|
235
|
-
|
|
236
|
-
name, arg = _arg_name_arg2(arg, **name_arg)
|
|
237
|
-
try:
|
|
238
|
-
self = str.__new__(cls, arg)
|
|
239
|
-
if name:
|
|
240
|
-
_NamedUnit.name.fset(self, name) # see _Named.name
|
|
241
|
-
except Exception as x: # XXX not ... as x:
|
|
242
|
-
raise _Error(cls, arg, name, Error, x=x)
|
|
243
|
-
return self
|
|
267
|
+
return _NamedUnit.__new__(cls, str, arg, name, **Error_name_arg)
|
|
244
268
|
|
|
245
269
|
def __repr__(self):
|
|
246
270
|
'''Return a representation of this C{Str}.
|
|
@@ -279,18 +303,16 @@ class Str(str, _NamedUnit):
|
|
|
279
303
|
|
|
280
304
|
@see: Method L{Str.__repr__} for more documentation.
|
|
281
305
|
'''
|
|
282
|
-
# must use super(Str, self)
|
|
283
|
-
#
|
|
284
|
-
# str.__repr__(self) fails with Python 3.8+
|
|
306
|
+
# must use super(Str, self)... since super()... only works
|
|
307
|
+
# for Python 3+ and str.__repr__(self) fails in Python 3.8+
|
|
285
308
|
r = super(Str, self).__repr__()
|
|
286
309
|
return r if std else self._toRepr(r)
|
|
287
310
|
|
|
288
311
|
def toStr(self, **unused): # PYCHOK **unused
|
|
289
312
|
'''Return this C{Str} as standard C{str}.
|
|
290
313
|
'''
|
|
291
|
-
# must use super(Str, self)... since
|
|
292
|
-
#
|
|
293
|
-
# str.__str__(self) fails with Python 3.8+
|
|
314
|
+
# must use super(Str, self)... since super()... only works
|
|
315
|
+
# for Python 3+ and str.__repr__(self) fails in Python 3.8+
|
|
294
316
|
return super(Str, self).__str__()
|
|
295
317
|
|
|
296
318
|
|
|
@@ -302,39 +324,25 @@ _Str_radians = Str(_radians_) # PYCHOK in .frechet, .hausdorff
|
|
|
302
324
|
_Str_radians2 = Str(_radians2_) # PYCHOK in .frechet, .hausdorff
|
|
303
325
|
|
|
304
326
|
|
|
305
|
-
def
|
|
306
|
-
'''(INTERNAL)
|
|
307
|
-
|
|
308
|
-
@arg clas: The C{units} class or sub-class.
|
|
309
|
-
@arg arg: The original C{unit} value.
|
|
310
|
-
@arg name: The instance name (C{str}).
|
|
311
|
-
@arg Error: The Error class to use (C{Excetion}).
|
|
312
|
-
@kwarg txt: An explanation of the error )C{str}).
|
|
313
|
-
@kwarg x: Caught exception, used for exception
|
|
314
|
-
chaining (iff enabled in Python3+).
|
|
315
|
-
|
|
316
|
-
@returns: An B{C{Error}} instance.
|
|
327
|
+
def _xUnit(units, Base): # PYCHOK in .frechet, .hausdorff
|
|
328
|
+
'''(INTERNAL) Get C{Unit} from C{units} or C{name}, ortherwise C{Base}.
|
|
317
329
|
'''
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if txt is _invalid_:
|
|
322
|
-
txt = str(x) # i.e. if not overridden
|
|
323
|
-
n = name if name else modulename(clas).lstrip(_UNDER_)
|
|
324
|
-
return _XError(Error, n, arg, txt=txt, cause=x)
|
|
330
|
+
_xsubclassof(_NamedUnit, Base=Base)
|
|
331
|
+
U = getattr(_MODS, units.capitalize(), Base) if isstr(units) else units
|
|
332
|
+
return U if issubclassof(U, Base) else Base
|
|
325
333
|
|
|
326
334
|
|
|
327
|
-
def
|
|
328
|
-
'''(INTERNAL)
|
|
335
|
+
def _xUnits(units, Base=_NamedUnit): # in .frechet, .hausdorff
|
|
336
|
+
'''(INTERNAL) Set property C{units} as C{Unit} or C{Str}.
|
|
329
337
|
'''
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
338
|
+
_xsubclassof(_NamedUnit, Base=Base)
|
|
339
|
+
if issubclassof(units, Base):
|
|
340
|
+
U = units
|
|
341
|
+
elif isstr(units):
|
|
342
|
+
U = Str(units, name=_units_) # XXX Str to _Pass and for backward compatibility
|
|
333
343
|
else:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
raise _UnexpectedError(**name_arg)
|
|
337
|
-
return t
|
|
344
|
+
raise _IsnotError(Base, Str, str, units=units)
|
|
345
|
+
return U
|
|
338
346
|
|
|
339
347
|
|
|
340
348
|
__all__ += _ALL_DOCS(_NamedUnit)
|
pygeodesy/ups.py
CHANGED
|
@@ -49,7 +49,7 @@ from pygeodesy.utmupsBase import Fmt, _LLEB, _hemi, _parseUTMUPS5, _to4lldn, \
|
|
|
49
49
|
from math import atan2, fabs, radians, tan
|
|
50
50
|
|
|
51
51
|
__all__ = _ALL_LAZY.ups
|
|
52
|
-
__version__ = '
|
|
52
|
+
__version__ = '24.06.11'
|
|
53
53
|
|
|
54
54
|
_BZ_UPS = _getenv('PYGEODESY_UPS_POLES', _std_) == _std_
|
|
55
55
|
_Falsing = Meter(2000e3) # false easting and northing (C{meter})
|
|
@@ -183,7 +183,7 @@ class Ups(UtmUpsBase):
|
|
|
183
183
|
@arg scale0: UPS k0 scale at B{C{lat}} latitude (C{scalar}).
|
|
184
184
|
|
|
185
185
|
@raise RangeError: If B{C{lat}} outside the valid range and
|
|
186
|
-
L{pygeodesy.rangerrors}
|
|
186
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
187
187
|
|
|
188
188
|
@raise UPSError: Invalid B{C{scale}}.
|
|
189
189
|
'''
|
|
@@ -206,8 +206,8 @@ class Ups(UtmUpsBase):
|
|
|
206
206
|
@kwarg LatLon_kwds: Optional, additional B{C{LatLon}} keyword
|
|
207
207
|
arguments, ignored if C{B{LatLon} is None}.
|
|
208
208
|
|
|
209
|
-
@return: This UPS coordinate (B{C{LatLon}}) or if B{
|
|
210
|
-
is
|
|
209
|
+
@return: This UPS coordinate (B{C{LatLon}}) or if C{B{LatLon}
|
|
210
|
+
is None}, a L{LatLonDatum5Tuple}C{(lat, lon, datum,
|
|
211
211
|
gamma, scale)}.
|
|
212
212
|
|
|
213
213
|
@raise TypeError: If B{C{LatLon}} is not ellipsoidal.
|
|
@@ -257,8 +257,8 @@ class Ups(UtmUpsBase):
|
|
|
257
257
|
@return: This UPS as a string with C{00[Band] pole, easting,
|
|
258
258
|
northing, [convergence, scale]} as C{"[Z:00[Band],
|
|
259
259
|
P:N|S, E:meter, N:meter]"} plus C{", C:DMS, S:float"}
|
|
260
|
-
if B{
|
|
261
|
-
C{'A'|'B'|'Y'|'Z'} only if
|
|
260
|
+
if C{B{cs} is True}, where C{[Band]} is present and
|
|
261
|
+
C{'A'|'B'|'Y'|'Z'} only if C{B{B} is True} and
|
|
262
262
|
convergence C{DMS} is in I{either} degrees, minutes
|
|
263
263
|
I{or} seconds (C{str}).
|
|
264
264
|
|
|
@@ -352,10 +352,10 @@ def parseUPS5(strUPS, datum=_WGS84, Ups=Ups, falsed=True, **name):
|
|
|
352
352
|
are falsed (C{bool}).
|
|
353
353
|
@kwarg name: Optional B{C{Ups}} C{B{name}=NN} (C{str}).
|
|
354
354
|
|
|
355
|
-
@return: The UPS coordinate (B{C{Ups}}) or a
|
|
356
|
-
L{UtmUps5Tuple}C{(zone, hemipole, easting, northing,
|
|
357
|
-
|
|
358
|
-
|
|
355
|
+
@return: The UPS coordinate (B{C{Ups}}) or if C{B{Ups} is None}, a
|
|
356
|
+
L{UtmUps5Tuple}C{(zone, hemipole, easting, northing, band)}.
|
|
357
|
+
The C{hemipole} is the C{'N'|'S'} pole, the UPS projection
|
|
358
|
+
top/center.
|
|
359
359
|
|
|
360
360
|
@raise UPSError: Invalid B{C{strUPS}}.
|
|
361
361
|
'''
|
|
@@ -399,21 +399,18 @@ def toUps8(latlon, lon=None, datum=None, Ups=Ups, pole=NN,
|
|
|
399
399
|
@kwarg strict: Restrict B{C{lat}} to UPS ranges (C{bool}).
|
|
400
400
|
@kwarg name: Optional B{C{Ups}} C{B{name}=NN} (C{str}).
|
|
401
401
|
|
|
402
|
-
@return: The UPS coordinate (B{C{Ups}}) or
|
|
403
|
-
hemipole, easting, northing, band,
|
|
404
|
-
|
|
402
|
+
@return: The UPS coordinate (B{C{Ups}}) or if C{B{Ups} is None}, a
|
|
403
|
+
L{UtmUps8Tuple}C{(zone, hemipole, easting, northing, band,
|
|
404
|
+
datum, gamma, scale)} where C{hemipole} is the C{'N'|'S'}
|
|
405
405
|
pole, the UPS projection top/center.
|
|
406
406
|
|
|
407
|
-
@raise RangeError: If B{C{strict}} and B{C{lat}} outside the valid
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
to C{True}.
|
|
407
|
+
@raise RangeError: If B{C{strict}} and B{C{lat}} outside the valid UPS bands
|
|
408
|
+
or if B{C{lat}} or B{C{lon}} outside the valid range and
|
|
409
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
411
410
|
|
|
412
|
-
@raise TypeError: If B{C{latlon}} is not ellipsoidal or if B{C{datum}}
|
|
413
|
-
is invalid.
|
|
411
|
+
@raise TypeError: If B{C{latlon}} is not ellipsoidal or if B{C{datum}} is invalid.
|
|
414
412
|
|
|
415
|
-
@raise ValueError: If B{C{lon}} value is missing or if B{C{latlon}}
|
|
416
|
-
is invalid.
|
|
413
|
+
@raise ValueError: If B{C{lon}} value is missing or if B{C{latlon}} is invalid.
|
|
417
414
|
|
|
418
415
|
@see: I{Karney}'s C++ class U{UPS
|
|
419
416
|
<https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1UPS.html>}.
|
|
@@ -478,18 +475,16 @@ def upsZoneBand5(lat, lon, strict=True, **name):
|
|
|
478
475
|
@kwarg strict: Restrict B{C{lat}} to UPS ranges (C{bool}).
|
|
479
476
|
@kwarg name: Optional B{C{Ups}} C{B{name}=NN} (C{str}).
|
|
480
477
|
|
|
481
|
-
@return: A L{UtmUpsLatLon5Tuple}C{(zone, band, hemipole, lat,
|
|
482
|
-
|
|
483
|
-
|
|
478
|
+
@return: A L{UtmUpsLatLon5Tuple}C{(zone, band, hemipole, lat, lon)}
|
|
479
|
+
where C{hemipole} is the C{'N'|'S'} pole, the UPS projection
|
|
480
|
+
top/center and C{lon} [-180..180).
|
|
484
481
|
|
|
485
|
-
@note: The C{lon} is set to C{0} if B{C{lat}} is C{-90} or
|
|
486
|
-
C{
|
|
487
|
-
module L{pygeodesy.ups}.
|
|
482
|
+
@note: The C{lon} is set to C{0} if B{C{lat}} is C{-90} or C{90}, see env
|
|
483
|
+
variable C{PYGEODESY_UPS_POLES} in module L{ups<pygeodesy.ups>}.
|
|
488
484
|
|
|
489
|
-
@raise RangeError: If B{C{strict}} and B{C{lat}}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
L{pygeodesy.rangerrors} set to C{True}.
|
|
485
|
+
@raise RangeError: If B{C{strict} is True} and B{C{lat}} within the UTM but not
|
|
486
|
+
the UPS range or if B{C{lat}} or B{C{lon}} outside the valid
|
|
487
|
+
range and L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
493
488
|
|
|
494
489
|
@raise ValueError: Invalid B{C{lat}} or B{C{lon}}.
|
|
495
490
|
'''
|
pygeodesy/utily.py
CHANGED
|
@@ -21,13 +21,13 @@ from pygeodesy.errors import _ValueError, _xkwds, _xkwds_get1, _ALL_LAZY, _MODS
|
|
|
21
21
|
from pygeodesy.internals import _passargs # , _MODS?
|
|
22
22
|
from pygeodesy.interns import _edge_, _radians_, _semi_circular_, _SPACE_
|
|
23
23
|
# from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .errors
|
|
24
|
-
from pygeodesy.units import Degrees, Degrees_, Feet, Float, Lam,
|
|
24
|
+
from pygeodesy.units import Degrees, Degrees_, Feet, Float, Lam, Lamd, \
|
|
25
25
|
Meter, Meter2, Radians, Radians_
|
|
26
26
|
|
|
27
27
|
from math import acos, asin, atan2, cos, degrees, fabs, radians, sin, tan # pow
|
|
28
28
|
|
|
29
29
|
__all__ = _ALL_LAZY.utily
|
|
30
|
-
__version__ = '24.06.
|
|
30
|
+
__version__ = '24.06.15'
|
|
31
31
|
|
|
32
32
|
# read constant name "_M_Unit" as "meter per Unit"
|
|
33
33
|
_M_CHAIN = _F( 20.1168) # yard2m(1) * 22
|
|
@@ -171,7 +171,7 @@ def circle4(earth, lat):
|
|
|
171
171
|
instance.
|
|
172
172
|
|
|
173
173
|
@raise RangeError: Latitude B{C{lat}} outside valid range and
|
|
174
|
-
L{pygeodesy.rangerrors}
|
|
174
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
175
175
|
|
|
176
176
|
@raise TypeError: Invalid B{C{earth}}.
|
|
177
177
|
|
|
@@ -308,7 +308,7 @@ def degrees2m(deg, radius=R_M, lat=0):
|
|
|
308
308
|
near-polar B{C{lat}}.
|
|
309
309
|
|
|
310
310
|
@raise RangeError: Latitude B{C{lat}} outside valid range and
|
|
311
|
-
L{pygeodesy.rangerrors}
|
|
311
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
312
312
|
|
|
313
313
|
@raise TypeError: Invalid B{C{radius}}.
|
|
314
314
|
|
|
@@ -317,7 +317,7 @@ def degrees2m(deg, radius=R_M, lat=0):
|
|
|
317
317
|
|
|
318
318
|
@see: Function L{radians2m} and L{m2degrees}.
|
|
319
319
|
'''
|
|
320
|
-
return _Radians2m(
|
|
320
|
+
return _Radians2m(Lamd(deg=deg, clip=0), radius, lat)
|
|
321
321
|
|
|
322
322
|
|
|
323
323
|
def fathom2m(fathoms):
|
|
@@ -449,7 +449,7 @@ def m2degrees(distance, radius=R_M, lat=0):
|
|
|
449
449
|
@return: Angle (C{degrees}) or C{INF} for near-polar B{C{lat}}.
|
|
450
450
|
|
|
451
451
|
@raise RangeError: Latitude B{C{lat}} outside valid range and
|
|
452
|
-
L{pygeodesy.rangerrors}
|
|
452
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
453
453
|
|
|
454
454
|
@raise TypeError: Invalid B{C{radius}}.
|
|
455
455
|
|
|
@@ -546,7 +546,7 @@ def m2radians(distance, radius=R_M, lat=0):
|
|
|
546
546
|
@return: Angle (C{radians}) or C{INF} for near-polar B{C{lat}}.
|
|
547
547
|
|
|
548
548
|
@raise RangeError: Latitude B{C{lat}} outside valid range and
|
|
549
|
-
L{pygeodesy.rangerrors}
|
|
549
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
550
550
|
|
|
551
551
|
@raise TypeError: Invalid B{C{radius}}.
|
|
552
552
|
|
|
@@ -624,7 +624,7 @@ def radians2m(rad, radius=R_M, lat=0):
|
|
|
624
624
|
near-polar B{C{lat}}.
|
|
625
625
|
|
|
626
626
|
@raise RangeError: Latitude B{C{lat}} outside valid range and
|
|
627
|
-
L{pygeodesy.rangerrors}
|
|
627
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
628
628
|
|
|
629
629
|
@raise TypeError: Invalid B{C{radius}}.
|
|
630
630
|
|
pygeodesy/utm.py
CHANGED
|
@@ -63,7 +63,7 @@ from math import asinh, atanh, atan2, cos, cosh, degrees, fabs, \
|
|
|
63
63
|
# import operator as _operator # from .fmath
|
|
64
64
|
|
|
65
65
|
__all__ = _ALL_LAZY.utm
|
|
66
|
-
__version__ = '24.
|
|
66
|
+
__version__ = '24.06.11'
|
|
67
67
|
|
|
68
68
|
_Bands = 'CDEFGHJKLMNPQRSTUVWXX' # UTM latitude bands C..X (no
|
|
69
69
|
# I|O) 8° each, covering 80°S to 84°N and X repeated for 80-84°N
|
|
@@ -386,8 +386,8 @@ class Utm(UtmUpsBase):
|
|
|
386
386
|
the precison like B{C{prec}}).
|
|
387
387
|
|
|
388
388
|
@return: This UTM as a string C{"[Z:09[band], H:N|S, E:meter,
|
|
389
|
-
N:meter]"} plus C{", C:degrees, S:float"} if B{
|
|
390
|
-
|
|
389
|
+
N:meter]"} plus C{", C:degrees, S:float"} if C{B{cs}
|
|
390
|
+
is True} (C{str}).
|
|
391
391
|
'''
|
|
392
392
|
return self._toRepr(fmt, B, cs, prec, sep)
|
|
393
393
|
|
|
@@ -411,7 +411,7 @@ class Utm(UtmUpsBase):
|
|
|
411
411
|
@return: This UTM as a string with C{zone[band], hemisphere,
|
|
412
412
|
easting, northing, [convergence, scale]} in
|
|
413
413
|
C{"00 N|S meter meter"} plus C{" degrees float"} if
|
|
414
|
-
B{
|
|
414
|
+
C{B{cs} is True} (C{str}).
|
|
415
415
|
'''
|
|
416
416
|
return self._toStr(self.hemisphere, B, cs, prec, sep)
|
|
417
417
|
|
|
@@ -502,16 +502,15 @@ def parseUTM5(strUTM, datum=_WGS84, Utm=Utm, falsed=True, **name):
|
|
|
502
502
|
@arg strUTM: A UTM coordinate (C{str}).
|
|
503
503
|
@kwarg datum: Optional datum to use (L{Datum}, L{Ellipsoid},
|
|
504
504
|
L{Ellipsoid2} or L{a_f2Tuple}).
|
|
505
|
-
@kwarg Utm: Optional class to return the UTM coordinate
|
|
506
|
-
|
|
507
|
-
@kwarg falsed: Use C{B{falsed}=
|
|
508
|
-
|
|
509
|
-
@kwarg name: Optional
|
|
505
|
+
@kwarg Utm: Optional class to return the UTM coordinate (L{Utm})
|
|
506
|
+
or C{None}.
|
|
507
|
+
@kwarg falsed: Use C{B{falsed}=False} if both easting and northing
|
|
508
|
+
are I{not falsed} (C{bool}).
|
|
509
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
510
510
|
|
|
511
|
-
@return: The UTM coordinate (B{C{Utm}}) or if B{
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
the C{'N'|'S'} hemisphere.
|
|
511
|
+
@return: The UTM coordinate (B{C{Utm}}) or if C{B{Utm} is None}, a
|
|
512
|
+
L{UtmUps5Tuple}C{(zone, hemipole, easting, northing, band)}.
|
|
513
|
+
The C{hemipole} is the C{'N'|'S'} hemisphere.
|
|
515
514
|
|
|
516
515
|
@raise UTMError: Invalid B{C{strUTM}}.
|
|
517
516
|
|
|
@@ -526,40 +525,36 @@ def toUtm8(latlon, lon=None, datum=None, Utm=Utm, falsed=True,
|
|
|
526
525
|
|
|
527
526
|
@arg latlon: Latitude (C{degrees}) or an (ellipsoidal)
|
|
528
527
|
geodetic C{LatLon} point.
|
|
529
|
-
@kwarg lon:
|
|
530
|
-
|
|
531
|
-
@kwarg datum: Optional datum for this UTM coordinate,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
@kwarg Utm: Optional class to return the UTM coordinate
|
|
535
|
-
|
|
536
|
-
@kwarg
|
|
537
|
-
@kwarg strict: Restrict B{C{lat}} to UTM ranges (C{bool}).
|
|
528
|
+
@kwarg lon: Longitude (C{degrees}), required if B{C{latlon}} is
|
|
529
|
+
C{degrees}, ignored otherwise.
|
|
530
|
+
@kwarg datum: Optional datum for this UTM coordinate, overriding
|
|
531
|
+
B{C{latlon}}'s datum (L{Datum}, L{Ellipsoid}, L{Ellipsoid2}
|
|
532
|
+
or L{a_f2Tuple}).
|
|
533
|
+
@kwarg Utm: Optional class to return the UTM coordinate (L{Utm}) or C{None}.
|
|
534
|
+
@kwarg falsed: If C{True}, false both easting and northing (C{bool}).
|
|
535
|
+
@kwarg strict: If C{True}, restrict B{C{lat}} to UTM ranges (C{bool}).
|
|
538
536
|
@kwarg zone: Optional UTM zone to enforce (C{int} or C{str}).
|
|
539
|
-
@kwarg name_cmoff: Optional
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
C{B{falsed}} instead.
|
|
537
|
+
@kwarg name_cmoff: Optional C{B{name}=NN} (C{str}) and DEPRECATED keyword
|
|
538
|
+
argument C{B{cmoff}=True} to offset the longitude from the zone's
|
|
539
|
+
central meridian (C{bool}), use C{B{falsed}} instead.
|
|
543
540
|
|
|
544
|
-
@return: The UTM coordinate (B{C{Utm}}) or if B{
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
scale)}. The C{hemipole} is the C{'N'|'S'} hemisphere.
|
|
541
|
+
@return: The UTM coordinate (B{C{Utm}}) or if C{B{Utm} is None} or C{B{falsed}
|
|
542
|
+
is False}, a L{UtmUps8Tuple}C{(zone, hemipole, easting, northing, band,
|
|
543
|
+
datum, gamma, scale)} where C{hemipole} is the C{'N'|'S'} hemisphere.
|
|
548
544
|
|
|
549
|
-
@raise RangeError: If B{C{lat}} outside the valid UTM bands or if
|
|
550
|
-
|
|
551
|
-
|
|
545
|
+
@raise RangeError: If B{C{lat}} outside the valid UTM bands or if B{C{lat}}
|
|
546
|
+
or B{C{lon}} outside the valid range and L{rangerrors
|
|
547
|
+
<pygeodesy.rangerrors>} is C{True}.
|
|
552
548
|
|
|
553
549
|
@raise TypeError: Invalid B{C{datum}} or B{C{latlon}} not ellipsoidal.
|
|
554
550
|
|
|
555
551
|
@raise UTMError: Invalid B{C{zone}}.
|
|
556
552
|
|
|
557
|
-
@raise ValueError: If B{C{lon}}
|
|
558
|
-
is invalid.
|
|
553
|
+
@raise ValueError: If B{C{lon}} is missing or B{C{latlon}} is invalid.
|
|
559
554
|
|
|
560
|
-
@note: Implements Karney’s method, using 8-th order Krüger series,
|
|
561
|
-
|
|
562
|
-
|
|
555
|
+
@note: Implements Karney’s method, using 8-th order Krüger series, giving
|
|
556
|
+
results accurate to 5 nm (or better) for distances up to 3,900 Km
|
|
557
|
+
from the central meridian.
|
|
563
558
|
'''
|
|
564
559
|
z, B, lat, lon, d, f, n = _to7zBlldfn(latlon, lon, datum,
|
|
565
560
|
falsed, zone, strict,
|
|
@@ -727,8 +722,8 @@ def utmZoneBand5(lat, lon, cmoff=False, **name):
|
|
|
727
722
|
where C{hemipole} is the C{'N'|'S'} UTM hemisphere.
|
|
728
723
|
|
|
729
724
|
@raise RangeError: If B{C{lat}} outside the valid UTM bands or if
|
|
730
|
-
B{C{lat}} or B{C{lon}} outside the valid range
|
|
731
|
-
|
|
725
|
+
B{C{lat}} or B{C{lon}} outside the valid range and
|
|
726
|
+
L{rangerrors<pygeodesy.rangerrors>} is C{True}.
|
|
732
727
|
|
|
733
728
|
@raise ValueError: Invalid B{C{lat}} or B{C{lon}}.
|
|
734
729
|
'''
|