FUNCTION usno_body, asteroid, $ file = file , $ silent = silent, $ number = number, $ index = index , $ count = count , $ total_count=total_count @compile_opt.pro ; On error, return to caller InitVar, silent, 0 ; Asteroid names and number on the USNO AE98 CD ast_number = [1,2,3,4,6,7,8,9,10,15,16,52,65,511,704] ast_name = ['Ceres','Pallas','Juno','Vesta','Hebe','Iris','Flora', $ 'Metis','Hygiea','Eunomia','Psyche','Europa','Cybele','Davida','Interamnia'] ; Check presence of binary asteroid ephemeris files. root = filepath(root=who_am_i(/dir),'usno') ast_file = file_search(filepath(root=root,'*.chby')) SetFileSpec, ast_file n = where_common(strlowcase(ast_name),strlowcase(GetFileSpec(part='name')),inref=m, count=total_count) CASE total_count EQ 0 OF 0: BEGIN ast_number = ast_number[n] ; Retain only asteroids for which files are available ast_name = ast_name [n] ast_file = ast_file [m] CASE 1 OF IsType(asteroid, /string ): index = where_common(strlowcase(ast_name), strlowcase(asteroid)) IsType(asteroid, /generic_int): index = where_common(ast_number, asteroid) ELSE : index = indgen(total_count) ENDCASE count = n_elements(index) IF count EQ 1 THEN index = index[0] CASE index[0] EQ -1 OF 0: BEGIN number = ast_number[index] name = ast_name [index] file = ast_file [index] END 1: BEGIN IF silent LE 0 THEN message, /info, 'no valid asteroid numbers/names specified' number = -1 name = '' file = '' count = 0 END ENDCASE END 1: BEGIN IF silent LE 1 THEN message, /info, 'no ephemeris files found: '+root index = -1 number = -1 name = '' file = '' count = 0 END ENDCASE RETURN, name & END