Coverage for pygeodesy/deprecated/classes.py: 97%

70 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2026-03-25 15:01 -0400

1 

2# -*- coding: utf-8 -*- 

3 

4u'''DEPRECATED classes kept for backward compatibility. 

5''' 

6 

7from pygeodesy.clipy import ClipCS4Tuple as _ClipCS4Tuple 

8from pygeodesy.constants import NAN, _float 

9from pygeodesy.interns import NN, _a12_, _area_, _band_, _convergence_, \ 

10 _distance_, _gamma_, _i_, _lat_, _lon_, _ltp_ 

11from pygeodesy.deprecated.consterns import _Deprecated_Str 

12from pygeodesy.karney import _GTuple, Rhumb8Tuple as _Rhumb8Tuple, ADict 

13from pygeodesy.lazily import _ALL_DEPRECATED, _ALL_DOCS, _ALL_MODS as _MODS 

14from pygeodesy.ltpTuples import Ned4Tuple as _Ned4Tuple 

15# from pygeodesy.named import ADict, _NamedTuple # from .karney, .namedTuples 

16from pygeodesy.namedTuples import Forward4Tuple as _Forward4Tuple, \ 

17 Reverse4Tuple as _Reverse4Tuple, \ 

18 UtmUps5Tuple as _UtmUps5Tuple, _NamedTuple 

19from pygeodesy.props import deprecated_class, deprecated_method 

20from pygeodesy.resections import TriAngle5Tuple as _TriAngle5Tuple 

21from pygeodesy.triaxials import Conformal, ConformalSphere, Conformal2Tuple 

22from pygeodesy.trf import TRFXform7Tuple as _TRFXform7Tuple 

23from pygeodesy.units import Bearing, Int, Lamd, Lat, Lon, Meter, Phid 

24 

25__all__ = _ALL_DEPRECATED.deprecated_classes 

26__version__ = '25.11.11' 

27 

28 

29class _Deprecated_NamedTuple(_NamedTuple): 

30 '''DEPRECATED, C{_NamedTuple} base. 

31 ''' 

32 def __new__(cls, *args, **kwds): 

33 deprecated_class(cls) 

34 return _NamedTuple.__new__(cls, *args, **kwds) 

35 

36 

37def _reNames(names, old, *new): 

38 # replace item C{old} with C{new} name 

39 i = names.index(old) 

40 return names[:i] + new + names[i + 1:] 

41 

42 

43class ClipCS3Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

44 '''DEPRECATED, see I{DEPRECATED} function L{pygeodesy.deprecated.clipCS3}.''' 

45 assert _ClipCS4Tuple._Names_.index(_i_) == 2 

46 _Names_ = _reNames(_ClipCS4Tuple._Names_[:3], _i_, 'index') 

47 _Units_ = _ClipCS4Tuple._Units_[:3] 

48 

49 

50class ConformalTriaxial(Conformal): 

51 '''DEPRECATED on 2025.11.11, use class L{Conformal}.''' 

52 def __init__(self, *args, **kwds): # PYCHOK no cover 

53 deprecated_class(self.__class__) 

54 Conformal.__init__(self, *args, **kwds) 

55 

56 

57class EasNorExact4Tuple(_Deprecated_NamedTuple): 

58 '''DEPRECATED, use class L{Forward4Tuple}, item C{gamma} for C{convergence}.''' 

59 _Names_ = _reNames(_Forward4Tuple._Names_, _gamma_, _convergence_) 

60 _Units_ = _Forward4Tuple._Units_ 

61 

62 

63def EcefCartesian(*args, **kwds): 

64 '''DEPRECATED, use class L{LocalCartesian}.''' 

65 Ltp = _MODS.ltp.Ltp 

66 

67 class EcefCartesian_(Ltp): 

68 '''DEPRECATED, use class L{LocalCartesian} or L{Ltp}. 

69 

70 @note: This class is named I{incorrectly}, since it provides conversion to 

71 and from I{local} cartesian coordinates in a I{local tangent plane} 

72 and I{not geocentric} (ECEF) ones, as the name would suggest. 

73 ''' 

74 def __init__(self, latlonh0=0, lon0=0, height0=0, ecef=None, name=NN): 

75 deprecated_class(self.__class__) 

76 Ltp.__init__(self, latlonh0=latlonh0, lon0=lon0, height0=height0, ecef=ecef, name=name) 

