;+ ; NAME: ; single_eph.Pro ; ; PURPOSE: ; Returns a structure with the following information: ; {et, ra, dec, radot, decdot, ephinfo} where ephinfo ; contains the observer range and observer range rate. ; ; DESCRIPTION: ; Calculates the ra, dec, radot, decdot, observer range ; and range rate using the NAIF ICY routines. ; ; CALLING SEQUENCE: ; eph = single_eph( target, et, neph, observer=observer, ; testing=testing) ; ; INPUTS: ; et - the ET at which you want to know the ; coordinates ; KEYWORDS ; observer - the keyword argument that indicates the ; observer location, default to Earth. ; verbose - a keyword argument. If set, it ; will print out error messages. ; abcorr - aberation correction. Default 'LT' ; frame - frame of state, ra, dec. Default 'J2000' ; lonlatalt - lon, lat, altitude for geocentric ephemerides ; OUTPUTS: ; eph - a structure with the following elements ; eph.ra - the Pluto RA in radians ; eph.dec - the Pluto Dec in radians ; eph.radot - the RA rate in radians/s ; (d(ra)*cos(dec)/dt) ; eph.decdot -- the Dec rate in radians/s ; eph.ephinfo.delta - the observer range (in km) ; eph.ephinfo.deltadot - the observer range rate (in km/s) ; eph.ephinfo.target - the target ; eph.ephinfo.observer - the observer name ; ; ; REVISON HISTORY: ; 17-January-2005 CBO SwRI ; 2005 Mar 3 Moved to $idl/layoung/naif LAY ; Also put long lines onto 2 lines ; 2005 Apr 26 Return 1 for neph under usual circumstances ; Bypass bodn2c if target or observer are integers ; Change verbose = 0 for quiet, 1 for verbose, ; and removed testing ; 2005 Nov 20 LAY. Multliply dra/dt from rec5rad6 by cos(dec) ; as per documentation and design docs. ; 2005 Dec 29 LAY. Add latlonlat ; 2006 Jan 02 LAY. Change substructure name to naif. ; Keep ephinfo as an option for compatibility ; 2006 Jul 02 LAY. Add kernels as an input option for speed. ; Avoids extra calls tp naif_loadedkernels() ;- function single_eph, target, et, neph, observer=observer, $ verbose = verbose, abcorr = abcorr, frame=frame, $ lonlatalt=lonlatalt, ephinfo=ephinfo, $ kernels=kernels method = 'naif' ;check to see if optional arguments are set by the user. If not assign values. IF not keyword_set(observer) THEN observer = "Earth" IF not keyword_set(verbose) THEN verbose = 0 IF not keyword_set(abcorr) THEN abcorr = 'LT' ;only correcting for light time IF not keyword_set(frame) THEN frame = 'J2000' IF not keyword_set(kernels) THEN kernels = naif_loadedkernels() ; Load naif kernels. If they are already loaded, naifinit will not ; reload them. naifinit ; Look up the naif id's for the observer and target case datatype(observer) of 'STR': begin CSPICE_BODN2C, observer, obscode, found IF found EQ 0 THEN BEGIN neph = 0 eph = -1 IF keyword_set(verbose) THEN $ PRINT, "Observer not understood by CSPICE_BOD2N" RETURN, eph ENDIF end 'INT': obscode = observer 'LON': obscode = observer else: begin neph = 0 eph = -1 IF keyword_set(verbose) THEN $ PRINT, "Observer must be a string or an integer" RETURN, eph end endcase case datatype(target) of 'STR': begin CSPICE_BODN2C, target, targetcode, found IF found EQ 0 THEN BEGIN neph = 0 eph = -1 IF verbose NE "False" THEN $ PRINT, "Target not understood by CSPICE_BOD2N" RETURN, eph ENDIF end 'INT': targetcode = target 'LON': targetcode = target else: begin neph = 0 eph = -1 IF verbose NE "False" THEN $ PRINT, "Target must be a string or an integer" RETURN, eph end endcase ; Get the RA and Dec of the target CSPICE_SPKEZ, targetcode, et, frame, abcorr, obscode, $ stateTarget, ltime ; If lonlatalt is defined, correct for topocentric position ; (rtarg-rgeo) - (rsite-rgeo) = rtarg-rsite if keyword_set(lonlatalt) then begin stateTarget = stateTarget - oc_lla2xyz(lonlatalt,et) endif else begin lonlatalt = 0 endelse ; Convert X, Y, Z to RA, Dec and distance radTarget = rec6rad6(stateTarget) delta = radTarget[0] ra = radTarget[1] dec = radTarget[2] deltadot = radTarget[3] radot = radTarget[4] * cos(dec) decdot = radTarget[5] naif = $ {target:target, $ observer:observer, $ targetCode:targetCode, $ observerCode:obsCode, $ frame:frame, $ abcorr:abcorr, $ lonlatalt:lonlatalt, $ kernels : kernels } if keyword_set(ephinfo) then begin eph = {et:et, $ ra:ra, $ dec:dec, $ raerr:-999.d, $ decerr:-999.d, $ radot:radot, $ decdot:decdot, $ radoterr:-999.d, $ decdoterr:-999.d, $ delta:delta, $ deltadot:deltadot, $ state:stateTarget, $ ephinfo:naif} endif else begin eph = {et:et, $ ra:ra, $ dec:dec, $ raerr:-999.d, $ decerr:-999.d, $ radot:radot, $ decdot:decdot, $ radoterr:-999.d, $ decdoterr:-999.d, $ delta:delta, $ deltadot:deltadot, $ state:stateTarget, $ naif:naif} endelse neph = 1 RETURN, eph END ;+