FUNCTION sgp_body, body, file=file, number=number, index=index, count=count, total_count=total_count ;+ ; NAME: ; sgp_body ; PURPOSE: ; Get list of bodies for which SGP ephemerides are available ; CATEGORY: ; smei/gen/idl/ephem ; CALLING SEQUENCE: ; sgp_nams = sgp_body([body, files=files, numbers=numbers, count=count]) ; 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: ; names 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 SGP files are searched for in the subdirectory 'sgp' of the directory ; where this procedure is located. ; MODIFICATION HISTORY: ; JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Based on usno_body() ;- ; Check presence of SGP ephemeris files. root = filepath(root=who_am_i(/dir),'sgp') sgp_file = file_search(filepath(root=root,'*.txt'),count=total_count) index = -1 number = -1 name = '' file = '' count = 0 IF total_count EQ 0 THEN BEGIN message, /info, 'no ephemeris files found: '+hide_env(root) RETURN, name ENDIF sgp_number = lindgen(total_count) sgp_name = GetFileSpec(sgp_file,part='name') CASE 1 OF IsType(body, /string ): index = where_common(strlowcase(sgp_name), strlowcase(body)) IsType(body, /generic_int): index = where_common(sgp_number, body) ELSE : index = indgen(total_count) ENDCASE IF index[0] EQ -1 THEN BEGIN index = index[0] message, /info, 'no valid comet numbers/names specified' RETURN, name ENDIF count = n_elements(index) IF count EQ 1 then index = index[0] number = sgp_number[index] name = sgp_name [index] file = sgp_file [index] RETURN, name & END