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

62 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-04-09 11:05 -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.trf import TRFXform7Tuple as _TRFXform7Tuple 

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

23 

24__all__ = _ALL_DEPRECATED.deprecated_classes 

25__version__ = '24.12.31' 

26 

27 

28class _Deprecated_NamedTuple(_NamedTuple): 

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

30 ''' 

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

32 deprecated_class(cls) 

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

34 

35 

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

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

38 i = names.index(old) 

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

40 

41 

42class ClipCS3Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

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

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

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

46 _Units_ = _ClipCS4Tuple._Units_[:3] 

47 

48 

49class EasNorExact4Tuple(_Deprecated_NamedTuple): 

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

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

52 _Units_ = _Forward4Tuple._Units_ 

53 

54 

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

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

57 Ltp = _MODS.ltp.Ltp 

58 

59 class EcefCartesian_(Ltp): 

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

61 

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

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

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

65 ''' 

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

67 deprecated_class(self.__class__) 

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

69 

70 @deprecated_method 

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

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

73 

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

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

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

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

78 ''' 

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

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

81 0, t.M, t.ecef.datum, 

82 name=t.name or self.name) 

83 

84 @deprecated_method 

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

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

87 

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

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

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

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

92 ''' 

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

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

95 t.ecef.C, t.M, t.ecef.datum, 

96 name=t.name or self.name) 

97 

98 return EcefCartesian_(*args, **kwds) 

99 

100 

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

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

103 ''' 

104 Froot = _MODS.fmath.Froot 

105 

106 class Fn_rt(Froot): # PYCHOK no cover 

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

108 ''' 

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

110 deprecated_class(self.__class__) 

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

112 

113 

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

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

116 FrechetCosineLaw = _MODS.frechet.FrechetCosineLaw 

117 

118 class FrechetCosineAndoyerLambert(FrechetCosineLaw): 

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

120 ''' 

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

122 deprecated_class(self.__class__) 

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

124 

125 return FrechetCosineAndoyerLambert(point1s, **kwds) 

126 

127 

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

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

130 FrechetCosineLaw = _MODS.frechet.FrechetCosineLaw 

131 

132 class FrechetCosineForsytheAndoyerLambert(FrechetCosineLaw): 

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

134 ''' 

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

136 deprecated_class(self.__class__) 

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

138 

139 return FrechetCosineForsytheAndoyerLambert(point1s, **kwds) 

140 

141 

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

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

144 HausdorffCosineLaw = _MODS.hausdorff.HausdorffCosineLaw 

145 

146 class HausdorffCosineAndoyerLambert(HausdorffCosineLaw): 

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

148 ''' 

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

150 deprecated_class(self.__class__) 

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

152 

153 return HausdorffCosineAndoyerLambert(point1s, **kwds) 

154 

155 

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

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

158 HausdorffCosineLaw = _MODS.hausdorff.HausdorffCosineLaw 

159 

160 class HausdorffCosineForsytheAndoyerLambert(HausdorffCosineLaw): 

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

162 ''' 

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

164 deprecated_class(self.__class__) 

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

166 

167 return HausdorffCosineForsytheAndoyerLambert(point1s, **kwds) 

168 

169 

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

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

172 HeightIDWeuclidean = _MODS.heights.HeightIDWeuclidean 

173 

174 class HeightIDW(HeightIDWeuclidean): 

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

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

177 deprecated_class(self.__class__) 

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

179 

180 return HeightIDW(knots, **kwds) 

181 

182 

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

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

185 HeightIDWequirectangular = _MODS.heights.HeightIDWequirectangular 

186 

187 class HeightIDW2(HeightIDWequirectangular): 

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

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

190 deprecated_class(self.__class__) 

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

192 

193 return HeightIDW2(knots, **kwds) 

194 

195 

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

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

198 HeightIDWhaversine = _MODS.heights.HeightIDWhaversine 

199 

200 class HeightIDW3(HeightIDWhaversine): 

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

202 ''' 

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

204 deprecated_class(self.__class__) 

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

206 

207 return HeightIDW3(knots, **kwds) 

208 

209 

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

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

212 HeightIDWcosineLaw = _MODS.heights.HeightIDWcosineLaw 

213 

214 class HeightIDWcosineAndoyerLambert(HeightIDWcosineLaw): 

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

216 ''' 

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

218 deprecated_class(self.__class__) 

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

220 

221 return HeightIDWcosineAndoyerLambert(knots, **kwds) 

222 

223 

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

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

226 HeightIDWcosineLaw = _MODS.heights.HeightIDWcosineLaw 

227 

228 class HeightIDWcosineForsytheAndoyerLambert(HeightIDWcosineLaw): 

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

230 ''' 

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

232 deprecated_class(self.__class__) 

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

234 

235 return HeightIDWcosineForsytheAndoyerLambert(knots, **kwds) 

236 

237 

238class Lam_(Lamd): 

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

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

241 deprecated_class(self.__class__) 

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

243 

244 

245class LatLonExact4Tuple(_Deprecated_NamedTuple): 

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

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

248 _Units_ = _Reverse4Tuple._Units_ 

249 

250 

251class NearestOn4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

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

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

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

255 

256 

257class Phi_(Phid): 

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

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

260 deprecated_class(self.__class__) 

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

262 

263 

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

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

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

267 _Names_ = _Ned4Tuple._Names_[:3] 

268 _Units_ = _Ned4Tuple._Units_[:3] 

269 

270 

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

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

273 TRFError = _MODS.errors.TRFError 

274 

275 class RefFrameError(TRFError): 

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

277 ''' 

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

279 deprecated_class(self.__class__) 

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

281 

282 return RefFrameError(*args, **kwds) 

283 

284 

285class Rhumb7Tuple(_Deprecated_NamedTuple): 

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

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

288 _Names_ = _Rhumb8Tuple._Names_[:7] 

289 _Units_ = _Rhumb8Tuple._Units_[:7] 

290 

291 @deprecated_method 

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

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

294 

295 @deprecated_method 

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

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

298 

299 @deprecated_method 

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

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

302 

303 @deprecated_method 

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

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

306 

307 def _to7Tuple(self): # PYCHOK no cover 

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

309 ''' 

310 return self 

311 

312 

313class RhumbOrder2Tuple(_Deprecated_NamedTuple, _GTuple): 

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

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

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

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

318 _Units_ = ( Int, Int) 

319 

320 

321class Transform7Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

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

323 _Names_ = _TRFXform7Tuple._Names_ 

324 _Units_ = _TRFXform7Tuple._Units_ 

325 

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

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

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

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

330 

331Helmert7Tuple = Transform7Tuple # PYCHOK likewise 

332 

333 

334class TriAngle4Tuple(_Deprecated_NamedTuple): 

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

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

337 _Names_ = _TriAngle5Tuple._Names_[:4] 

338 _Units_ = _TriAngle5Tuple._Units_[:4] 

339 

340 

341class UtmUps4Tuple(_Deprecated_NamedTuple): # PYCHOK no cover 

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

343 

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

345 ''' 

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

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

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

349 

350 

351class XDist(ADict): 

352 '''DEPRECATED on 2024.07.02, use class L{XDict}.''' 

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

354 deprecated_class(self.__class__) 

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

356 

357 

358__all__ += _ALL_DOCS(_Deprecated_NamedTuple) 

359 

360# **) MIT License 

361# 

362# Copyright (C) 2018-2025 -- mrJean1 at Gmail -- All Rights Reserved. 

363# 

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

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

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

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

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

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

370# 

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

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

373# 

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

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

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

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

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

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

380# OTHER DEALINGS IN THE SOFTWARE.