PRO get_es_list es_path='/home/heron/vayur/es/results/' month=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'] year=['1999','2000'] ny=N_ELEMENTS(year) icount=0 mphase =FLTARR(ny*366) mastar =FLTARR(ny*366) mastar_=FLTARR(ny*366) mae=FLTARR(ny*366) mtimeut=FLTARR(ny*366) nights=STRARR(ny*366) OPENW, U, es_path+'es_sim.log',/GET_LUN ; ------------ two loops over year and months FOR iy=0,ny-1 DO BEGIN FOR i=0,11 DO BEGIN curr_dir=es_path+month[i]+STRMID(year[iy],2,2)+'/' FOR id=1, 31 DO BEGIN IF id LT 10 THEN day='0'+STRING(id,FORMAT='(i1)') IF id GE 10 THEN day= STRING(id,FORMAT='(i2)') ;------------- we are looking for a file named : curr_file curr_file=curr_dir+day+month[i]+year[iy]+'.dat' find_dat=FINDFILE(curr_file,COUNT=curr_count) ;------------- if the gfile exists then ... IF curr_count EQ 1 THEN BEGIN PRINT, curr_file GET_SIM_DATA, curr_file, 12, npts, phase, timeut, astar, astar_, ae temp1=0. temp2=0. temp3=0. temp4=0. FOR inx=0, npts-1 DO BEGIN temp1=temp1+abs(phase[inx]) temp2=temp2+astar_[inx] temp3=temp3+astar[inx] temp4=temp4+ae[inx] ENDFOR mphase[icount]=(temp1/npts)*get_sign(phase[0]) mastar_[icount]=temp2/npts mastar[icount]=temp3/npts mae[icount]=temp4/npts nights[icount]=curr_file mtimeut[icount]=12.0 icount=icount+1 PRINTF, U, curr_file ENDIF ENDFOR ENDFOR ENDFOR FREE_LUN, U mphase =mphase[0:icount-1] mastar =mastar[0:icount-1] mastar_=mastar_[0:icount-1] mae=mae[0:icount-1] mtimeut=mtimeut[0:icount-1] print, icount help, mae SAVE, mtimeut, mphase, mastar, mastar_, mae, FILENAME=es_path+'es_sim.sav' END