77 

78 @deprecated_method 

79 def forward(self, latlonh, lon=None, height=0, M=False, name=NN): 

80 '''DEPRECATED, use method L{LocalCartesian.forward} or L{Ltp.forward}. 

81 

82 @return: I{Incorrectly}, an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C, 

83 M, datum)} with I{local} C{(x, y, z)} coordinates for the given 

84 I{geodetic} ones C{(lat, lon, height)}, case C{C=0} always, 

85 optionally I{concatenated} L{EcefMatrix} C{M} and C{datum}. 

86 ''' 

87 t = Ltp.forward(self, latlonh, lon=lon, height=height, M=M, name=name) 

88 return _MODS.ecef.Ecef9Tuple(t.x, t.y, t.z, t.lat, t.lon, t.height, 

89 0, t.M, t.ecef.datum, 

90 name=t.name or self.name) 

91 

92 @deprecated_method 

93 def reverse(self, xyz, y=None, z=None, M=False, name=NN): 

94 '''DEPRECATED, use method L{LocalCartesian.reverse} or L{Ltp.reverse}. 

95 

96 @return: I{Incorrectly}, an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C, 

97 M, datum)} with I{geodetic} coordinates C{(lat, lon, height)} for 

98 the given I{local} ones C{(x, y, z)}, case C{C}, optionally 

99 I{concatenated} L{EcefMatrix} C{M} and C{datum}. 

100 ''' 

101 t = Ltp.reverse(self, xyz, y=y, z=z, M=M, name=name) 

102 return _MODS.ecef.Ecef9Tuple(t.x, t.y, t.z, t.lat, t.lon, t.height, 

103 t.ecef.C, t.M, t.ecef.datum, 

104 name=t.name or self.name) 

105 

106 return EcefCartesian_(*args, **kwds) 

107 

108 

109def Fn_rt(root, *xs, **name_RESIDUAL_raiser): # PYCHOK no cover 

110 '''DEPRECATED on 2024.04.17, use class L{Froot}. 

111 ''' 

112 Froot = _MODS.fmath.Froot 

113 

114 class Fn_rt(Froot): # PYCHOK no cover 

115 '''DEPRECATED on 2024.04.17, use class L{Froot}. 

116 ''' 

117 def __init__(self, root, *xs, **name_RESIDUAL_raiser): 

118 deprecated_class(self.__class__) 

119 Froot.__init__(self, root, *xs, **name_RESIDUAL_raiser) 

120 

121 

122def FrechetCosineAndoyerLambert(point1s, **kwds): # PYCHOK no cover 

123 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=1}.''' 

124 FrechetCosineLaw = _MODS.frechet.FrechetCosineLaw 

125 

126 class FrechetCosineAndoyerLambert(FrechetCosineLaw): 

127 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=1}. 

128 ''' 

129 def __init__(self, point1s, **seed_name__radius_wrap): 

130 deprecated_class(self.__class__) 

131 FrechetCosineLaw.__init__(self, point1s, corr=1, **seed_name__radius_wrap) 

132 

133 return FrechetCosineAndoyerLambert(point1s, **kwds) 

134 

135 

136def FrechetCosineForsytheAndoyerLambert(point1s, **kwds): # PYCHOK no cover 

137 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=2}.''' 

138 FrechetCosineLaw = _MODS.frechet.FrechetCosineLaw 

139 

140 class FrechetCosineForsytheAndoyerLambert(FrechetCosineLaw): 

141 '''DEPRECATED on 2024.12.31, use class L{FrechetCosineLaw} with C{B{corr}=w}. 

142 ''' 

143 def __init__(self, point1s, **seed_name__radius_wrap): 

144 deprecated_class(self.__class__) 

145 FrechetCosineLaw.__init__(self, point1s, corr=2, **seed_name__radius_wrap) 

146 

147 return FrechetCosineForsytheAndoyerLambert(point1s, **kwds) 

148 

149 

150def HausdorffCosineAndoyerLambert(point1s, **kwds): # PYCHOK no cover 

151 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=1}.''' 

152 HausdorffCosineLaw = _MODS.hausdorff.HausdorffCosineLaw 

153 

154 class HausdorffCosineAndoyerLambert(HausdorffCosineLaw): 

155 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=1}. 

