function index2lev0file, index0, uniq=uniq, dir_s=dir_s ; ; Name: index2lev0file ; ; Purpose: For a given Level_1 or Level_2index (or index vecor), ; returns the file name of the level_0 file. ; ; Input Parameters: ; times0 - scaler start time (or one time) or vector of desired times ; dir_s (optional) - directory name for search. ; ; Calling Sequence & Examples: ; file =index2fid(index) ; fid for input time ; file =index2fid(index [,/uniq],dir_s='/disk/hl3/ylegacy/weekdirs') ; fids for specified times ; ; Method: ; call anytim2fid as a first guess, then check if the file actually ; exists in the WEEIDIRS or in the dirctory specified with the keyword, ; dir_s. ; ; History: ; 26-Jul-2010 (Aki Takeda) initial version. ; 27-Jun-2011 (Aki T.) Changed location of Level_0 files. ;- ; if not keyword_set(dir_s) then dir_s='/disk/yla/www/archive/yohkoh/weekdirs/' ; if not keyword_set(dir_s) then dir_s='/disk/hl3/ylegacy/weekdirs/' ; nn=n_elements(index0) date_time=gt_day(index0,/str)+gt_time(index0,/str,/space) wk_id=anytim2weekinfo(date_time) fid=anytim2fid(date_time) chk_pf=gt_pfi_ffi(index0(0)) if (chk_pf eq 0) or (chk_pf eq 2) then pref='spr' else pref='sfr' ; fguess1=dir_s + wk_id +'/'+ pref + fid ; l0file=strarr(nn) ;--------------------- for i=0,nn-1 do begin ;--------------------- chk=file_test(fguess1(i)) if chk eq 1 then l0file(i)=fguess1(i) $ else begin fguess2=file_search(strmid(fguess1(i),0,strlen(fguess1(i))-2)+'??') ; ;********* special treatment ********* if fguess2(0) eq -1 then begin ; case fid of '980704.2359': fid2='980705.0000' '980719.2017': fid2='980719.1949' '980720.0914': fid2='980720.1009' '980720.2034': fid2='980720.1943' '980720.2348': fid2='980721.0030' '980721.0931': fid2='980721.1004' '980723.1004': fid2='980723.0954' '990911.2359': fid2='990912.0001' '990918.2355': fid2='990919.0000' '000722.2359': fid2='000723.0000' '010407.2356': fid2='010408.0001' '010914.0000': fid2='010913.2359' '011018.1000': fid2='011018.0959' else: endcase ; fguess2=dir_s + wk_id +'/'+ pref + fid2 ; endif ; chk=file_test(fguess2) if chk eq 1 then l0file(i)=fguess2 $ else begin l0file(i)='-' print,'***** '+fguess2+' no such file found in '+dir_s endelse ; endelse ;--------- endfor ;--------- ; return, l0file ; end