;+ ; NAME: ; mpc_eph_range ; PURPOSE: ; Get time range for MPC object ; CATEGORY: ; smei/gen/idl/ephem ; CALLING SEQUENCE: FUNCTION mpc_eph_range, body, $ source = source , $ silent = silent ; INPUTS: ; body scalar; type: string or integer; default: 'tempel_1' ; body name or body number ; OPTIONAL INPUT PARAMETERS: ; source=source ; scalar; type: string; default: who_am_i(/dir)/mpc ; By default MPC ephemeris files are looked for in subdirectory ; mpc of the directory where this source code is located ; Use this keyword to point to another directory. ; OUTPUTS: ; Result array[2]; type: time structure ; Earliest and latest time for which ; ephemerides are available ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; InitVar, IsTime, TimeSet, TimeUnit, who_am_i ; SEE ALSO: ; mpc_eph, mpc_body ; PROCEDURE: ; Ephemeris files are retrieved from ; http://cfa-www.harvard.edu/iau/MPEph/MPEph.html ; MODIFICATION HISTORY: ; JUL-2014, Paul Hick (UCSD/CASS) ;- InitVar, silent , 0 InitVar, body , '9p_tempel' InitVar, source , filepath(root=who_am_i(/dir),'mpc') IsT = IsTime(UT) NT = n_elements(UT) IF flt_read(filepath(root=source,body+'.html'),eph,/double,silent=silent,atleast=10) THEN BEGIN eph = eph[*,[0,n_elements(eph)-1]] c_year = 0 c_mon = 1 c_day = 2 c_hms = 3 uday = TimeUnit(/day) hms = round(reform(eph[c_hms,*])) tt = TimeSet( $ yr = round(reform(eph[c_year,*])) , $ mon = round(reform(eph[c_mon ,*])) , $ day = round(reform(eph[c_day ,*])) , $ hr = hms/10000 , $ minu= (hms mod 10000)/100 , $ sec = hms mod 100 ) ENDIF ELSE BEGIN message, "invalid body '"+body+"'" ENDELSE RETURN, tt & END