Coverage for pygeodesy / deprecated / classes.py: 97%
72 statements
« prev ^ index » next coverage.py v7.14.0, created at 2026-07-21 14:54 -0400
« prev ^ index » next coverage.py v7.14.0, created at 2026-07-21 14:54 -0400
2# -*- coding: utf-8 -*-
4u'''DEPRECATED classes kept for backward compatibility.
5'''
7from pygeodesy.clipy import ClipCS4Tuple as _ClipCS4Tuple
8from pygeodesy.constants import NAN, _float, typename
9from pygeodesy.deprecated.consterns import _Deprecated_Str
10# from pygeodesy.internals import typename # from .constants
11from pygeodesy.interns import NN, _a12_, _area_, _band_, _convergence_, _i_, \
12 _distance_, _gamma_, _lat_, _lon_, _ltp_, _SPACE_
13from pygeodesy.karney import _GTuple, Rhumb8Tuple as _Rhumb8Tuple, ADict
14from pygeodesy.lazily import _ALL_DEPRECATED, _ALL_DOCS, _ALL_MODS as _MODS
15from pygeodesy.ltpTuples import Ned4Tuple as _Ned4Tuple
16# from pygeodesy.named import ADict, _NamedTuple # from .karney, .namedTuples
17from pygeodesy.namedTuples import Forward4Tuple as _Forward4Tuple, \
18 Reverse4Tuple as _Reverse4Tuple, \
19 UtmUps5Tuple as _UtmUps5Tuple, _NamedTuple
20from pygeodesy.props import deprecated_class, deprecated_method
21from pygeodesy.resections import TriAngle5Tuple as _TriAngle5Tuple
22from pygeodesy.triaxials import Conformal, ConformalSphere, Conformal2Tuple
23from pygeodesy.trf import TRFXform7Tuple as _TRFXform7Tuple
24from pygeodesy.units import Bearing, Int, Lamd, Lat, Lon, Meter, Phid
26__all__ = _ALL_DEPRECATED.deprecated_classes
27__version__ = '26.07.17'
30class _Deprecated_NamedTuple(_NamedTuple):
31 '''DEPRECATED, C{_NamedTuple} base.
32 '''
33 def __new__(cls, *args, **kwds):
34 deprecated_class(cls)
35 return _NamedTuple.__new__(cls, *args, **kwds)
38def _reNames(names, old, *new):
39 # replace item C{old} with C{new} name
40 i = names.index(old)
41 return names[:i] + new + names[i + 1:]
44try: # if installed, use pychlv
45 from pychlv import ChLV, ChLVa, ChLVe, ChLV9Tuple, \
46 ChLVEN2Tuple, ChLVYX2Tuple, ChLVyx2Tuple
47except ImportError:
49 class _ChLV(object):
50 '''DEPRECATED on 2026.07.17, install package U{pychlv<https://PyPI.org/project/pychlv>}.'''
51 def __init__(self, *args, **kwds): # PYCHOK no cover
52 deprecated_class(self.__class__)
53 t = _SPACE_('class', typename(self), _ChLV.__doc__)
54 raise ImportError(t)
56 class ChLV( _ChLV): pass # PYCHOK E710
57 class ChLVa(_ChLV): pass # PYCHOK E710
58 class ChLVe(_ChLV): pass # PYCHOK E710
59 class ChLV9Tuple( _ChLV): pass # PYCHOK E710
60 class ChLVEN2Tuple(_ChLV): pass # PYCHOK E710
61 class ChLVYX2Tuple(_ChLV): pass # PYCHOK E710
62 class ChLVyx2Tuple(_ChLV): pass # PYCHOK E710
65class ClipCS3Tuple(_Deprecated_NamedTuple): # PYCHOK no cover
66 '''DEPRECATED, see I{DEPRECATED} function L{pygeodesy.deprecated.clipCS3}.'''
67 assert _ClipCS4Tuple._Names_.index(_i_) == 2
68 _Names_ = _reNames(_ClipCS4Tuple._Names_[:3], _i_, 'index')
69 _Units_ = _ClipCS4Tuple._Units_[:3]
72class ConformalTriaxial(Conformal):
73 '''DEPRECATED on 2025.11.11, use class L{Conformal}.'''
74 def __init__(self, *args, **kwds): # PYCHOK no cover
75 deprecated_class(self.__class__)
76 Conformal.__init__(self, *args, **kwds)
79class EasNorExact4Tuple(_Deprecated_NamedTuple):
80 '''DEPRECATED, use class L{Forward4Tuple}, item C{gamma} for C{convergence}.'''
81 _Names_ = _reNames(_Forward4Tuple._Names_, _gamma_, _convergence_)
82 _Units_ = _Forward4Tuple._Units_
85def EcefCartesian(*args, **kwds):
86 '''DEPRECATED, use class L{LocalCartesian}.'''
87 Ltp = _MODS.ltp.Ltp
89 class EcefCartesian_(Ltp):
90 '''DEPRECATED, use class L{LocalCartesian} or L{Ltp}.
92 @note: This class is named I{incorrectly}, since it provides conversion to
93 and from I{local} cartesian coordinates in a I{local tangent plane}
94 and I{not geocentric} (ECEF) ones, as the name would suggest.
95 '''
96 def __init__(self, latlonh0=0, lon0=0, height0=0, ecef=None, name=NN):
97 deprecated_class(self.__class__)
98 Ltp.__init__(self, latlonh0=latlonh0, lon0=lon0, height0=height0, ecef=ecef, name=name)
100 @deprecated_method
101 def forward(self, latlonh, lon=None, height=0, M=False, name=NN):
102 '''DEPRECATED, use method L{LocalCartesian.forward} or L{Ltp.forward}.
104 @return: I{Incorrectly}, an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C,
105 M, datum)} with I{local} C{(x, y, z)} coordinates for the given
106 I{geodetic} ones C{(lat, lon, height)}, case C{C=0} always,
107 optionally I{concatenated} L{EcefMatrix} C{M} and C{datum}.
108 '''
109 t = Ltp.forward(self, latlonh, lon=lon, height=height, M=M, name=name)
110 return _MODS.ecef.Ecef9Tuple(t.x, t.y, t.z, t.lat, t.lon, t.height,
111 0, t.M, t.ecef.datum,
112 name=t.name or self.name)
114 @deprecated_method
115 def reverse(self, xyz, y=None, z=None, M=False, name=NN):
116 '''DEPRECATED, use method L{LocalCartesian.reverse} or L{Ltp.reverse}.
118 @return: I{Incorrectly}, an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C,
119 M, datum)} with I{geodetic} coordinates C{(lat, lon, height)} for
120 the given I{local} ones C{(x, y, z)}, case C{C}, optionally
121 I{concatenated} L{EcefMatrix} C{M} and C{datum}.
122 '''
123 t = Ltp.reverse(self, xyz, y=y, z=z, M=M, name=name)
124 return _MODS.ecef.Ecef9Tuple(t.x, t.y, t.z, t.lat, t.lon, t.height,
125 t.ecef.C, t.M, t.ecef.datum,
126 name=t.name or self.name)
128 return EcefCartesian_(*args, **kwds)
131def Fn_rt(root, *xs, **name_RESIDUAL_raiser): # PYCHOK no cover
132 '''DEPRECATED on 2024.04.17, use class L{Froot}.
133 '''
134 Froot = _MODS.fmath.Froot
136 class Fn_rt(Froot): # PYCHOK no cover
137 '''DEPRECATED on 2024.04.17, use class L{Froot}.
138 '''
139 def __init__(self, root, *xs, **name_RESIDUAL_raiser):
140 deprecated_class(self.__class__)
141 Froot.__init__(self, root, *xs, **name_RESIDUAL_raiser)
144def FrechetCosineAndoyerLambert(point1s, **kwds): # PYCHOK no cover
145 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=1}.'''
146 FrechetCosineLaw = _MODS.frechet.FrechetCosineLaw
148 class FrechetCosineAndoyerLambert(FrechetCosineLaw):
149 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=1}.
150 '''
151 def __init__(self, point1s, **seed_name__radius_wrap):
152 deprecated_class(self.__class__)
153 FrechetCosineLaw.__init__(self, point1s, corr=1, **seed_name__radius_wrap)
155 return FrechetCosineAndoyerLambert(point1s, **kwds)
158def FrechetCosineForsytheAndoyerLambert(point1s, **kwds): # PYCHOK no cover
159 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=2}.'''
160 FrechetCosineLaw = _MODS.frechet.FrechetCosineLaw
162 class FrechetCosineForsytheAndoyerLambert(FrechetCosineLaw):
163 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=w}.
164 '''
165 def __init__(self, point1s, **seed_name__radius_wrap):
166 deprecated_class(self.__class__)
167 FrechetCosineLaw.__init__(self, point1s, corr=2, **seed_name__radius_wrap)
169 return FrechetCosineForsytheAndoyerLambert(point1s, **kwds)
172def HausdorffCosineAndoyerLambert(point1s, **kwds): # PYCHOK no cover
173 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=1}.'''
174 HausdorffCosineLaw = _MODS.hausdorff.HausdorffCosineLaw
176 class HausdorffCosineAndoyerLambert(HausdorffCosineLaw):
177 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=1}.
178 '''
179 def __init__(self, point1s, **seed_name__radius_wrap):
180 deprecated_class(self.__class__)
181 HausdorffCosineLaw.__init__(self, point1s, corr=1, **seed_name__radius_wrap)
183 return HausdorffCosineAndoyerLambert(point1s, **kwds)
186def HausdorffCosineForsytheAndoyerLambert(point1s, **kwds): # PYCHOK no cover
187 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=2}.'''
188 HausdorffCosineLaw = _MODS.hausdorff.HausdorffCosineLaw
190 class HausdorffCosineForsytheAndoyerLambert(HausdorffCosineLaw):
191 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=2}
192 '''
193 def __init__(self, point1s, **seed_name__radius_wrap):
194 deprecated_class(self.__class__)
195 HausdorffCosineLaw.__init__(self, point1s, corr=2, **seed_name__radius_wrap)
197 return HausdorffCosineForsytheAndoyerLambert(point1s, **kwds)
200def HeightIDW(knots, **kwds): # PYCHOK no cover
201 '''DEPRECATED, use class L{HeightIDWeuclidean}.'''
202 HeightIDWeuclidean = _MODS.heights.HeightIDWeuclidean
204 class HeightIDW(HeightIDWeuclidean):
205 '''DEPRECATED, use class L{HeightIDWeuclidean}.'''
206 def __init__(self, knots, adjust=True, beta=2, name=NN):
207 deprecated_class(self.__class__)
208 HeightIDWeuclidean.__init__(self, knots, adjust=adjust, beta=beta, name=name)
210 return HeightIDW(knots, **kwds)
213def HeightIDW2(knots, **kwds): # PYCHOK no cover
214 '''DEPRECATED, use class L{HeightIDWequirectangular}.'''
215 HeightIDWequirectangular = _MODS.heights.HeightIDWequirectangular
217 class HeightIDW2(HeightIDWequirectangular):
218 '''DEPRECATED, use class L{HeightIDWequirectangular}.'''
219 def __init__(self, knots, adjust=True, wrap=False, name=NN):
220 deprecated_class(self.__class__)
221 HeightIDWequirectangular.__init__(self, knots, adjust=adjust, wrap=wrap, name=name)
223 return HeightIDW2(knots, **kwds)
226def HeightIDW3(knots, **kwds): # PYCHOK no cover
227 '''DEPRECATED, use class L{HeightIDWhaversine}.'''
228 HeightIDWhaversine = _MODS.heights.HeightIDWhaversine
230 class HeightIDW3(HeightIDWhaversine):
231 '''DEPRECATED, use class L{HeightIDWhaversine}.
232 '''
233 def __init__(self, knots, beta=2, wrap=False, name=NN):
234 deprecated_class(self.__class__)
235 HeightIDWhaversine.__init__(self, knots, beta=beta, wrap=wrap, name=name)
237 return HeightIDW3(knots, **kwds)
240def HeightIDWcosineAndoyerLambert(knots, **kwds): # PYCHOK no cover
241 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=1}.'''
242 HeightIDWcosineLaw = _MODS.heights.HeightIDWcosineLaw
244 class HeightIDWcosineAndoyerLambert(HeightIDWcosineLaw):
245 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=1}.
246 '''
247 def __init__(self, knots, **beta_name__datum_wrap):
248 deprecated_class(self.__class__)
249 HeightIDWcosineLaw.__init__(self, knots, corr=1, **beta_name__datum_wrap)
251 return HeightIDWcosineAndoyerLambert(knots, **kwds)
254def HeightIDWcosineForsytheAndoyerLambert(knots, **kwds): # PYCHOK no cover
255 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=2}.'''
256 HeightIDWcosineLaw = _MODS.heights.HeightIDWcosineLaw
258 class HeightIDWcosineForsytheAndoyerLambert(HeightIDWcosineLaw):
259 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=2}.
260 '''
261 def __init__(self, knots, **beta_name__datum_wrap):
262 deprecated_class(self.__class__)
263 HeightIDWcosineLaw.__init__(self, knots, corr=2, **beta_name__datum_wrap)
265 return HeightIDWcosineForsytheAndoyerLambert(knots, **kwds)
268class JacobiConformal(Conformal):
269 '''DEPRECATED on 2025.10.25, use class L{Conformal}.'''
270 def __init__(self, *args, **kwds): # PYCHOK no cover
271 deprecated_class(self.__class__)
272 Conformal.__init__(self, *args, **kwds)
275class JacobiConformalSpherical(ConformalSphere):
276 '''DEPRECATED on 2025.10.25, use class L{ConformalSphere}.'''
277 def __init__(self, *args, **kwds): # PYCHOK no cover
278 deprecated_class(self.__class__)
279 ConformalSphere.__init__(self, *args, **kwds)
282class Jacobi2Tuple(Conformal2Tuple):
283 '''DEPRECATED on 25.11.11, use class L{Conformal2Tuple}.
284 '''
285 def __new__(cls, *args, **kwds):
286 deprecated_class(cls)
287 return Conformal2Tuple.__new__(cls, *args, **kwds)
290class Lam_(Lamd):
291 '''DEPRECATED on 2024.06.15, use class L{Lamd}.'''
292 def __init__(self, *args, **kwds): # PYCHOK no cover
293 deprecated_class(self.__class__)
294 Lamd.__init__(self, *args, **kwds)
297class LatLonExact4Tuple(_Deprecated_NamedTuple):
298 '''DEPRECATED, use class L{Reverse4Tuple}, item C{gamma} for C{convergence}.'''
299 _Names_ = _reNames(_Reverse4Tuple._Names_, _gamma_, _convergence_)
300 _Units_ = _Reverse4Tuple._Units_
303class NearestOn4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover
304 '''DEPRECATED on 2023.10.10, see methods L{RhumbLine.nearestOn4} and L{RhumbLineAux.nearestOn4}.'''
305 _Names_ = (_lat_, _lon_, _distance_, 'normal') # s12, azi02
306 _Units_ = ( Lat, Lon, Meter, Bearing)
309class Phi_(Phid):
310 '''DEPRECATED on 2024.06.15, use class L{Phid}.'''
311 def __init__(self, *args, **kwds): # PYCHOK no cover
312 deprecated_class(self.__class__)
313 Phid.__init__(self, *args, **kwds)
316class Ned3Tuple(_Deprecated_NamedTuple): # was in .ellipsoidalNvector
317 '''DEPRECATED, use class L{Ned4Tuple}, ignoring item C{ltp}.'''
318 assert _Ned4Tuple._Names_.index(_ltp_) == 3
319 _Names_ = _Ned4Tuple._Names_[:3]
320 _Units_ = _Ned4Tuple._Units_[:3]
323def RefFrameError(*args, **kwds): # PYCHOK no cover
324 '''DEPRECATED, use class L{TRFError}.'''
325 TRFError = _MODS.errors.TRFError
327 class RefFrameError(TRFError):
328 '''DEPRECATED, use class L{TRFError}.
329 '''
330 def __init__(self, *name_value, **txt_name_values):
331 deprecated_class(self.__class__)
332 TRFError.__init__(self, *name_value, **txt_name_values)
334 return RefFrameError(*args, **kwds)
337class Rhumb7Tuple(_Deprecated_NamedTuple):
338 '''DEPRECATED, use class L{Rhumb8Tuple}, ignoring item C{a12}.'''
339 assert _Rhumb8Tuple._Names_.index(_a12_) == 7
340 _Names_ = _Rhumb8Tuple._Names_[:7]
341 _Units_ = _Rhumb8Tuple._Units_[:7]
343 @deprecated_method
344 def toDirect9Tuple(self, **kwds): # PYCHOK no cover
345 return self.toRhumb8Tuple().toDirect9Tuple(self, **kwds)
347 @deprecated_method
348 def toGDict(self, **kwds): # PYCHOK no cover
349 return self.toRhumb8Tuple().toGDict(**kwds)
351 @deprecated_method
352 def toInverse10Tuple(self, **kwds): # PYCHOK no cover
353 return self.toRhumb8Tuple().toInverse10Tuple(self, **kwds)
355 @deprecated_method
356 def toRhumb8Tuple(self, dflt=NAN): # PYCHOK no cover
357 return _Rhumb8Tuple(self + (dflt,), name=self.name)
359 def _to7Tuple(self): # PYCHOK no cover
360 '''(INTERNAL) see L{Rhumb8Tuple._to7Tuple}.
361 '''
362 return self
365class RhumbOrder2Tuple(_Deprecated_NamedTuple, _GTuple):
366 '''DEPRECATED, see deprecated method L{Rhumb.orders}.'''
367 # 2-Tuple C{(RAorder, TMorder)} with a I{Rhumb Area} and
368 # I{Transverse Mercator} order, both C{int}.
369 _Names_ = ('RAorder', 'TMorder')
370 _Units_ = ( Int, Int)
373class Transform7Tuple(_Deprecated_NamedTuple): # PYCHOK no cover
374 '''DEPRECATED on 2024.02.02, use class L{TRFXform7Tuple}, I{without} keyword arguments.'''
375 _Names_ = _TRFXform7Tuple._Names_
376 _Units_ = _TRFXform7Tuple._Units_
378 def __new__(cls, tx=0, ty=0, tz=0, s=0,
379 sx=0, sy=0, sz=0, name=NN):
380 t = map(_float, (tx, ty, tz, s, sx, sy, sz))
381 return _Deprecated_NamedTuple.__new__(cls, *t, name=name)
383Helmert7Tuple = Transform7Tuple # PYCHOK likewise
386class TriAngle4Tuple(_Deprecated_NamedTuple):
387 '''DEPRECATED on 2023.09.14, use class L{TriAngle5Tuple}, ignoring item C{area}.'''
388 assert _TriAngle5Tuple._Names_.index(_area_) == 4
389 _Names_ = _TriAngle5Tuple._Names_[:4]
390 _Units_ = _TriAngle5Tuple._Units_[:4]
393class UtmUps4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover
394 '''DEPRECATED and OBSOLETE, expect a L{UtmUps5Tuple} from method C{pygeodesy.Mgrs.toUtm(utm=None)}.
396 4-Tuple C{(zone, hemipole, easting, northing)} with as C{zone} B{C{str}} and no C{band}.
397 '''
398 assert _UtmUps5Tuple._Names_.index(_band_) == 4
399 _Names_ = _UtmUps5Tuple._Names_[ :4] # band
400 _Units_ = (_Deprecated_Str,) + _UtmUps5Tuple._Units_[1:4]
403class XDist(ADict):
404 '''DEPRECATED on 2024.07.02, use class L{ADict}.'''
405 def __init__(self, *args, **kwds): # PYCHOK no cover
406 deprecated_class(self.__class__)
407 ADict.__init__(self, *args, **kwds)
410__all__ += _ALL_DOCS(_Deprecated_NamedTuple)
412# **) MIT License
413#
414# Copyright (C) 2018-2026 -- mrJean1 at Gmail -- All Rights Reserved.
415#
416# Permission is hereby granted, free of charge, to any person obtaining a
417# copy of this software and associated documentation files (the "Software"),
418# to deal in the Software without restriction, including without limitation
419# the rights to use, copy, modify, merge, publish, distribute, sublicense,
420# and/or sell copies of the Software, and to permit persons to whom the
421# Software is furnished to do so, subject to the following conditions:
422#
423# The above copyright notice and this permission notice shall be included
424# in all copies or substantial portions of the Software.
425#
426# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
427# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
428# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
429# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
430# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
431# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
432# OTHER DEALINGS IN THE SOFTWARE.