156 ''' 

157 def __init__(self, point1s, **seed_name__radius_wrap): 

158 deprecated_class(self.__class__) 

159 HausdorffCosineLaw.__init__(self, point1s, corr=1, **seed_name__radius_wrap) 

160 

161 return HausdorffCosineAndoyerLambert(point1s, **kwds) 

162 

163 

164def HausdorffCosineForsytheAndoyerLambert(point1s, **kwds): # PYCHOK no cover 

165 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=2}.''' 

166 HausdorffCosineLaw = _MODS.hausdorff.HausdorffCosineLaw 

167 

168 class HausdorffCosineForsytheAndoyerLambert(HausdorffCosineLaw): 

169 '''DEPRECATED on 2024.12.31, use class L{HausdorffCosineLaw} with C{B{corr}=2} 

170 ''' 

171 def __init__(self, point1s, **seed_name__radius_wrap): 

172 deprecated_class(self.__class__) 

173 HausdorffCosineLaw.__init__(self, point1s, corr=2, **seed_name__radius_wrap) 

174 

175 return HausdorffCosineForsytheAndoyerLambert(point1s, **kwds) 

176 

177 

178def HeightIDW(knots, **kwds): # PYCHOK no cover 

179 '''DEPRECATED, use class L{HeightIDWeuclidean}.''' 

180 HeightIDWeuclidean = _MODS.heights.HeightIDWeuclidean 

181 

182 class HeightIDW(HeightIDWeuclidean): 

183 '''DEPRECATED, use class L{HeightIDWeuclidean}.''' 

184 def __init__(self, knots, adjust=True, beta=2, name=NN): 

185 deprecated_class(self.__class__) 

186 HeightIDWeuclidean.__init__(self, knots, adjust=adjust, beta=beta, name=name) 

187 

188 return HeightIDW(knots, **kwds) 

189 

190 

191def HeightIDW2(knots, **kwds): # PYCHOK no cover 

192 '''DEPRECATED, use class L{HeightIDWequirectangular}.''' 

193 HeightIDWequirectangular = _MODS.heights.HeightIDWequirectangular 

194 

195 class HeightIDW2(HeightIDWequirectangular): 

196 '''DEPRECATED, use class L{HeightIDWequirectangular}.''' 

197 def __init__(self, knots, adjust=True, wrap=False, name=NN): 

198 deprecated_class(self.__class__) 

199 HeightIDWequirectangular.__init__(self, knots, adjust=adjust, wrap=wrap, name=name) 

200 

201 return HeightIDW2(knots, **kwds) 

202 

203 

204def HeightIDW3(knots, **kwds): # PYCHOK no cover 

205 '''DEPRECATED, use class L{HeightIDWhaversine}.''' 

206 HeightIDWhaversine = _MODS.heights.HeightIDWhaversine 

207 

208 class HeightIDW3(HeightIDWhaversine): 

209 '''DEPRECATED, use class L{HeightIDWhaversine}. 

210 ''' 

211 def __init__(self, knots, beta=2, wrap=False, name=NN): 

212 deprecated_class(self.__class__) 

213 HeightIDWhaversine.__init__(self, knots, beta=beta, wrap=wrap, name=name) 

214 

215 return HeightIDW3(knots, **kwds) 

216 

217 

218def HeightIDWcosineAndoyerLambert(knots, **kwds): # PYCHOK no cover 

219 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=1}.''' 

220 HeightIDWcosineLaw = _MODS.heights.HeightIDWcosineLaw 

221 

222 class HeightIDWcosineAndoyerLambert(HeightIDWcosineLaw): 

223 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=1}. 

224 ''' 

225 def __init__(self, knots, **beta_name__datum_wrap): 

226 deprecated_class(self.__class__) 

227 HeightIDWcosineLaw.__init__(self, knots, corr=1, **beta_name__datum_wrap) 

228 

229 return HeightIDWcosineAndoyerLambert(knots, **kwds) 

230 

231 

232def HeightIDWcosineForsytheAndoyerLambert(knots, **kwds): # PYCHOK no cover 

233 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=2}.''' 

234 HeightIDWcosineLaw = _MODS.heights.HeightIDWcosineLaw 

235 

236 class HeightIDWcosineForsytheAndoyerLambert(HeightIDWcosineLaw): 

237 '''DEPRECATED on 2024.12.31, use class L{HeightIDWcosineLaw} with C{B{corr}=2}. 

