pro copy_visible, dday=dday, visdat=visdat, wid=wid ;+ ; NAME: copy_visible ; PURPOSE: edit Seko-san's KSC schedule file to the visible format, ; exempting sxt_co from the boring and error-prone mk_visible. ; OPTIONAL INPUT: dday (default=5), used for getting the week ID ; wid (string): something like 01_35, i.e., yy_ww (year and week) ; to specify the week. ; SIDE EFFECTS: visible file like visible_01_35.dat is written to ; $DIR_GEN_STATUS. ; HISTORY: 24-May-2001, written by NVN ; 29-Oct-2001, corrected a bug by NVN ;- if n_elements(dday) ne 1 then dday=5 ; next week = dday days later pwid=tim2weekid(addtime(!stime,delta=-60.*24.*8)) ; previous week if n_elements(wid) ne 1 then wid=tim2weekid(addtime(!stime,delta=60.*24.*dday)) fwid=strmid(wid,3,2)+'_'+strmid(wid,0,2) ; on flare1 infil='/home/flare1/yohkoh/ksc_sched/w'+fwid cmd='scp -p -1 sxt@flare1:"'+infil+'" dum_sched' print,'copy Seko-san''s file to the present working directory.' spawn,cmd tempfile='dum_sched' alldat=rd_tfile(tempfile) header=alldat(2:4) header(1) =header(1) + ' Pass#' alldat=alldat(5:*) + ' ' nt=n_elements(alldat) ; visdat=string(strarr(nt),format='(a72)') ; outfil='$DIR_GEN_STATUS/visible_'+wid+'.dat' outfil='/nfs_isass/ssw_isass5/yohkoh/gen/status/visible_'+wid+'.dat' ; blank lines jb=where(strlen(alldat) lt 72, nb) if jb(nb-1) ge nt-2 then begin ; when the last line is blank, disregard it. jb=jb(0:nb-2) nb=nb-1 endif ; Make the first line blank if it is not padded=0 if jb(0) ge 5 then begin nb=nb+1 alldat=[arr2str(replicate(' ',80),''),alldat] nt=nt+1 jb=[0,jb+1] padded=1 endif print,nb,' days found.' js=jb(0:nb-1)+1 je=jb(1:nb-1)-1 & je=[je,nt-1] visdat=string(strarr(nt),format='(a80)') for i=0,nb-1 do begin dum=alldat(js(i):je(i)) len=strlen(dum)<79 c3=strmid(dum,69,3) dum2=string(strarr(je(i)-js(i)+1),format='(a80)') for j=0,je(i)-js(i) do dum2(j)=strmid(dum(j),0,68)+ $ arr2str(replicate(' ',12),'') ; does this day contain 34 m? j34=where(c3 eq '34m', n34) if n34 eq 0 then begin j1=where(c3 eq '1 ',n1) j2=where(c3 eq '2 ',n2) j3=where(c3 eq '3 ',n3) j4=where(c3 eq '4 ',n4) j5=where(c3 eq '5 ',n5) ; start=first pass start=-1 if n1 eq 1 then start=j1(0) if n1 eq 0 and n2 eq 1 then start=j2(0)-1 if n1 eq 0 and n2 eq 0 and n3 eq 1 then start=j3(0)-2 if n1 eq 0 and n2 eq 0 and n3 eq 0 and n4 eq 1 then start=j4(0)-3 if n1 eq 0 and n2 eq 0 and n3 eq 0 and n4 eq 0 and n5 eq 1 then $ start=j5(0)-4 if start eq -1 then goto, fini_day for j=0,4 do begin dum3=dum2(start(0)+j) strput,dum3,'['+string(j+1,format='(i1)')+']',69 strput,dum3,' ',72 d3=c3(start(0)+j) if d3 eq '1 ' or d3 eq '2 ' or d3 eq '3 ' or d3 eq '4 ' or $ d3 eq '5 ' then strput,dum3,'Visible',73 dum2(start(0)+j)=dum3 endfor endif else begin start=0 for j=0,4 do begin dum3=dum2(start(0)+j) strput,dum3,'['+string(j+1,format='(i1)')+']',69 strput,dum3,' ',72 d3=c3(start(0)+j) if strmid(d3,0,2) eq '34' then strput,dum3,'Visible',73 dum2(start(0)+j)=dum3 endfor endelse visdat(js(i):je(i))=dum2 fini_day: print,'Day ',i+1, ' finished.' endfor if padded eq 1 then visdat=visdat(1:nt-1) hhh=strarr(16) arch=!version.arch lenarch=strlen(arch) lenarch=lenarch(0) if lenarch gt 22 then begin arch=strmid(arch,0,22) lenarch=22 endif os=!version.os lenos=strlen(os) lenos=lenos(0) if lenos gt 22 then begin os=strmid(os,0,22) lenos=22 endif vers=!version.release lenv=strlen(vers) lenv=lenv(0) if lenv gt 22 then begin vers=strmid(vers,0,22) lenv=22 endif spawn,'hostname',a lena=strlen(a) lena=lena(0) if lena gt 23 then begin a=strmid(a,0,23) lena=23 endif spawn,'pwd',b lenb=strlen(b) lenb=lenb(0) if lenb gt 23 then begin b=strmid(b,0,23) lenb=23 endif pretime=fmt_tim(anytim2ints(!stime)) uttime=fmt_tim(addtime(anytim2ints(!stime),delta=-540.)) hhh(0)='; Visible Contacts File' hhh(1)='; ' hhh(2)=';+ ' hhh(3)='; ------------------------------------ ' hhh(4)='; | User Name: sxt_co |' hhh(5)='; | Host Name: '+a+arr2str(replicate(' ',40-16-lena),'')+'|' hhh(6)='; | Directory: '+b+arr2str(replicate(' ',40-16-lenb),'')+'|' hhh(7)='; | |' hhh(8)='; | Local Time: '+pretime+' |' hhh(9)='; | UT Time : '+uttime+' |' hhh(10)='; | |' hhh(11)='; | IDL Version: '+vers+arr2str(replicate(' ',40-18-lenv),'')+'|' hhh(12)='; | Host OS : '+os+arr2str(replicate(' ',40-18-lenos),'')+'|' hhh(13)='; | Host ARCH : '+arch+arr2str(replicate(' ',40-18-lenarch),'')+'|' hhh(14)='; ----------------------------------- ' hhh(15)=';- ' openw,1,outfil printf,1,hhh,format='(a)' printf,1,header,format='(a)' printf,1,visdat,format='(a)' close,1 cmd='/bin/rm dum_sched' print,'delete the temporary file copied to the present working directory.' spawn,cmd return end