pro norh_pr_info,arg0,arg1 $ ,nodisp=nodisp,list=list $ ,event=event,freq=freq,log=log $ ,jst=jst,withcarib=withcarib,withcd=withcd ; ,detail=detail ;+ ; NAME: ; NORH_PR_INFO ; ; PURPOSE: ; This procedure gives a info-list of data observed ; by NORH. ; ; CALLING SEQUENCE: ; norh_pr_info,st_time,ed_time ; norh_pr_info,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: ; nodisp: not display the result ; freq: observing frequency 17 or 34 ; event: give information on the event-mode observation ; log: observation log is also listed ; jst: Show times in JST ; ; HISTORY: ; Writtern 1998-08-13 TY ; Modified 1999-01-14 TY ; Modified 2000-04-10 TY for Y2K problem ; ;- if keyword_set(event) then begin filetail='e' & filedthd='se' endif else begin filetail='s' & filedthd='ss' endelse if (n_elements(freq) eq 0) then freq=17 freqst=strtrim(freq,1) 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 st_daytim=anytim(st_time,/ints) ed_daytim=anytim(ed_time,/ints) ndayx=ed_daytim.day-st_daytim.day+1 ex=anytim(transpose([[lonarr(ndayx)],[st_daytim.day+lindgen(ndayx)]]),/ex) yyyy=reform(ex(6,*)) mm=reform(ex(5,*)) yy=yyyy-yyyy/100*100 yymm=$ string(transpose([[yy],[mm]]),format="(i2.2,i2.2)") if (n_elements(yymm) ge 2) then yymm=yymm(uniq(yymm)) files='info'+yymm+filetail dirst=getenv('DIR_NORH_INFO') dir=norh_splitstr(dirst,':') infil=file_list(dir,files) filestr='' for mfil=0,n_elements(infil)-1 do filestr=filestr+' '+infil(mfil) if not keyword_set(withcarib) then grep_str=' | egrep ''(TRACK|\?\?\?\?\?)'' ' $ else grep_str='' spawn,'cat '+filestr $ +' | grep '''+filedthd+freqst+''' '+grep_str+'| awk ''{print $1}''',cdvol spawn,'cat '+filestr $ +' | grep '''+filedthd+freqst+''' '+grep_str+'| awk ''{print $2}''',filest spawn,'cat '+filestr $ +' | grep '''+filedthd+freqst+''' '+grep_str+'| awk ''{print $3}''',date0 spawn,'cat '+filestr $ +' | grep '''+filedthd+freqst+''' '+grep_str+'| awk ''{print $4}''',stob0 spawn,'cat '+filestr $ +' | grep '''+filedthd+freqst+''' '+grep_str+'| awk ''{print $5}''',edob0 spawn,'cat '+filestr $ +' | grep '''+filedthd+freqst+''' '+grep_str+'| awk ''{print $6}''',st_frame spawn,'cat '+filestr $ +' | grep '''+filedthd+freqst+''' '+grep_str+'| awk ''{print $7}''',ed_frame if (n_elements(cdvol) eq 0) then begin print,'No observation in this duration' return endif if (n_elements(cdvol) eq 1) then begin if (cdvol eq '') then begin print,'No observation in this duration' return endif endif st_frame=strtrim(long(st_frame),2) & ed_frame=strtrim(long(ed_frame),2) yy=strmid(date0,0,2) & mm=strmid(date0,2,2) & dd=strmid(date0,4,2) yy0=fix(strmid(date0,0,2)) year=yy0+1900 whr=where(year lt 1950,count) if (count ge 1) then year(whr)=year(whr)+100 yy=string(year,format='(i4.4)') date=yy+'/'+mm+'/'+dd hh=strmid(stob0,0,2) & mn=strmid(stob0,2,2) & ss=strmid(stob0,4,2) stob=hh+':'+mn+':'+ss hh=strmid(edob0,0,2) & mn=strmid(edob0,2,2) & ss=strmid(edob0,4,2) edob=hh+':'+mn+':'+ss stob_daytim=anytim(date+' '+stob,/ints) & stob_utime=anytim(stob_daytim,/utime) edob_daytim=anytim(date+' '+edob,/ints) & edob_utime=anytim(edob_daytim,/utime) whr=where((edob_utime lt stob_utime),count) if (count ge 1) then $ edob_daytim(whr).day=edob_daytim(whr).day+1 $ & edob_utime=anytim(edob_daytim,/utime) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; choose ; UT to JST if (not keyword_set(jst)) then begin st_daytim=norh_ut2jst(st_daytim,/ints) ed_daytim=norh_ut2jst(ed_daytim,/ints) stob_utime=anytim(stob_daytim,/utime) edob_utime=anytim(edob_daytim,/utime) endif whr=where(((edob_daytim.day ge st_daytim.day) $ and (edob_daytim.day lt ed_daytim.day)) $ or ((stob_daytim.day ge st_daytim.day) $ and (stob_daytim.day lt ed_daytim.day)) ,mobx) if (mobx eq 0) then begin print,'No observation in this duration' goto,Lend endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; sort & uniq date=date(whr) & stob=stob(whr) & edob=edob(whr) cdvol=cdvol(whr) & st_frame=st_frame(whr) & ed_frame=ed_frame(whr) stob_daytim=stob_daytim(whr) & stob_utime=stob_utime(whr) edob_daytim=edob_daytim(whr) & edob_utime=edob_utime(whr) if (n_elements(date) ge 2) then begin rslt=sort(stob_utime) mdatex=n_elements(rslt) date=date(rslt) & stob=stob(rslt) & edob=edob(rslt) cdvol=cdvol(rslt) & st_frame=st_frame(rslt) & ed_frame=ed_frame(rslt) stob_daytim=stob_daytim(rslt) & stob_utime=stob_utime(rslt) edob_daytim=edob_daytim(rslt) & edob_utime=edob_utime(rslt) endif stob_timst=anytim(stob_daytim,/ccsds) edob_timst=anytim(edob_daytim,/ccsds) listftmp=stob_timst+edob_timst+st_frame+ed_frame if (n_elements(listftmp) ge 2) then begin whr=uniq(listftmp) cdvol=cdvol(whr) stob_timst=stob_timst(whr) & edob_timst=edob_timst(whr) st_frame=st_frame(whr) & ed_frame=ed_frame(whr) stob_daytim=stob_daytim(whr) & edob_daytim=edob_daytim(whr) endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mmx=n_elements(cdvol) if mmx ge 2 then begin tmp=long(st_frame)-shift(long(ed_frame),1) whr=where(tmp(1:*) ne 1,count) mscx=count+1 cdvol0=strarr(mscx) stob_daytim0=replicate(stob_daytim(0),mscx) edob_daytim0=replicate(edob_daytim(0),mscx) st_frame0=strarr(mscx) ed_frame0=strarr(mscx) for msc=0,mscx-1 do begin if msc eq 0 then begin stob_daytim0(msc)=stob_daytim(0) st_frame0(msc)=st_frame(0) cdvol0(msc)=cdvol(0) endif else begin stob_daytim0(msc)=stob_daytim(whr(msc-1)+1) st_frame0(msc)=st_frame(whr(msc-1)+1) cdvol0(msc)=cdvol(whr(msc-1)+1) endelse if msc eq mscx-1 then begin edob_daytim0(msc)=edob_daytim(mmx-1) ed_frame0(msc)=ed_frame(mmx-1) endif else begin edob_daytim0(msc)=edob_daytim(whr(msc)) ed_frame0(msc)=ed_frame(whr(msc)) endelse endfor stob_daytim=stob_daytim0 edob_daytim=edob_daytim0 st_frame=st_frame0 ed_frame=ed_frame0 cdvol=cdvol0 endif ;if not keyword_set(detail) then begin mmx=n_elements(cdvol) if mmx ge 2 then begin tmp=long(st_frame)-shift(long(ed_frame),1) whr=where(tmp(1:*) le 0,count) mscx=count+1 cdvol0=strarr(mscx) stob_daytim0=replicate(stob_daytim(0),mscx) edob_daytim0=replicate(edob_daytim(0),mscx) st_frame0=strarr(mscx) ed_frame0=strarr(mscx) for msc=0,mscx-1 do begin if msc eq 0 then begin stob_daytim0(msc)=stob_daytim(0) st_frame0(msc)=st_frame(0) cdvol0(msc)=cdvol(0) endif else begin stob_daytim0(msc)=stob_daytim(whr(msc-1)+1) st_frame0(msc)=st_frame(whr(msc-1)+1) cdvol0(msc)=cdvol(whr(msc-1)+1) endelse if msc eq mscx-1 then begin edob_daytim0(msc)=edob_daytim(mmx-1) ed_frame0(msc)=ed_frame(mmx-1) endif else begin edob_daytim0(msc)=edob_daytim(whr(msc)) ed_frame0(msc)=ed_frame(whr(msc)) endelse endfor stob_daytim=stob_daytim0 edob_daytim=edob_daytim0 st_frame=st_frame0 ed_frame=ed_frame0 cdvol=cdvol0 endif ;endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set the data 'schedule' mx=n_elements(stob_daytim) if not keyword_set(event) then begin sid=strarr(mx)+' ' for m=0,mx-1 do begin whrs=where(stob_daytim.day eq stob_daytim(m).day,cnt) if cnt ne 1 then begin for mcnt=0,cnt-1 do begin sid(whrs(mcnt))=string(byte('a')+byte(mcnt)) endfor endif endfor ex=anytim(stob_daytim,/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)") schedule=yymmdd+sid endif else begin schedule=strarr(mx) endelse ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; display if (not keyword_set(jst)) then begin stob_timst=norh_jst2ut(stob_daytim,/ccsds) edob_timst=norh_jst2ut(edob_daytim,/ccsds) endif else begin stob_timst=anytim(stob_daytim,/ccsds) edob_timst=anytim(edob_daytim,/ccsds) endelse stob_timstf=stob_timst & strput,stob_timstf,' ',10 edob_timstf=strmid(edob_timst,11,8) ;edob_timstf=edob_timst & strput,edob_timstf,' ',10 if keyword_set(withcd) then begin list=transpose([[cdvol],[stob_timst],[edob_timst],[schedule],[st_frame],[ed_frame]]) listf=transpose([[cdvol],[stob_timstf],[edob_timstf],[schedule],[st_frame],[ed_frame]]) format="a12,' ',a19,' ',a9,' ',a9,' ',a6,' ',a6" title1=['CD-Volume','Start','End ','Schedule','StFr','EdFr'] if (not keyword_set(jst)) then begin title2=[' ','(UT)','(UT)',' ',' ',' '] endif else begin title2=[' ','(JST)','(JST)',' ',' ',' '] endelse endif else begin list=transpose([[stob_timst],[edob_timst],[schedule],[st_frame],[ed_frame]]) listf=transpose([[stob_timstf],[edob_timstf],[schedule],[st_frame],[ed_frame]]) format="a19,' ',a9,' ',a9,' ',a6,' ',a6" title1=['Start','End ','Schedule','StFr','EdFr'] if (not keyword_set(jst)) then begin title2=['(UT)','(UT)',' ',' ',' '] endif else begin title2=['(JST)','(JST)',' ',' ',' '] endelse endelse if (not keyword_set(nodisp)) then begin print,title1,format='('+format+')' print,title2,format='('+format+')' print,listf,format='('+format+')' endif Lend: if keyword_set(log) then begin files='lob'+yymm dirst=getenv('DIR_NORH_LOB') dir=norh_splitstr(dirst,':') infil=file_list(dir,files) filestr='' for mfil=0,n_elements(infil)-1 do filestr=filestr+' '+infil(mfil) spawn,'cat '+filestr+' | grep ''###'' | sed ''s/^### //'' ',date daytim=anytim(date,/ints) whr=where((daytim.day ge st_daytim.day) $ and (daytim.day lt ed_daytim.day),mx) if (mx eq 0) then begin print,'No observation-log in this duration' return endif whrmn=min(whr) & whrmx=max(whr) datemn=date(whrmn) if (whrmx eq n_elements(date)-1) then datemx='DUMMY' else datemx=date(whrmx+1) spawn,'cat '+filestr,log sz=size(log) & mlx=sz(1) flg=0 for ml=0,mlx-1 do begin if (log(ml) ne '') and (strpos('### '+datemn,log(ml)) ne -1) then flg=1 if (log(ml) ne '') and (strpos('### '+datemx,log(ml)) ne -1) then goto,out if (flg eq 1) then print,log(ml) endfor out: endif end