238 ''' 

239 def __init__(self, knots, **beta_name__datum_wrap): 

240 deprecated_class(self.__class__) 

241 HeightIDWcosineLaw.__init__(self, knots, corr=2, **beta_name__datum_wrap) 

242 

243 return HeightIDWcosineForsytheAndoyerLambert(knots, **kwds) 

244 

245 

246class JacobiConformal(Conformal): 

247 '''DEPRECATED on 2025.10.25, use class L{Conformal}.''' 

248 def __init__(self, *args, **kwds): # PYCHOK no cover 

249 deprecated_class(self.__class__) 

250 Conformal.__init__(self, *args, **kwds) 

251 

252 

253class JacobiConformalSpherical(ConformalSphere): 

254 '''DEPRECATED on 2025.10.25, use class L{ConformalSphere}.''' 

255 def __init__(self, *args, **kwds): # PYCHOK no cover 

256 deprecated_class(self.__class__) 

257 ConformalSphere.__init__(self, *args, **kwds) 

258 

259 

260class Jacobi2Tuple(Conformal2Tuple): 

261 '''DEPRECATED on 25.11.11, use class L{Conformal2Tuple}. 

262 ''' 

263 def __new__(cls, *args, **kwds): 

264 deprecated_class(cls) 

265 return Conformal2Tuple.__new__(cls, *args, **kwds) 

266 

267 

268class Lam_(Lamd): 

269 '''DEPRECATED on 2024.06.15, use class L{Lamd}.''' 

270 def __init__(self, *args, **kwds): # PYCHOK no cover 

271 deprecated_class(self.__class__) 

272 Lamd.__init__(self, *args, **kwds) 

273 

274 

275class LatLonExact4Tuple(_Deprecated_NamedTuple): 

276 '''DEPRECATED, use class L{Reverse4Tuple}, item C{gamma} for C{convergence}.''' 

277 _Names_ = _reNames(_Reverse4Tuple._Names_, _gamma_, _convergence_) 

278 _Units_ = _Reverse4Tuple._Units_ 

279 

280 

281class NearestOn4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

282 '''DEPRECATED on 2023.10.10, see methods L{RhumbLine.nearestOn4} and L{RhumbLineAux.nearestOn4}.''' 

283 _Names_ = (_lat_, _lon_, _distance_, 'normal') # s12, azi02 

284 _Units_ = ( Lat, Lon, Meter, Bearing) 

285 

286 

287class Phi_(Phid): 

288 '''DEPRECATED on 2024.06.15, use class L{Phid}.''' 

289 def __init__(self, *args, **kwds): # PYCHOK no cover 

290 deprecated_class(self.__class__) 

291 Phid.__init__(self, *args, **kwds) 

292 

293 

294class Ned3Tuple(_Deprecated_NamedTuple): # was in .ellipsoidalNvector 

295 '''DEPRECATED, use class L{Ned4Tuple}, ignoring item C{ltp}.''' 

296 assert _Ned4Tuple._Names_.index(_ltp_) == 3 

297 _Names_ = _Ned4Tuple._Names_[:3] 

298 _Units_ = _Ned4Tuple._Units_[:3] 

299 

300 

301def RefFrameError(*args, **kwds): # PYCHOK no cover 

302 '''DEPRECATED, use class L{TRFError}.''' 

303 TRFError = _MODS.errors.TRFError 

304 

305 class RefFrameError(TRFError): 

306 '''DEPRECATED, use class L{TRFError}. 

