;+ ; NAME: ; oc_getline_bs ; ; PURPOSE: (one line) ; Return the raw catalog line from BS catalog for a given ID or IDs. ; ; DESCRIPTION: ; Return the raw catalog line from BS catalog for a given ID or IDs. ; The catalog line is a single line of text which is human-readable, ; although it must be carefully interpreted. ; ; This routine searches through the catalog using grep. For small catalogs ; like this, grep is fast enough. ; ; ; CATEGORY: ; Star catalogs ; ; CALLING SEQUENCE: ; lines = oc_getline_bs( ids [, NSTARS=nstars] [, /VERBOSE]) ; ; INPUTS: ; IDs -- A list of BS ID's. Scalar or vector. ; IDs must be in BS format and are recommended to be strings, rather ; than numerical values, due to precision and wraparound. ; ; OPTIONAL INPUT PARAMETERS: ; None ; ; KEYWORD INPUT PARAMETERS: ; /VERBOSE -- If set, print diagnostics to screen. ; ; KEYWORD OUTPUT PARAMETERS: ; NSTARS -- Returns the number of successfully-retrieved lines. ; ; OUTPUTS: ; If input is a scalar, then output is a single string. ; If input is a vector, then output is an array of strings. ; If a star is not found, returned value is ''. ; ; COMMON BLOCKS: ; None ; ; SIDE EFFECTS: ; None ; ; RESTRICTIONS: ; BS catalog must be available at $WCS_CATDIR/bs/catalog.dat . ; ; EXAMPLE: ; print, oc_getline_bs(['430', '1000']) ; ; MODIFICATION HISTORY: ; Written 28-Oct-2007 by Leslie Young, SwRI ;- function oc_getline_bs, ids_in, NSTARS=nstars, VERBOSE=verbose, cat=cat if keyword_set(cat) then begin ; Should add some checking here dbopen, 'yale_bs' listall = dbfind('hr', /silent) list = dbget(cat, ids_in, listall,/silent) dbext, list, 'HR', ids endif else begin ids = ids_in end catalog = 'bs/catalog' path_catalog = getenv('WCS_CATDIR') nstars = 0 num_ids = sizex(ids) lines = strarr(num_ids) ids_lon = arr2lon(ids) ; convert all IDS to long for i = 0L, num_ids-1 do begin id = ids_lon[i] line = nthline(path_catalog+'/'+catalog, id - 1) if (line[0] eq '') then begin if (keyword_set(VERBOSE)) then print, 'Error: star ' + st(id) + $ ' not found in HD catalog' line = '' end $ ; If line is found, incrememnt counter else nstars = nstars + 1 lines[i] = line end ; Return argument in the same form as passed in if is_array(ids) then return, lines if not(is_array(ids)) then return, lines[0] end