Skip to content

Commit c145db6

Browse files
committed
type hint
1 parent 1f3d2d9 commit c145db6

File tree

17 files changed

+605
-446
lines changed

17 files changed

+605
-446
lines changed

pymap3d/aer.py

Lines changed: 103 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
""" transforms involving AER: azimuth, elevation, slant range"""
2-
from typing import Tuple
2+
import typing
33
from datetime import datetime
44

55
from .ecef import ecef2enu, geodetic2ecef, ecef2geodetic, enu2uvw
@@ -13,10 +13,20 @@
1313

1414
__all__ = ["aer2ecef", "ecef2aer", "geodetic2aer", "aer2geodetic", "eci2aer", "aer2eci"]
1515

16+
if typing.TYPE_CHECKING:
17+
from numpy import ndarray
18+
1619

1720
def ecef2aer(
18-
x: float, y: float, z: float, lat0: float, lon0: float, h0: float, ell: Ellipsoid = None, deg: bool = True
19-
) -> Tuple[float, float, float]:
21+
x: "ndarray",
22+
y: "ndarray",
23+
z: "ndarray",
24+
lat0: "ndarray",
25+
lon0: "ndarray",
26+
h0: "ndarray",
27+
ell: Ellipsoid = None,
28+
deg: bool = True,
29+
) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
2030
"""
2131
compute azimuth, elevation and slant range from an Observer to a Point with ECEF coordinates.
2232
@@ -25,17 +35,17 @@ def ecef2aer(
2535
Parameters
2636
----------
2737
28-
x : float
38+
x : "ndarray"
2939
ECEF x coordinate (meters)
30-
y : float
40+
y : "ndarray"
3141
ECEF y coordinate (meters)
32-
z : float
42+
z : "ndarray"
3343
ECEF z coordinate (meters)
34-
lat0 : float
44+
lat0 : "ndarray"
3545
Observer geodetic latitude
36-
lon0 : float
46+
lon0 : "ndarray"
3747
Observer geodetic longitude
38-
h0 : float
48+
h0 : "ndarray"
3949
observer altitude above geodetic ellipsoid (meters)
4050
ell : Ellipsoid, optional
4151
reference ellipsoid
@@ -44,11 +54,11 @@ def ecef2aer(
4454
4555
Returns
4656
-------
47-
az : float
57+
az : "ndarray"
4858
azimuth to target
49-
el : float
59+
el : "ndarray"
5060
elevation to target
51-
srange : float
61+
srange : "ndarray"
5262
slant range [meters]
5363
"""
5464
xEast, yNorth, zUp = ecef2enu(x, y, z, lat0, lon0, h0, ell, deg=deg)
@@ -57,26 +67,33 @@ def ecef2aer(
5767

5868

5969
def geodetic2aer(
60-
lat: float, lon: float, h: float, lat0: float, lon0: float, h0: float, ell: Ellipsoid = None, deg: bool = True
61-
) -> Tuple[float, float, float]:
70+
lat: "ndarray",
71+
lon: "ndarray",
72+
h: "ndarray",
73+
lat0: "ndarray",
74+
lon0: "ndarray",
75+
h0: "ndarray",
76+
ell: Ellipsoid = None,
77+
deg: bool = True,
78+
) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
6279
"""
6380
gives azimuth, elevation and slant range from an Observer to a Point with geodetic coordinates.
6481
6582
6683
Parameters
6784
----------
6885
69-
lat : float
86+
lat : "ndarray"
7087
target geodetic latitude
71-
lon : float
88+
lon : "ndarray"
7289
target geodetic longitude
73-
h : float
90+
h : "ndarray"
7491
target altitude above geodetic ellipsoid (meters)
75-
lat0 : float
92+
lat0 : "ndarray"
7693
Observer geodetic latitude
77-
lon0 : float
94+
lon0 : "ndarray"
7895
Observer geodetic longitude
79-
h0 : float
96+
h0 : "ndarray"
8097
observer altitude above geodetic ellipsoid (meters)
8198
ell : Ellipsoid, optional
8299
reference ellipsoid
@@ -85,11 +102,11 @@ def geodetic2aer(
85102
86103
Returns
87104
-------
88-
az : float
105+
az : "ndarray"
89106
azimuth
90-
el : float
107+
el : "ndarray"
91108
elevation
92-
srange : float
109+
srange : "ndarray"
93110
slant range [meters]
94111
"""
95112
e, n, u = geodetic2enu(lat, lon, h, lat0, lon0, h0, ell, deg=deg)
@@ -98,25 +115,32 @@ def geodetic2aer(
98115

99116

100117
def aer2geodetic(
101-
az: float, el: float, srange: float, lat0: float, lon0: float, h0: float, ell: Ellipsoid = None, deg: bool = True
102-
) -> Tuple[float, float, float]:
118+
az: "ndarray",
119+
el: "ndarray",
120+
srange: "ndarray",
121+
lat0: "ndarray",
122+
lon0: "ndarray",
123+
h0: "ndarray",
124+
ell: Ellipsoid = None,
125+
deg: bool = True,
126+
) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
103127
"""
104128
gives geodetic coordinates of a point with az, el, range
105129
from an observer at lat0, lon0, h0
106130
107131
Parameters
108132
----------
109-
az : float
133+
az : "ndarray"
110134
azimuth to target
111-
el : float
135+
el : "ndarray"
112136
elevation to target
113-
srange : float
137+
srange : "ndarray"
114138
slant range [meters]
115-
lat0 : float
139+
lat0 : "ndarray"
116140
Observer geodetic latitude
117-
lon0 : float
141+
lon0 : "ndarray"
118142
Observer geodetic longitude
119-
h0 : float
143+
h0 : "ndarray"
120144
observer altitude above geodetic ellipsoid (meters)
121145
ell : Ellipsoid, optional
122146
reference ellipsoid
@@ -128,11 +152,11 @@ def aer2geodetic(
128152
129153
In reference ellipsoid system:
130154
131-
lat : float
155+
lat : "ndarray"
132156
geodetic latitude
133-
lon : float
157+
lon : "ndarray"
134158
geodetic longitude
135-
alt : float
159+
alt : "ndarray"
136160
altitude above ellipsoid (meters)
137161
"""
138162
x, y, z = aer2ecef(az, el, srange, lat0, lon0, h0, ell=ell, deg=deg)
@@ -141,25 +165,25 @@ def aer2geodetic(
141165

142166

143167
def eci2aer(
144-
x: float, y: float, z: float, lat0: float, lon0: float, h0: float, t: datetime, useastropy: bool = True
145-
) -> Tuple[float, float, float]:
168+
x: "ndarray", y: "ndarray", z: "ndarray", lat0: "ndarray", lon0: "ndarray", h0: "ndarray", t: datetime, useastropy: bool = True
169+
) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
146170
"""
147171
takes Earth Centered Inertial x,y,z ECI coordinates of point and gives az, el, slant range from Observer
148172
149173
Parameters
150174
----------
151175
152-
x : float
176+
x : "ndarray"
153177
ECI x-location [meters]
154-
y : float
178+
y : "ndarray"
155179
ECI y-location [meters]
156-
z : float
180+
z : "ndarray"
157181
ECI z-location [meters]
158-
lat0 : float
182+
lat0 : "ndarray"
159183
Observer geodetic latitude
160-
lon0 : float
184+
lon0 : "ndarray"
161185
Observer geodetic longitude
162-
h0 : float
186+
h0 : "ndarray"
163187
observer altitude above geodetic ellipsoid (meters)
164188
t : datetime.datetime
165189
Observation time
@@ -168,11 +192,11 @@ def eci2aer(
168192
169193
Returns
170194
-------
171-
az : float
195+
az : "ndarray"
172196
azimuth to target
173-
el : float
197+
el : "ndarray"
174198
elevation to target
175-
srange : float
199+
srange : "ndarray"
176200
slant range [meters]
177201
"""
178202
if eci2ecef is None:
@@ -184,33 +208,33 @@ def eci2aer(
184208

185209

186210
def aer2eci(
187-
az: float,
188-
el: float,
189-
srange: float,
190-
lat0: float,
191-
lon0: float,
192-
h0: float,
211+
az: "ndarray",
212+
el: "ndarray",
213+
srange: "ndarray",
214+
lat0: "ndarray",
215+
lon0: "ndarray",
216+
h0: "ndarray",
193217
t: datetime,
194218
ell=None,
195219
deg: bool = True,
196220
useastropy: bool = True,
197-
) -> Tuple[float, float, float]:
221+
) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
198222
"""
199223
gives ECI of a point from an observer at az, el, slant range
200224
201225
Parameters
202226
----------
203-
az : float
227+
az : "ndarray"
204228
azimuth to target
205-
el : float
229+
el : "ndarray"
206230
elevation to target
207-
srange : float
231+
srange : "ndarray"
208232
slant range [meters]
209-
lat0 : float
233+
lat0 : "ndarray"
210234
Observer geodetic latitude
211-
lon0 : float
235+
lon0 : "ndarray"
212236
Observer geodetic longitude
213-
h0 : float
237+
h0 : "ndarray"
214238
observer altitude above geodetic ellipsoid (meters)
215239
t : datetime.datetime
216240
Observation time
@@ -226,11 +250,11 @@ def aer2eci(
226250
227251
Earth Centered Inertial x,y,z
228252
229-
x : float
253+
x : "ndarray"
230254
ECEF x coordinate (meters)
231-
y : float
255+
y : "ndarray"
232256
ECEF y coordinate (meters)
233-
z : float
257+
z : "ndarray"
234258
ECEF z coordinate (meters)
235259
"""
236260
if ecef2eci is None:
@@ -242,24 +266,31 @@ def aer2eci(
242266

243267

244268
def aer2ecef(
245-
az: float, el: float, srange: float, lat0: float, lon0: float, alt0: float, ell: Ellipsoid = None, deg: bool = True
246-
) -> Tuple[float, float, float]:
269+
az: "ndarray",
270+
el: "ndarray",
271+
srange: "ndarray",
272+
lat0: "ndarray",
273+
lon0: "ndarray",
274+
alt0: "ndarray",
275+
ell: Ellipsoid = None,
276+
deg: bool = True,
277+
) -> typing.Tuple["ndarray", "ndarray", "ndarray"]:
247278
"""
248279
converts target azimuth, elevation, range from observer at lat0,lon0,alt0 to ECEF coordinates.
249280
250281
Parameters
251282
----------
252-
az : float
283+
az : "ndarray"
253284
azimuth to target
254-
el : float
285+
el : "ndarray"
255286
elevation to target
256-
srange : float
287+
srange : "ndarray"
257288
slant range [meters]
258-
lat0 : float
289+
lat0 : "ndarray"
259290
Observer geodetic latitude
260-
lon0 : float
291+
lon0 : "ndarray"
261292
Observer geodetic longitude
262-
h0 : float
293+
h0 : "ndarray"
263294
observer altitude above geodetic ellipsoid (meters)
264295
ell : Ellipsoid, optional
265296
reference ellipsoid
@@ -271,11 +302,11 @@ def aer2ecef(
271302
272303
ECEF (Earth centered, Earth fixed) x,y,z
273304
274-
x : float
305+
x : "ndarray"
275306
ECEF x coordinate (meters)
276-
y : float
307+
y : "ndarray"
277308
ECEF y coordinate (meters)
278-
z : float
309+
z : "ndarray"
279310
ECEF z coordinate (meters)
280311
281312

0 commit comments

Comments
 (0)