|
|
 
;--------------------------------------------------------------------------
;+
; NAME : CATRD_DAILY
;
; PURPOSE : Read the daily catalogs and return entries as requested output
;
; CATEGORY :
;
; EXPLANATION :
;
; SYNTAX :
;
; EXAMPLES : none
;
; CALLED BY :
;
; CALLS TO : none
;
; ARGUMENTS :
; DATE If present, a string date in the format "yyyy/mm/dd"
; of the daily catalog to be searched.
; Default is the date of the most recent catalog.
;
; KEYWORDS :
; YESTER If present, indicates the number of 'days/catalogs' backward
; in time you want as the catalog input. Note that this is
; really the number of backward catalogs, so days may not
; line up as expected, but they should.
; New feature: print,catrd_daily("y=3") for three days ago.
; NO_NEXT If present and set then return a null string if the specified
; date does not have a catalog.
; SHORT_TEXT If present and set and TEXT is the output mode then the
; displayed text will fit in 80 characters w/ less info.
; RECORDS If present, then return catalog file record numbers matching
; the entries in the returned variable. This is the VMS
; record number.
; LONG If present and set, then all catalog entries are considered,
; including duplicates and entries are left in unsorted,
; reform order.
; RAW If present and set , return the catalog entries as the raw
; data structure instead of the default of a strarr of text
; entries.
; NOTE: the default is to return a string array of entries.
; FILENAME If present, then return the fits file names matching
; the entries in the returned variable.
; TAI If present, then return the TAI time matching
; the entries in the returned variable.
;
; OUTPUTS :
; Return a string arrar of catalog entries, unless the /RAW keyword
; is set then return raw structure of entries.
; If the /LONG keyword is set then return all catalog entries and
; do not sort.
; If any value was
;
; COMMON : none
;
; RESTRICTIONS: none
;
; SIDE EFFECTS: none
;
; PROJECT : SOHO - EIT
;
; HISTORY : V1, Elaine Einfalt (HSTX)
; 1996 March 31, added /NO_NEXT keyword
; 1996 May 13, allow YESTER to use numerical values
;
; CONTACT : eit@xanado.nascom.nasa.gov
;-
function catrd_daily, date, long=long, raw=raw, yester=yester, $
no_next=no_next, short=short, $
records=records, filename=filename, tai=tai
; print, '%CATRD_DAILY-D-DATE, date = ' + date
;!quiet = 1
if n_elements(yester) eq 0 then yester = 0
if not(keyword_set(raw)) then text = 1 else text = 0
if keyword_set(short) then short = 1 else short = 0
; The keyword /LONG: 0 mean sort cat records an remove duplicates and
; display short format else raw order with all duplicates and print the
; values of every catalog element.
if keyword_set(long) then long = 1 else long = 0
; Find the desired catalog
dir_list = CAT_DIRECTORY( date, cur_dir_cnt = cur_dir_cnt, $
use_last_rec = use_last_rec, $
yester = yester, $
no_next = no_next, $
dir_cnt = dir_cnt)
if dir_cnt eq 0 then begin
!quiet = 0
return, 'No catalogs found in CAT_DIR:' ; no catalogs
endif else if dir_list(0) eq '' then begin
!quiet = 0
return, ''
endif
; Return the contents of the selected catalog as a "raw data" structure.
entry = CAT_OPEN( file = dir_list(cur_dir_cnt), $ ; input
long = long, $ ; input
lun = cat_unit, $ ; output
u_rec = u_rec, $ ; output
n_rec = n_rec, $ ; output
records = records) ; output
; RECORDS is a array containing the record numbers of the catalog file
; in the order indicated by the /LONG keyword
; U_REC is the number of records to be used/considered
; N_REC number of total record in the cat (excluding header)
if text then cat_user = cat_to_text(entry(records-1),short=short) $ ; Remake into text
else cat_user = entry(records-1)
!quiet = 0
; Return specifically requested keywords
if n_elements(filename) gt 0 $
then filename = (strupcase(entry.file_name))(records-1)
if n_elements(tai) gt 0 then $
tai = (utc2tai({mjd:entry.obs_time.mjd+49718, $
time:entry.obs_time.sec*1000L}))(records-1)
return, cat_user
end
Last revised: - Wed May 9 21:45:07 2007- F. Auchère