307 ''' 

308 def __init__(self, *name_value, **txt_name_values): 

309 deprecated_class(self.__class__) 

310 TRFError.__init__(self, *name_value, **txt_name_values) 

311 

312 return RefFrameError(*args, **kwds) 

313 

314 

315class Rhumb7Tuple(_Deprecated_NamedTuple): 

316 '''DEPRECATED, use class L{Rhumb8Tuple}, ignoring item C{a12}.''' 

317 assert _Rhumb8Tuple._Names_.index(_a12_) == 7 

318 _Names_ = _Rhumb8Tuple._Names_[:7] 

319 _Units_ = _Rhumb8Tuple._Units_[:7] 

320 

321 @deprecated_method 

322 def toDirect9Tuple(self, **kwds): # PYCHOK no cover 

323 return self.toRhumb8Tuple().toDirect9Tuple(self, **kwds) 

324 

325 @deprecated_method 

326 def toGDict(self, **kwds): # PYCHOK no cover 

327 return self.toRhumb8Tuple().toGDict(**kwds) 

328 

329 @deprecated_method 

330 def toInverse10Tuple(self, **kwds): # PYCHOK no cover 

331 return self.toRhumb8Tuple().toInverse10Tuple(self, **kwds) 

332 

333 @deprecated_method 

334 def toRhumb8Tuple(self, dflt=NAN): # PYCHOK no cover 

335 return _Rhumb8Tuple(self + (dflt,), name=self.name) 

336 

337 def _to7Tuple(self): # PYCHOK no cover 

338 '''(INTERNAL) see L{Rhumb8Tuple._to7Tuple}. 

339 ''' 

340 return self 

341 

342 

343class RhumbOrder2Tuple(_Deprecated_NamedTuple, _GTuple): 

344 '''DEPRECATED, see deprecated method L{Rhumb.orders}.''' 

345 # 2-Tuple C{(RAorder, TMorder)} with a I{Rhumb Area} and 

346 # I{Transverse Mercator} order, both C{int}. 

347 _Names_ = ('RAorder', 'TMorder') 

348 _Units_ = ( Int, Int) 

349 

350 

351class Transform7Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

352 '''DEPRECATED on 2024.02.02, use class L{TRFXform7Tuple}, I{without} keyword arguments.''' 

353 _Names_ = _TRFXform7Tuple._Names_ 

354 _Units_ = _TRFXform7Tuple._Units_ 

355 

356 def __new__(cls, tx=0, ty=0, tz=0, s=0, 

357 sx=0, sy=0, sz=0, name=NN): 

358 t = map(_float, (tx, ty, tz, s, sx, sy, sz)) 

359 return _Deprecated_NamedTuple.__new__(cls, *t, name=name) 

360 

361Helmert7Tuple = Transform7Tuple # PYCHOK likewise 

362 

363 

364class TriAngle4Tuple(_Deprecated_NamedTuple): 

365 '''DEPRECATED on 2023.09.14, use class L{TriAngle5Tuple}, ignoring item C{area}.''' 

366 assert _TriAngle5Tuple._Names_.index(_area_) == 4 

367 _Names_ = _TriAngle5Tuple._Names_[:4] 

368 _Units_ = _TriAngle5Tuple._Units_[:4] 

369 

370 

371class UtmUps4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

372 '''DEPRECATED and OBSOLETE, expect a L{UtmUps5Tuple} from method C{pygeodesy.Mgrs.toUtm(utm=None)}. 

373 

374 4-Tuple C{(zone, hemipole, easting, northing)} with as C{zone} B{C{str}} and no C{band}. 

375 ''' 

376 assert _UtmUps5Tuple._Names_.index(_band_) == 4 

377 _Names_ = _UtmUps5Tuple._Names_[ :4] # band 

378 _Units_ = (_Deprecated_Str,) + _UtmUps5Tuple._Units_[1:4] 

379 

380 

381class XDist(ADict): 

382 '''DEPRECATED on 2024.07.02, use class L{ADict}.''' 

383 def __init__(self, *args, **kwds): # PYCHOK no cover 

384 deprecated_class(self.__class__) 

385 ADict.__init__(self, *args, **kwds) 

386 

387 

388__all__ += _ALL_DOCS(_Deprecated_NamedTuple) 

389 

390# **) MIT License 

391# 

392# Copyright (C) 2018-2026 -- mrJean1 at Gmail -- All Rights Reserved. 

393# 

394# Permission is hereby granted, free of charge, to any person obtaining a 

395# copy of this software and associated documentation files (the "Software"), 

396# to deal in the Software without restriction, including without limitation 

397# the rights to use, copy, modify, merge, publish, distribute, sublicense, 

398# and/or sell copies of the Software, and to permit persons to whom the 

399# Software is furnished to do so, subject to the following conditions: 

400# 

401# The above copyright notice and this permission notice shall be included 

402# in all copies or substantial portions of the Software. 

403# 

404# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 

405# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 

406# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 

407# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 

408# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 

409# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 

410# OTHER DEALINGS IN THE SOFTWARE.