OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
orb2lla.py
Go to the documentation of this file.
1 def orb2lla(orb):
2  # Compute geodetic longitude, latitude and altitude
3  # from Cartesian orbit vector in ECR coordinates
4  # Uses geodetic approximation from Patt and Gregg, IJRS, 1993.
5  # input: orb: position vector[0,1,2]
6  # reference: orb2lla.pro by Fred Patt
7  # ported to Python by Liang Hong, 2/13/2020
8 
9  import numpy as np
10 
11  RE = 6378.137 # Earth equatorial radius (km)
12  REM = 6371.0 # Earth mean radius (km)
13  F = 1.0/298.257 # Earth flattening factor
14  OMF2 = (1.0-F)**2
15 
16  # Compute longitude
17  lon = np.rad2deg(np.arctan2(orb[:,1],orb[:,0]))
18 
19  # Compute geodetic latitude
20  rad = np.sqrt(np.square(orb[:,0])+np.square(orb[:,1])+np.square(orb[:,2]))
21  omf2p = (OMF2*REM + rad - REM)/rad
22  pxy = np.square(orb[:,0])+np.square(orb[:,1])
23  temp = np.sqrt(np.square(orb[:,2]) + omf2p*omf2p*pxy)
24  lat = np.rad2deg(np.arcsin(np.array(orb[:,2])/temp))
25 
26  # Compute altitude
27  clatg = np.cos(np.arctan(OMF2*np.tan(np.deg2rad(lat))))
28  rl = RE*(1.0-F)/np.sqrt(1.0-(2.0-F)*F*np.square(clatg))
29  alt = rad - rl
30 
31  return lon,lat,alt
32 
33 
def orb2lla(orb)
Definition: orb2lla.py:1