11""" Transforms involving ECEF: earth-centered, earth-fixed frame """
22try :
33 from numpy import radians , sin , cos , tan , arctan as atan , hypot , degrees , arctan2 as atan2 , sqrt , pi , vectorize
4- from .eci import eci2ecef
4+ from .eci import eci2ecef , ecef2eci
55except ImportError :
66 from math import radians , sin , cos , tan , atan , hypot , degrees , atan2 , sqrt , pi
77
1515# py < 3.6 compatible
1616tau = 2 * pi
1717
18- __all__ = ["geodetic2ecef" , "ecef2geodetic" , "ecef2enuv" , "ecef2enu" , "enu2uvw" , "uvw2enu" , "eci2geodetic" , "enu2ecef" ]
18+ __all__ = [
19+ "geodetic2ecef" ,
20+ "ecef2geodetic" ,
21+ "ecef2enuv" ,
22+ "ecef2enu" ,
23+ "enu2uvw" ,
24+ "uvw2enu" ,
25+ "eci2geodetic" ,
26+ "geodetic2eci" ,
27+ "enu2ecef" ,
28+ ]
1929
2030if typing .TYPE_CHECKING :
2131 from numpy import ndarray
@@ -320,10 +330,14 @@ def uvw2enu(
320330 return East , North , Up
321331
322332
323- def eci2geodetic (x : "ndarray" , y : "ndarray" , z : "ndarray" , t : datetime ) -> typing .Tuple ["ndarray" , "ndarray" , "ndarray" ]:
333+ def eci2geodetic (
334+ x : "ndarray" , y : "ndarray" , z : "ndarray" , t : datetime , ell : Ellipsoid = None , deg : bool = True
335+ ) -> typing .Tuple ["ndarray" , "ndarray" , "ndarray" ]:
324336 """
325337 convert Earth Centered Internal ECI to geodetic coordinates
326338
339+ J2000 time
340+
327341 Parameters
328342 ----------
329343 x : "ndarray"
@@ -333,7 +347,11 @@ def eci2geodetic(x: "ndarray", y: "ndarray", z: "ndarray", t: datetime) -> typin
333347 z : "ndarray"
334348 ECI z-location [meters]
335349 t : datetime.datetime, "ndarray"
336- length N vector of datetime OR greenwich sidereal time angle [radians].
350+ UTC time
351+ ell : Ellipsoid (optional)
352+ planet ellipsoid model
353+ deg : bool (optional)
354+ if True, degrees. if False, radians
337355
338356 Results
339357 -------
@@ -344,21 +362,56 @@ def eci2geodetic(x: "ndarray", y: "ndarray", z: "ndarray", t: datetime) -> typin
344362 alt : "ndarray"
345363 altitude above ellipsoid (meters)
346364
347- Notes
348- -----
349-
350- Conversion is idealized: doesn't consider nutations, perterbations,
351- etc. like the IAU-76/FK5 or IAU-2000/2006 model-based conversions
352- from ECI to ECEF
353-
354365 eci2geodetic() a.k.a. eci2lla()
355366 """
356367 if eci2ecef is None :
357368 raise ImportError ("pip install astropy" )
358369
359370 xecef , yecef , zecef = eci2ecef (x , y , z , t )
360371
361- return ecef2geodetic (xecef , yecef , zecef )
372+ return ecef2geodetic (xecef , yecef , zecef , ell , deg )
373+
374+
375+ def geodetic2eci (
376+ lat : "ndarray" , lon : "ndarray" , alt : "ndarray" , t : datetime , ell : Ellipsoid = None , deg : bool = True
377+ ) -> typing .Tuple ["ndarray" , "ndarray" , "ndarray" ]:
378+ """
379+ convert geodetic coordinates to Earth Centered Internal ECI
380+
381+ J2000 frame
382+
383+ Parameters
384+ ----------
385+ lat : "ndarray"
386+ geodetic latitude
387+ lon : "ndarray"
388+ geodetic longitude
389+ alt : "ndarray"
390+ altitude above ellipsoid (meters)
391+ t : datetime.datetime, "ndarray"
392+ UTC time
393+ ell : Ellipsoid (optional)
394+ planet ellipsoid model
395+ deg : bool (optional)
396+ if True, degrees. if False, radians
397+
398+ Results
399+ -------
400+ x : "ndarray"
401+ ECI x-location [meters]
402+ y : "ndarray"
403+ ECI y-location [meters]
404+ z : "ndarray"
405+ ECI z-location [meters]
406+
407+ geodetic2eci() a.k.a lla2eci()
408+ """
409+ if ecef2eci is None :
410+ raise ImportError ("pip install astropy" )
411+
412+ x , y , z = geodetic2ecef (lat , lon , alt , ell , deg )
413+
414+ return ecef2eci (x , y , z , t )
362415
363416
364417def enu2ecef (
@@ -384,9 +437,9 @@ def enu2ecef(
384437 u1 : "ndarray"
385438 target up ENU coordinate (meters)
386439 lat0 : "ndarray"
387- Observer geodetic latitude
440+ Observer geodetic latitude
388441 lon0 : "ndarray"
389- Observer geodetic longitude
442+ Observer geodetic longitude
390443 h0 : "ndarray"
391444 observer altitude above geodetic ellipsoid (meters)
392445 ell : Ellipsoid, optional
0 commit comments