;;;;;;;;;; pro oc_create_subcat, coord_str, catalog, VERBOSE=verbose ;;;;;;;;;; ; This routine is passed a string, such as 'hd_262.4_262.5_-15.2_-15.1'. ; From this, it creates a subcatalog which contains the stars from this given ; catalog, in the specified RA/Dec range ; ; The path pointed to by $HDOCCUL_TMP must exist. This is where the subcatalogs are stored. ; They will be automatically re-created if they are missing, but they should be put somewhere where they ; will not be regularly deleted. ; ; HBT 28-Jan-2005 ; HBT 9-Dec-2005: Renamed from create_subcat.pro, and revised slightly to work into new improved occultation design ; framework. r2d = 360d/(2*!dpi) d2r = 1/r2d d2as = 60d*60d nstar_max = 100000 path_wcs = getenv('HDOCCUL_TMP') path_subcat = path_wcs + '/' ; + catalog + '/subcat/' ; if not(file_exists(path_subcat)) then begin ; command = 'mkdir ' + path_subcat ; print, command ; spawn, command ; if not(file_exists(path_subcat)) then begin ; print, 'Failed!' ; end ; end a = ht_str_split(coord_str, char='_') catalog = a[0] if (catalog eq 'hd') then file_catalog = 'hd/catalog.wcs.dat' ra_min = double(a[1]) ; Parse RA, dec in degrees ra_max = double(a[2]) dec_min = double(a[3]) dec_max = double(a[4]) dec = (dec_min+dec_max)/2d ra = (ra_min+ra_max)/2d dra_deg = ra_max-ra_min ddec_deg = dec_max-dec_min dra_as = dra_deg * d2as ddec_as = ddec_deg * d2as command = 'scat ' + $ ' -c ' + file_catalog + $ ; catalog ' -r ' + st(dra_as/2d) + ',' + st(ddec_as/2d) + $ ; search radius ' -d' + $ ; degrees (not hms) ; ' -t' + $ ; tab-delimited columns (also adds 11 lines of header info) ' -j' + $ ; J2000 ' -n ' + st(nstar_max) + $ ; max # of stars to return ' ' + string(ra,format='(F19.12)') + ' ' + string(dec,format='(F19.12)') + ' j2000' + $ ' > ' + path_subcat + coord_str if keyword_set(VERBOSE) then print, command spawn, command end