function xrt_find_dark, t0 ,t1, dir=dir,count=count,quiet=quiet ;+ ; Name: xrt_find_dark ; ; Purpose: return list of xrt darks within +/- two days of t0 ; If t1 is provided then searches for all darks between ; t0 & t1 ; ; Input Parameters: ; t0: Date to search in a format. Yes, that's right, the date is ; in a format. What format? ---I'm not exactly sure. But I would ; think that any form that the function anytim() outputs ; would be an acceptable format to put the date in. See Examples ; ; Calling Sequence: ; filelist=xrt_find_dark(t0, [t1,dir=dir, count=count, quiet=quiet] ) ; ; Keyword Parameters: ; dir: The topmost directory for the xrt archive ; Program assumes that the data is arranged by ; dir/YYYY/MM/DD/H"hhhh"/*.fits ; ; count: The number of files fount ; ; Calling Examples: ; darks=xrt_find_dark('26-oct-2006','29-oct-2006') ; darks=xrt_find_dark('26-oct-06',dir='/my/copy/xrt/data') ; darks=xrt_find_dark('27-oct-06',/quiet,count=count) ; ; If no files are found it returns a value of -1. ; ; History: ; 30-Oct-2006 P.R. Jibben bootlegged from trace_files by S.L.Freeland ; ; ; Personal Note for future changes: ; USED by TRACE if there was an enviornment variable. There will be ; one for XRT just not yet. ;topenv='TRACE_I1_DIR' ;toptrace=str2arr(get_logenv(topenv)) ;toptrace=str_replace(toptrace,'tri',lprefix) if not keyword_set(dir) then topxrt='/archive/hinode/xrt/level0/' else topxrt=dir if not file_exist(topxrt(0)) then begin box_message,'Need to define '+topxrt +' (parent of XRT data subdirectories)' return,'' endif ; XRT archive listed as YYYY/MM/DD/"H"hhhh/*.fits ; Based on t0 & t1 determine what Year(s), Month(s) and ; day(s) the program searches. ;; if times passed, form subdirectories if n_elements(t1) eq 0 then grid=timegrid(t0,days=[-2,-1,0,1,2],/string) else $ grid=timegrid(timegrid(t0,hour=0,/string),t1,days=1,/quiet) dates=strmid(anytim(grid,/ecs),0,11) dir_dd=concat_dir(topxrt,dates) dir=dir_dd[where(file_exist(dir_dd) eq 1)] hours=file_list(dir,'H*',/quiet) files=file_list(hours,'*d*.fits',/quiet) if ((n_elements(files) eq 1) and (files[0] eq '')) then begin count=0 files=fix('-1') endif else begin count=n_elements(files) endelse if not keyword_set(quiet) then begin print,'Searching Directories:' hprint,dir print,'' print,'Search Complete Found: '+strcompress(count,/remove_all)+' files' endif return,files end