; docformat = 'rst' ;+ ;This function returns the azimuth track of the orbitting spacecraft. ; ; :Examples: ; track = track_azimuth(gps_time, pv) ;- ;+ ; :Keywords: ; Time : in, required, type=double or array of double ; Time in GPS microseconds. May be scalar or a array. ; pv : in, optional, type=state vector ; 6xN element array. Each row pv[*,i] is the state vector for jd[i]. ; Units are km and km/s, coordinate system is equatorial mean of date. ; The coordinates used for the outputs may be either geocentric ; (coorid=1), rectangular (coorid=2, default). Angles are in degrees ; and distances in km. Each output position is a 6-vector ; with elements as follows: SPHERICAL: 0) Right Ascension ; (deg, 0 to 360), 1) Declination (deg, -90 to 90), 2) R (km), ; 3) dRA/dT (deg/sec), 4) dDec/dT (deg/sec), 5) dR/dT (km/sec). ; RECTANGULAR: 0) X (km), 1) Y (km), 2) Z (km), 3) dX/dT (km/sec), ; 4) dY/dT (km/sec) 5) dZ/dT (km/sec). ; _extra : in, optional, type=boolean ; This keyword must be set if pv is not called with this function. It is ; passed to scpv to toggle whether it returns a pv state vector in ; ECEF or ECI coordinates. ; ; :Returns: ; Returns the azimuth track of the orbitting spacecraft. ;- function track_azimuth,Time=time,pv=pv,_extra=extra if n_elements(pv) eq 0 then pv=scpv(Time,_extra=extra) p=pv[0:2] v=pv[3:5] NPole=[0d,0,1] EVector=normalize_grid(crossp_grid(NPole,P)) ZVector=normalize_grid(P) NVector=crossp_grid(ZVector,EVector) track=atan(comp(V,EVector),comp(V,NVector)) if(track lt 0) then track+=2d*!DPI return,track end