PRO plot_ql4,year,month,day,ps=ps ; This procedure plots Polar Camera quick-look data for 4 consecutive ; days onto one page, for purposes of compression. The arguments ; specify the first of the four days for which data are to be plotted. ; ; The output defaults to the X Windows display, unless the ps ; keyword is set. @isitdos !P.MULTI=[0,2,4,0,0] datafound=0B gaplen=1.1*3600 IF year LT 100 THEN IF year LT 50 THEN year=year+2000 ELSE year=year+1900 jd0=julday(month,day,year) FOR i=0,3 DO BEGIN caldat,jd0+i,m,d,y date=STRING(y MOD 100,m,d,FORMAT='(3I2.2)') datestring=ymd2date(y,m,d,format='d$ n$ y$') IF i EQ 0 THEN BEGIN IF KEYWORD_SET(ps) THEN BEGIN CD,qlroot psname=date+'ql4.ps' psopen,psname,/longpage ENDIF ELSE BEGIN WINDOW,0,XSIZE=640,YSIZE=900 loadct,0,/silent ENDELSE ENDIF c0ql=FINDFILE(qlroot+dd+date+'0*',COUNT=nc0) c1ql=FINDFILE(qlroot+dd+date+'1*',COUNT=nc1) IF (nc0 EQ 0) AND (nc1 EQ 0) THEN BEGIN MESSAGE,'No quick-look files found for '+date,/INFORMATIONAL IF !P.MULTI(0) GT 0 THEN !P.MULTI(0)=!P.MULTI(0)-2 ELSE BEGIN nperpage=!P.MULTI(1)*!P.MULTI(2) !P.MULTI(0)=nperpage-2 ENDELSE ENDIF ELSE BEGIN c0ql=c0ql(SORT(c0ql)) c1ql=c1ql(SORT(c1ql)) filt0=-1 PLOT,[0,24],[0,1000],/NODATA,XRANGE=[0,24],/XSTYLE $ ,XTICKS=4,XTICKV=INDGEN(5)*6,XMINOR=6 $ ,XTITLE='Universal Time (hours, '+datestring+')' $ ,YTITLE='Zenith Brightness (R or R/nm)' $ ,TITLE='Quick Look Plot for Camera 0, '+datestring IF nc0 GT 0 THEN BEGIN FOR f=0,nc0-1 DO BEGIN rdcols,c0ql(f),n,t,me,sd IF n GT 0 THEN BEGIN filtnum=FIX(STRMID(c0ql(f),STRLEN(c0ql(f))-4,1)) ; Don't plot across gaps longer than 'gaplen' seconds datafound=1B dt=(t-SHIFT(t,1))>0 gap=WHERE(dt GT gaplen) ngap=TOTAL(gap GT 0) IF ngap EQ 0 THEN OPLOT,t/3600.,me,LINESTYLE=filtnum ELSE BEGIN seg=INDGEN(gap(0)) OPLOT,t(seg)/3600.,me(seg),LINESTYLE=filtnum IF ngap GE 2 THEN FOR j=1,ngap-1 DO BEGIN seg=INDGEN(gap(j)-gap(j-1))+gap(j-1) OPLOT,t(seg)/3600.,me(seg),LINESTYLE=filtnum ENDFOR seg=INDGEN(n-gap(ngap-1)+1)+gap(ngap-1) OPLOT,t(seg)/3600.,me(seg),LINESTYLE=filtnum ENDELSE IF TOTAL(filt0 GE 0) EQ 0 $ THEN filt0=[filtnum] $ ELSE filt0=[filt0,filtnum] ENDIF ENDFOR IF datafound THEN BEGIN ; Plot the lunar elevation to help in interpreting data ya=REPLICATE(y,25) ma=REPLICATE(m,25) da=REPLICATE(d,25) h=FINDGEN(25) mi=FLTARR(25) s=mi moonazel,ya,ma,da,h,mi,s,maz,mel moonup=(MAX(mel) GT 0.) IF moonup THEN OPLOT,h,mel*10.,PSYM=-6,SYMSIZE=0.5 xdvpos=!P.CLIP(0) ydvpos=!P.CLIP(3) npos=CONVERT_COORD([xdvpos,ydvpos],/DEVICE,/TO_NORMAL) npos=npos(0:1) nmpos=STRPOS(filters(filt0),'nm')+2 labels=STRMID(filters(filt0),0,MAX(nmpos)) FOR il=0,N_ELEMENTS(filt0)-1 DO $ labels(il)=STRMID(labels(il),0,nmpos(il)) lines=filt0 syms=REPLICATE(0,N_ELEMENTS(lines)) IF moonup THEN BEGIN labels=[labels,'Moon el.*10'] lines=[lines,0] syms=[syms,-6] ENDIF legend,labels,linestyle=lines,psym=syms,position=npos $ ,charsize=0.5,spacing=0.6 time_stamp,charsize=0.5 ENDIF ENDIF datafound=0B filt1=-1 PLOT,[0,24],[0,1000],/NODATA,XRANGE=[0,24],/XSTYLE $ ,XTICKS=4,XTICKV=INDGEN(5)*6,XMINOR=6 $ ,XTITLE='Universal Time (hours, '+datestring+')' $ ,YTITLE='Zenith Brightness (R or R/nm)' $ ,TITLE='Quick Look Plot for Camera 1, '+datestring IF nc1 GT 0 THEN BEGIN FOR f=0,nc1-1 DO BEGIN rdcols,c1ql(f),n,t,me,sd IF n GT 0 THEN BEGIN filtnum=FIX(STRMID(c1ql(f),STRLEN(c1ql(f))-4,1)) ; Don't plot across gaps longer than 1.5 hours datafound=1B dt=(t-SHIFT(t,1))>0 gap=WHERE(dt GT gaplen) ngap=TOTAL(gap GT 0) IF ngap EQ 0 THEN OPLOT,t/3600.,me,LINESTYLE=filtnum ELSE BEGIN seg=INDGEN(gap(0)) OPLOT,t(seg)/3600.,me(seg),LINESTYLE=filtnum IF ngap GE 2 THEN FOR j=1,ngap-1 DO BEGIN seg=INDGEN(gap(j)-gap(j-1))+gap(j-1) OPLOT,t(seg)/3600.,me(seg),LINESTYLE=filtnum ENDFOR seg=INDGEN(n-gap(ngap-1)+1)+gap(ngap-1) OPLOT,t(seg)/3600.,me(seg),LINESTYLE=filtnum ENDELSE IF TOTAL(filt1 GE 0) EQ 0 $ THEN filt1=[filtnum] $ ELSE filt1=[filt1,filtnum] ENDIF ENDFOR IF datafound THEN BEGIN xdvpos=!P.CLIP(0) ydvpos=!P.CLIP(3) npos=CONVERT_COORD([xdvpos,ydvpos],/DEVICE,/TO_NORMAL) npos=npos(0:1) nmpos=STRPOS(filters(filt1+5),'nm')+2 labels=STRMID(filters(filt1+5),0,MAX(nmpos)) FOR il=0,N_ELEMENTS(filt1)-1 DO $ labels(il)=STRMID(labels(il),0,nmpos(il)) lines=filt1 syms=REPLICATE(0,N_ELEMENTS(lines)) legend,labels,linestyle=lines,psym=syms,position=npos $ ,charsize=0.5,spacing=0.6 time_stamp,charsize=0.5 ENDIF ENDIF ENDELSE ENDFOR IF KEYWORD_SET(ps) THEN BEGIN psclose IF NOT dos THEN SPAWN,'~steele/scripts/rmps3 '+psname+' b' CD,!DIR ENDIF RETURN END