pro norh_pr_evx,arg0,arg1 $ ,nodisp=nodisp,list=list $ ,freq=freq,criterion=criterion,cupper=cupper $ ,goes=goes,hxt=hxt,timegoes=timegoes,timehxt=timehxt ;+ ; NAME: ; NORH_PR_EVX ; ; PURPOSE: ; This procedure gives a list of events observed ; by NORH. ; ; CALLING SEQUENCE: ; norh_pr_evx,st_time,ed_time ; norh_pr_evx,time ; ; INPUTS: ; st_time: Start time of the observing sequence. ; An n-element vector of time. ; Any formats supported by 'anytim' function ; is accepted. ; (1) structure wit a .time and .day field, or ; (2) 2xN where the first dimension holds (MSOD, DS79), or ; (3) a double or float array of seconds from 1-jan-79, or ; (4) string, e.g. ; '1992-11-05 12:33:00' (NORH) ; '1992-11-05T12:33:00Z' (ISO 8601) ; '12:33:00 5-nov-92' (Yohkoh) ; '92/11/05 12:33:00' (HXRBS) ; etc. ; ed_time: End time of the sequence. ; An n-element vector of time. ; OPTIONAL OUTPUT: ; list: the list of events. string array. ; ; OPTIONAL INPUT KEYWORDS: ; freq: observing frequency 17 or 34 ; criterion: If defined, only the events which have the correlation value ; (in unit of DN) over this criterion are listed. ; goes: gives a GOES event list. ; timegoes: gives a GOES event time-list. ; hxt: gives a Yohkoh/HXT event list. ; timehxt: gives a HXT event time-list. ; nodisp: not display the result ; ; HISTORY: ; Writtern 1998-05-29 JS and TY ; Modified 1998-09-03 TY ; Modified 1998-09-16 TY ; Modified 1998-09-17 TY ; Modified 1998-11-18 TY support hhmmss ; Modified 1999-01-03 TY remove 'tohban' ; Modified 1999-01-13 TY max. cor becomes unity ; Modified 1999-10-26 TY fixed bug ; ;- if (n_elements(freq) eq 0) then freq=17 case n_params() of 2 : begin ; "st_time,ed_time" flag='2' st_time=arg0 ed_time=arg1 end 1 : begin ; "date" flag='1' st_time=arg0 ed_time=anytim(st_time,/ints) ed_time.day=ed_time.day+1 end else : begin message,'Number of arguments invalid' end endcase if (freq eq 34) then freqst='evz' else freqst='eva' st_daytim=anytim(st_time,/ints) ed_daytim=anytim(ed_time,/ints) ;ndayx=ed_daytim.day-st_daytim.day+1 ndayx=ed_daytim.day-st_daytim.day+2 ; 1999/10/26 ex=anytim(transpose([[lonarr(ndayx)],[st_daytim.day+lindgen(ndayx)]]),/ex) yyyy=reform(ex(6,*)) mm=reform(ex(5,*)) dd=reform(ex(4,*)) yy=yyyy-yyyy/100*100 yymmdd=$ string(transpose([[yy],[mm],[dd]]),format="(i2.2,i2.2,i2.2)") yymmdd=$ string(transpose([[yy],[mm]]),format="(i2.2,i2.2)") year='19'+string(yy,format="(i2.2)") if (n_elements(yymmdd) ge 2) then yymmdd=yymmdd(uniq(yymmdd)) files=freqst+yymmdd ;if (freq eq 17) then dir0=getenv('DIR_NORH_EVA') else dir0=getenv('DIR_NORH_EVZ') dir0=getenv('DIR_NORH_EVX') ;dir=[dir0+'/'+year+'/'+string(mm,format="(i2.2)")] dir=dir0 if (n_elements(dir) ge 2) then dir= dir(uniq(dir)) infil=file_list(dir,files) if (n_elements(infil) eq 1) then begin if (infil(0) eq '') then begin print,'No files found' return endif endif mfilx=n_elements(infil) mfil=0 text0=rd_tfile(infil(mfil),11,nocomment='!') dummy=0 if (text0(0) ne '') then text=text0 else begin text=strarr(11,2) dummy=2 endelse if ((size(text))(0) eq 1) then begin text=strarr(11,2) text(*,1)=text0 dummy=1 endif if (mfilx ge 2) then begin for mfil=1,mfilx-1 do begin text0=rd_tfile(infil(mfil),11,nocomment='!') if (text0(0) ne '') then begin if ((size(text0))(0) eq 1) then text=[[text],[text0]] else $ text=concat2d(text,text0) endif endfor endif if (dummy ne 0) then text=text(*,dummy:*) date=reform(text(1,*)) stev=repchar(reform(text(2,*)),'#') edev=repchar(reform(text(3,*)),'#') pkev=reform(text(4,*)) durst=reform(text(5,*)) peakst=reform(text(6,*)) ;filestr='' ;for mfil=0,n_elements(infil)-1 do filestr=filestr+' '+infil(mfil) ; ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $2}''',date ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $3}'' ' $ ; +'| sed ''s/#//''',stev ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $4}'' ' $ ; +'| sed ''s/#//''',edev ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $5}'' ' $ ; +'| sed ''s/#//''',pkev ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $6}''',durst ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $7}''',peakst ;dur=fix(durst) & peak=fix(peakst) dur=fix(durst) & peak=float(peakst)/32768.0 peakst=strtrim(string(fix(peak*1.e4)),2) ;print,peakst stev_daytim=anytim(date+' '+stev,/ints) & stev_utime=anytim(stev_daytim,/utime) pkev_daytim=anytim(date+' '+pkev,/ints) & pkev_utime=anytim(pkev_daytim,/utime) whr=where((pkev_utime lt stev_utime),count) if (count ge 1) then $ pkev_daytim(whr).day=pkev_daytim(whr).day+1 & pkev_utime=anytim(pkev_daytim,/utime) edev_daytim=anytim(date+' '+edev,/ints) & edev_utime=anytim(edev_daytim,/utime) whr=where((edev_utime lt stev_utime),count) if (count ge 1) then $ edev_daytim(whr).day=edev_daytim(whr).day+1 & edev_utime=anytim(edev_daytim,/utime) pkev_utime=anytim(pkev_daytim) st_utime=anytim(st_daytim) ed_utime=anytim(ed_daytim) whr=where((pkev_utime ge st_utime) $ and (pkev_utime lt ed_utime),mevx) ;whr=where((pkev_daytim.day ge st_daytim.day) $ ; and (pkev_daytim.day lt ed_daytim.day),mevx) if keyword_set(criterion) then begin whr=where((pkev_utime ge st_utime) $ and (pkev_utime lt ed_utime) $ and (peak ge criterion),mevx) ; whr=where((pkev_daytim.day ge st_daytim.day) $ ; and (pkev_daytim.day lt ed_daytim.day) $ ; and (peak ge criterion),mevx) endif if (mevx eq 0) then begin print,'No events in this duration' return endif if keyword_set(cupper) then begin whr1=where((peak(whr) le cupper),mevx) if (mevx eq 0) then begin print,'No events in this duration' return endif whr=whr(whr1) endif date=date(whr) & stev=stev(whr) & edev=edev(whr) & pkev=pkev(whr) durst=durst(whr) & peakst=peakst(whr) stev_daytim=stev_daytim(whr) & stev_utime=stev_utime(whr) pkev_daytim=pkev_daytim(whr) & pkev_utime=pkev_utime(whr) edev_daytim=edev_daytim(whr) & edev_utime=edev_utime(whr) stev_timst=anytim(stev_daytim,/ccsds) pkev_timst=anytim(pkev_daytim,/ccsds) edev_timst=anytim(edev_daytim,/ccsds) stev_timstf=stev_timst & strput,stev_timstf,' ',10 pkev_timstf=strmid(pkev_timst,11,8) edev_timstf=strmid(edev_timst,11,8) list=transpose([[stev_timst],[pkev_timst],[edev_timst],[durst],[peakst]]) listf=transpose([[stev_timstf],[pkev_timstf],[edev_timstf],[durst],[peakst]]) format="a19,' ',a9,' ',a9,' ',a6,' ',a10" title1=['Start','Peak','End ','Dur ','Max Cor.'] title2=['(UT) ','(UT)','(UT)','(sec)','(x 10^-4)'] if keyword_set(goes) then begin st_gev=strarr(mevx) & pk_gev=strarr(mevx) & ed_gev=strarr(mevx) cl_gev=strarr(mevx) & noaa_gev=strarr(mevx) & pos_gev=strarr(mevx) ; rdo_gev=strarr(mevx) rd_gev,anytim(st_time,/yohkoh),anytim(ed_time,/yohkoh),gev_data,status=status if (status gt 0) then begin print, 'No GOES events available in this duration' cl_gev=strarr(mevx) noaa_gev=strarr(mevx) pos_gev=strarr(mevx) st_gev=strarr(mevx) pk_gev=strarr(mevx) ed_gev=strarr(mevx) goto,jumpgoes endif stgev_utime=anytim(gev_data,/utime) edgev_utime=anytim(anytim2ints(gev_data, off=gev_data.duration),/utime) ew_arr = ['E', 'W'] & ns_arr = ['S', 'N'] for mev=0,mevx-1 do begin whr=where((pkev_utime(mev) ge stgev_utime) $ and (pkev_utime(mev) le edgev_utime),count) if (count ne 0) then begin cl_arr=string(gev_data(whr).st$class) cl_gev(mev)=max(cl_arr,mtmp) gev=gev_data(whr(mtmp)) if (gev.noaa eq 0) then noaa_gev(mev) = ' ' $ else noaa_gev(mev) = string(gev.noaa, format='(i4)') pos_gev(mev) = ' ' if (gev.location(0) ne -999) then $ pos_gev(mev) = string( ns_arr( gev.location(1) ge 0 ), abs(gev.location(1)), $ ew_arr( gev.location(0) ge 0 ), abs(gev.location(0)), format='(2(a,i2.2))') if keyword_set(timegoes) then begin st_gev(mev)=strmid(gt_time( anytim2ints(gev),/str),0,5) pk_gev(mev)=strmid(gt_time( anytim2ints(gev, off=gev.peak) , /str), 0, 5) ed_gev(mev)=strmid(gt_time( anytim2ints(gev, off=gev.duration), /str), 0, 5) endif ; for j=0,2 do if (gev.radio(j) eq 0) then rdo_gev(mev)=rdo_gev(mev) + ' ' $ ; else rdo_gev(mev) = rdo_gev(mev) + string(gev.radio(j), format='(i6)') endif endfor jumpgoes: list=transpose(concat2d( $ transpose(list),[[cl_gev],[noaa_gev],[pos_gev]])) listf=transpose(concat2d( $ transpose(listf),[[cl_gev],[noaa_gev],[pos_gev]])) format=format+",' / ',a4,' ',a4,' ',a6" title1=[title1,['GOES','NOAA','Loca-']] title2=[title2,[' ',' ','tion']] if keyword_set(timegoes) then begin list=transpose(concat2d( $ transpose(list),[[st_gev],[pk_gev],[ed_gev]])) listf=transpose(concat2d( $ transpose(listf),[[st_gev],[pk_gev],[ed_gev]])) format=format+",' ',a6,' ',a6,' ',a6" title1=[title1,['Start','Peak','End']] title2=[title2,['(UT)','(UT)','(UT)']] endif endif if keyword_set(hxt) then begin st_hev=strarr(mevx) & ed_hev=strarr(mevx) suml_hev=strarr(mevx) & summ1_hev=strarr(mevx) summ2_hev=strarr(mevx) & sumh_hev=strarr(mevx) st_daytim=anytim(st_time,/ints) ed_daytim=anytim(ed_time,/ints) ndayx=ed_daytim.day-st_daytim.day+1 ccsds=anytim(transpose([[lonarr(ndayx)],[st_daytim.day+lindgen(ndayx)]]),/ccsds) year=strmid(ccsds,0,4) if (n_elements(year) ge 2) then year=year(uniq(year)) files=year dir=getenv('DIR_YOH_HEV') if (dir eq '') then message,'Environment variable $DIR_YOH_HEV not set' infil=file_list(dir,files) if (n_elements(infil) eq 1) then begin if (infil(0) eq '') then begin print,'No files found' goto,jumphxt endif endif filestr='' for mfil=0,n_elements(infil)-1 do filestr=filestr+' '+infil(mfil) spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | sed ''y/->/00/''',fcont mfx=n_elements(fcont) datehev=strarr(mfx) sthev=strarr(mfx) & pkhev=strarr(mfx) & edhev=strarr(mfx) sumlst=strarr(mfx) & summ1st=strarr(mfx) summ2st=strarr(mfx) & sumhst=strarr(mfx) for mf=0,mfx-1 do begin fline=fcont(mf) datehev(mf)=strmid(fline,6,8) sthev(mf) =strmid(fline,15,6) pkhev(mf) =strmid(fline,23,6) edhev(mf) =strmid(fline,31,6) sumlst(mf) =strmid(fline,39,4) summ1st(mf)=strmid(fline,44,4) summ2st(mf)=strmid(fline,49,4) sumhst(mf) =strmid(fline,54,4) endfor whr=where(datehev eq ' ',cnt) & if cnt ne 0 then datehev(whr)='00/00/00' whr=where(sthev eq ' ',cnt) & if cnt ne 0 then sthev(whr)='000000' whr=where(pkhev eq '0 ',cnt) & if cnt ne 0 then pkhev(whr)='000000' whr=where(pkhev eq ' ',cnt) & if cnt ne 0 then pkhev(whr)='000000' whr=where(edhev eq ' ',cnt) & if cnt ne 0 then edhev(whr)='000000' whr=where(sumlst eq ' ',cnt) & if cnt ne 0 then sumlst(whr)=' 0' whr=where(summ1st eq ' ',cnt) & if cnt ne 0 then summ1st(whr)=' 0' whr=where(summ2st eq ' ',cnt) & if cnt ne 0 then summ2st(whr)=' 0' whr=where(sumhst eq ' ',cnt) & if cnt ne 0 then sumhst(whr)=' 0' ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $2}''',datehev ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $3}''',sthev ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $4}''',pkhev ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | awk ''{print $5}''',edhev ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | sed ''y/->/00/'' | awk ''{print $6}'' ',sumlst ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | sed ''y/->/00/'' | awk ''{print $7}''',summ1st ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | sed ''y/->/00/'' | awk ''{print $8}''',summ2st ;spawn,'cat '+filestr+' | grep ''^ *[0-9]'' | sed ''y/->/0 /'' | awk ''{print $9}'' ',sumhst whr=where((datehev ne ''),count) if (count ge 1) then begin datehev=datehev(whr) sthev=sthev(whr) pkhev=pkhev(whr) edhev=edhev(whr) sumlst=sumlst(whr) summ1st=summ1st(whr) summ2st=summ2st(whr) sumhst=sumhst(whr) endif whr=where((strpos(sthev,'-') eq -1) $ and (strpos(pkhev,'-') eq -1) and (strpos(edhev,'-') eq -1),count) if (count ge 1) then begin datehev=datehev(whr) sthev=sthev(whr) pkhev=pkhev(whr) edhev=edhev(whr) sumlst=sumlst(whr) summ1st=summ1st(whr) summ2st=summ2st(whr) sumhst=sumhst(whr) endif suml=long(sumlst) summ1=long(summ1st) summ2=long(summ2st) sumh=long(sumhst) ;suml=long(sumlst) & summ1=long(summ1st) & summ2=long(summ2st) & sumh=long(sumhst) sthev=strmid(sthev,0,2)+':'+strmid(sthev,2,2)+':'+strmid(sthev,4,2) pkhev=strmid(pkhev,0,2)+':'+strmid(pkhev,2,2)+':'+strmid(pkhev,4,2) edhev=strmid(edhev,0,2)+':'+strmid(edhev,2,2)+':'+strmid(edhev,4,2) sthev_daytim=anytim(datehev+' '+sthev,/ints) & sthev_utime=anytim(sthev_daytim,/utime) pkhev_daytim=anytim(datehev+' '+pkhev,/ints) & pkhev_utime=anytim(pkhev_daytim,/utime) whr=where((pkhev_utime lt sthev_utime),count) if (count ge 1) then $ pkhev_daytim(whr).day=pkhev_daytim(whr).day+1 & pkhev_utime=anytim(pkhev_daytim,/utime) edhev_daytim=anytim(datehev+' '+edhev,/ints) & edhev_utime=anytim(edhev_daytim,/utime) whr=where((edhev_utime lt sthev_utime),count) if (count ge 1) then $ edhev_daytim(whr).day=edhev_daytim(whr).day+1 & edhev_utime=anytim(edhev_daytim,/utime) for mev=0,mevx-1 do begin stst=sthev_utime-stev_utime(mev) edst=edhev_utime-stev_utime(mev) sted=sthev_utime-edev_utime(mev) eded=edhev_utime-edev_utime(mev) whr=where((((stst ge 0) or (eded ge 0) or (edst ge 0) or (sted ge 0)) $ and ((stst le 0) or (eded le 0) or (edst le 0) or (sted le 0))) $ ,count) if (count ne 0) then begin suml_arr=suml(whr) suml_hev(mev)=max(suml_arr,mtmp0) mtmp=whr(mtmp0) suml_hev(mev)=strtrim(suml(mtmp),2) summ1_hev(mev)=strtrim(summ1(mtmp),2) summ2_hev(mev)=strtrim(summ2(mtmp),2) sumh_hev(mev)=strtrim(sumh(mtmp),2) if keyword_set(timehxt) then begin st_hev(mev)=sthev(mtmp) ed_hev(mev)=edhev(mtmp) endif endif endfor jumphxt: list=transpose(concat2d( $ transpose(list),[[suml_hev],[summ1_hev],[summ2_hev],[sumh_hev]])) listf=transpose(concat2d( $ transpose(listf),[[suml_hev],[summ1_hev],[summ2_hev],[sumh_hev]])) format=format+",' / ',a5,' ',a5,' ',a5,' ',a5" title1=[title1,['HXT ',' ',' ',' ']] title2=[title2,['Low','Med1','Med2','High']] if keyword_set(timehxt) then begin list=transpose(concat2d( $ transpose(list),[[st_hev],[ed_hev]])) listf=transpose(concat2d( $ transpose(listf),[[st_hev],[ed_hev]])) format=format+",' ',a6,' ',a6" title1=[title1,['Start','End']] title2=[title2,['(UT)','(UT)']] endif endif if (not keyword_set(nodisp)) then begin print,title1,format='('+format+')' print,title2,format='('+format+')' print,listf,format='('+format+')' endif end