;+ ; NAME: ; mpc_body ; PURPOSE: ; Get list of bodies for which MPC ephemerides are available ; CATEGORY: ; smei/gen/idl/ephem ; CALLING SEQUENCE: FUNCTION mpc_body, body, $ file = file , $ number = number, $ index = index , $ count = count , $ total_count=total_count,$ silent = silent ; OPTIONAL INPUT PARAMETERS: ; body scalar or array; type: integer or string ; integer: list of body numbers ; string : list of body names ; only valid entries on this list are processed ; If not specified then all bodies are processed ; OUTPUTS: ; Result array[count]; type: string ; list of body names for which ephemeris files ; are available; if none exist (count=0) then names='' ; OPTIONAL OUTPUT PARAMETERS: ; count=count scalar; type: integer ; # requested bodies for which ephemeris files are present ; i.e. # elements in input 'body' with invalid entries removed ; file=file array[count]; type: string ; file names of the ephemeris files; null-string if count=0 ; number=number array[count]; type: integer ; body numbers; -1 if count=0 ; index=index array[count]; type: integer ; index numbers between 0, and total_count-1; -1 if count=0 ; total_count=total_count ; scalar; type: integer ; total # bodies for which ephemeris files are present ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; SetFileSpec, GetFileSpec, where_common, IsType, who_am_i, hide_env ; PROCEDURE: ; > Currently only 9P/Tempel (comet Tempel 1 around 'deep impact' time) is available ; > The MPC files are searched for in the subdirectory 'mpc' of the directory ; where this procedure is located. ; MODIFICATION HISTORY: ; JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Based on usno_body() ;- InitVar, silent, 0 ; Check presence of MPC ephemeris files. root = filepath(root=who_am_i(/dir),'mpc') mpc_file = file_search(filepath(root=root,'*.html'),count=total_count) index = -1 number = -1 name = '' file = '' count = 0 IF total_count EQ 0 THEN BEGIN IF silent LE 0 THEN message, /info, 'no ephemeris files found in '+hide_env(root) RETURN, name ENDIF mpc_number = lindgen(total_count) mpc_name = GetFileSpec(mpc_file,part='name') CASE 1 OF IsType(body, /string ): index = where_common(strlowcase(mpc_name), strlowcase(body)) IsType(body, /generic_int): index = where_common(mpc_number, body) ELSE : index = indgen(total_count) ENDCASE IF index[0] EQ -1 THEN BEGIN help,/traceback index = index[0] IF silent LE 0 THEN message, /info, "'"+strjoin(strcompress(body,/rem),',')+"' does not contain valid comet numbers/names" RETURN, name ENDIF count = n_elements(index) IF count EQ 1 then index = index[0] number = mpc_number[index] name = mpc_name [index] file = mpc_file [index] RETURN, name & END