; docformat = 'rst' ;+ ; This function gets the spacecraft position at a certain time. ; ; :Examples: ; position = scpos(gps_time, ecef=ecef, dr=dr) ;- ;+ ; :Params: ; Time : in, required, type=double ; Time in question in GPS microseconds. Must be scalar. ; ; :Keywords: ; ecef : in, optional, type=boolean ; Set to get the result in ECEF coordinates, defaults to ECI. ; dr : out, optional, type=double ; 1 sigma of uncertainty in each coordinate, in km. ; ; :Returns: ; Returns the position vector of the spcecraft, in km. ;- function scpos,Time,ecef=ecef,dr=dr, native_toggle=toggle if ~real_numeric_type(Time) then begin doc_library, 'scpos' return, -1 endif JD=usec2jd(Time) if keyword_set(toggle) then $ spacecraft_pv,!SC_NUMBER,JD,pv,pv_uncertainty=dpv,tle_path=!tle_path,status=status $ ; Using Chris Jeppesen's IDL replacement of Barry Knapp's astron library else $ spacecraft_pv_msgp4,!SC_NUMBER, jd, pv,pv_uncertainty=dpv,status=status, tle_path=!tle_path if status gt 0 then message,"spacecraft_pv didn't work... returned with status: " + string(status, format='(i0)') r=pv[0:2] dr=dpv[0:2] if keyword_set(ecef) then begin dr=transformgrid(eci_to_ecef(time),dr) return,transformgrid(eci_to_ecef(time),r) end else begin return,r; end end