pro AMIE_FINDGEOMETRY, sclk, distance, longitude, latitude, position = position ;+ ; NAME: ; AMIE_FINDGEOMETRY ; ; PURPOSE: ; Calculates the latitude and longitude with respect to the moon for a certain time, ; the time for which the values will be calculated is stored in the string TIME ; ; CATEGORY: ; AMIE Calibration ; ; CALLING SEQUENCE: ; AMIE_FINDGEOMETRY, time, distance, longitude, latitude, position = position ; ; INPUTS: ; time: Time for which the information is needed. Pass as string of the format ; 'YYYY-MM-DDThh:mm:ss'. ; ; OPTIONAL INPUT PARAMETERS: ; None. ; ; OUTPUTS: ; the following values are returned, all of them are calculated with respect to the ; rotating moon frame: ; ; altitude: altitude of the s/c above the Moon in km ; longitude: longitude of the sub-spacecraft point in degrees ; latitude: latitude of the sub-spacecraft point in degrees ; ; OPTIONAL OUTPUTS: ; position: a three-dimensional vector containing xvalue, yvalue, zvalue. These are the ; rectangular coordinates in km ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; Hopefully none. ; ; EXAMPLE: ; IDL> AMIE_FINDGEOMETRY, '2005-01-02T03:00:43', distance, longitude, latitude ; ; will give the following results: ; ; IDL> print, distance ; 1660.4602 ; IDL> print, longitude ; -125.74745 ; IDL> print, latitude ; -28.409505 ; ; RESTRICTIONS: ; A SPICE 'furnsh' file of name 'setupf.txt' needs to exist, currently this has to be ; at X:\Tatjana\setupf.txt. Once Tatjana can write everywhere in X:, this will be ; changed to X:\SPICE\setupf.txt. ; ; MODIFICATION HISTORY: ; ; 2005/10/13 Tatjana Tchumatchenko ; 2005/10/13 dvk - converted to procedure ; 2007 Apr 18, dvk - added different filters ;- ;perform some checks if sclk EQ '' then message, 'Input string "time" must not be empty.' ;time = '2006-04-22T05:08:54.314' ;clock for a nice image (no. 7) in orbit 2730: 8/0076617728.22596 ;define some variables filter = strarr (9) filter = ['SMART1_AMIE_CCD', 'SMART1_AMIE_VIS_Y', 'SMART1_AMIE_FEL_Y', $ 'SMART1_AMIE_NONE', 'SMART1_AMIE_FEH_Y','SMART1_AMIE_LASER', $ 'SMART1_AMIE_FEL_X', 'SMART1_AMIE_VIS_X', 'SMART1_AMIE_FEH_X'] longitude = fltarr (9) latitude = fltarr (9) fkname = 'SMART1_V_ESAC_DK_BG_JV.TF' ckname = 'SMART1_070227_STEP.TSC' ;ckname = 'SMART1_051207_FAKE.TSC' ;start up SPICE pathToSPICE = 'C:\Documents and Settings\detlef koschny\My Documents\Missions\Smart-1\SPICE' cspice_furnsh, pathToSPICE + '\ik\SMART1_AMIE_V01.TI' ;load SPICE instrument kernel cspice_furnsh, pathToSPICE + '\fk\' + fkname ;load frame kernel cspice_furnsh, pathToSPICE + '\ck\ATNS_P050930150947_00189.BC' ;load attitude kernel no. 1 cspice_furnsh, pathToSPICE + '\ck\ATNS_P060301004212_00233.BC' ;load attitude kernel no. 2 cspice_furnsh, pathToSPICE + '\lsk\NAIF0008.TLS' ;load leap seconds kernel cspice_furnsh, pathToSPICE + '\sclk\' + ckname ;load clock kernel cspice_furnsh, pathToSPICE + '\spk\ORMS_______________00233.BSP';load trajectory around Moon - 1 cspice_furnsh, pathToSPICE + '\spk\ORMS__041111020517_00206.BSP';load trajectory around Moon - 2 cspice_furnsh, pathToSPICE + '\spk\ORES_______________00125.BSP';load trajectory around Earth cspice_furnsh, pathToSPICE + '\spk\DE405S.BSP' ;load JPL solar system file cspice_furnsh, pathToSPICE + '\pck\PCK00008.TPC' cspice_furnsh, pathToSPICE + '\pck\EARTH_000101_070708_070416.BPC' cspice_scs2e, -238, sclk, ets cspice_et2utc, ets, "ISOC", 3, utc ;cspice_utc2et, TIME, ets ; convert time from UTC to ET ;Note that in this version we use the s/c clock rather than UTC ; calculate the position in rectangular coordinates of the spacecraft cspice_spkpos, 'SMART1', ets, 'IAU_MOON', 'NONE', 'MOON', position, ctime ; get the boresight of the instrument for i = 0, 8 do begin inputframe = filter (i) cspice_bodn2c, inputframe, instid, found cspice_getfov, instid, 4, shape, frame, bsight, bounds ;compute interception point cspice_bodn2c, 'MOON', moonid, found cspice_bodvar, moonid, 'RADII', radii cspice_pxform, frame, 'IAU_MOON', ets, matrix cspice_mxv, matrix, bsight, outputvector cspice_surfpt, position, outputvector, radii (0), radii (1), radii (2), point, found ;; calculate the nadirpoint (subpoint) and the altitude (alt) of the spacecraft ;cspice_subpt, "NEAR POINT", "MOON", ets, "NONE", "SMART-1", subpoint, altitude ; ; convert to longitude and latitude cspice_reclat, point, radius, longi, lati ;convert them from rad to degrees cspice_convrt, longi, 'RADIANS', 'DEGREES', longtemp longitude (i) = longtemp cspice_convrt, lati, 'RADIANS', 'DEGREES', latitemp latitude (i) = latitemp ;determine the slant distance cspice_vsub, position, point, dist distance = cspice_vnorm (dist) endfor device, decomposed = 0 plot,BACKGROUND = 255, COLOR = 0, title = fkname + ' - ' + ckname, $ longitude, latitude, psym = 1, yrange = [45, 51], xrange = [40, 47] ; for i=0, 8 do xyouts, longitude (i), latitude (i), strtrim (string (i),1),/data, color = 0 xyouts, 10, 10, 'Time in UTC: '+ utc, /dev, color = 0 stop end ;AMIE_FINDGEOMETRY