PRO merscan,year,month,day,hour,minute,second,nsteps,xsh,ysh,ysh2,dble=dble COMMON images,hdb,im,tvim,az,za,hdb2,im2,tvim2,az2,za2 $ ,merunit,plotsd,wideslice,mpfsb ; Set up OS-dependent parameters @isitdos IF N_ELEMENTS(merunit) EQ 0 THEN merunit=-1 IF merunit LT 0 THEN BEGIN ; Open a file to hold information about meridian slices, ; if one is not already open. mername=tmproot+dd+'merdata.tmp' OPENW,merunit,mername,/GET_LUN IF dos THEN WSHOW,0,0 plotsd='' READ,'Plot s.d. of meridian slice(s)? (Y/[N]) ',plotsd plotsd=(STRUPCASE(plotsd) EQ 'Y') wideslice=1. READ,'Enter meridian slice width (deg; default=1): ',wideslice READ,'Enter the full-scale brightness for the meridian plot: ' $ ,mpfsb IF dos THEN WSHOW,0,1 ENDIF FOR kmer=0,N_ELEMENTS(dble) DO BEGIN ; Only need to select azimuth for 1st image IF kmer EQ 0 THEN BEGIN ; determine image size sim=SIZE(im) simx=sim(1) simy=sim(2) ; position cursor to guide user TVCRS,xsh+simx/2,ysh+61+simy/2,/DEVICE IF dos THEN WSHOW,0,0 PRINT,'Click on a pixel defining the meridian you want to sample.' WAIT,1 IF dos THEN WSHOW,0,1 ; read cursor position when mouse button pressed CURSOR,xm,ym,/DOWN,/DEVICE TV,REPLICATE(!D.N_COLORS-1,3,3),xm-1,ym-1 ; convert cursor coordinates to image coordinates xm=xm-xsh ym=ym-(ysh+61) pixok=((0 LE xm) AND (xm LE simx) AND $ (0 LE ym) AND (ym LE simy)) IF NOT pixok THEN BEGIN IF dos THEN WSHOW,0,0 ; Prompt user to enter azimuth from keyboard PRINT,'Pixel outside image!' sunazel,year,month,day,hour,minute,second,sunaz PRINT,'Solar azimuth at image time: ',sunaz,' deg' $ ,FORMAT='(A,F5.1,A)' READ,'Enter the azimuth to sample: ',maz xm=-1 ym=-1 pixok=1B ; Prompt user to return cursor to window so ; MOVCROSS doesn't fail at TVRD. IF dos THEN WSHOW,0,1 ELSE BEGIN PRINT,'Click in plot window to continue.' CURSOR,jx,jy,/DOWN,/DEVICE ENDELSE ENDIF IF (xm GE 0) AND (ym GE 0) THEN BEGIN PRINT,xm,ym,FORMAT='("xm=",I0," ym=",I0)' ; determine the meridian maz=az(xm,ym) ENDIF PRINT,maz,FORMAT='("Azimuth ",F5.1," deg selected.")' ; Identify the meridian on the image IF KEYWORD_SET(dble) $ THEN azval=(nsteps/2-1) $ ELSE azval=!D.N_COLORS-1 waz=WHERE(ABS(az-maz) LT 0.5,nwaz) IF nwaz GT 0 THEN tvim(waz)=azval oaz=(maz+180) MOD 360 waz=WHERE(ABS(oaz-az) LT 0.5,nwaz) IF nwaz GT 0 THEN tvim(waz)=azval TV,tvim,xsh,ysh+61 ; Now save the currently displayed images to a pixmap ; so they can be refreshed later IF N_ELEMENTS(pwin) EQ 0 THEN BEGIN dxsize=!D.X_SIZE dysize=!D.Y_SIZE dwin=!D.WINDOW WINDOW,/FREE,/PIXMAP,XSIZE=dxsize-xsh,YSIZE=dysize pwin=!D.WINDOW WSET,dwin ENDIF WSET,pwin DEVICE,COPY=[xsh,0,dxsize-xsh,dysize,0,0,dwin] WSET,dwin ; Now use routine MERSLICE to return the meridian intensities merslice,ROTATE(im,2),az,za,maz,elev,slice,sd $ ,swidth=wideslice ; Now plot the meridian slice(s) xp=!X.MARGIN*!D.X_CH_SIZE yp=!Y.MARGIN*!D.Y_CH_SIZE posn=[xp(0),yp(0),0.95*xsh-xp(1),!D.Y_SIZE-yp(1)] PLOT,[0,1],[0,1] $ ,XTITLE='Elevation Angle (deg)' $ ,XRANGE=[20,160],/XSTYLE $ ,YTITLE='Intensity along Meridian (R)' $ ,YRANGE=[0,mpfsb] $ ,TITLE=STRING(maz,FORMAT='(F5.1)')+' deg azimuth' $ ,/NODATA,POSITION=posn,/DEVICE ; Now refresh the displayed images DEVICE,COPY=[0,0,dxsize-xsh,dysize,xsh,0,pwin] ; Now display the meridian slice pcol=0.6*(!D.N_COLORS-1)/(1.+N_ELEMENTS(dble)) OPLOT,elev,slice,COLOR=pcol IF plotsd THEN BEGIN OPLOT,elev,slice+sd,LINESTYLE=1,COLOR=!D.N_COLORS-1 OPLOT,elev,slice-sd,LINESTYLE=1,COLOR=!D.N_COLORS-1 ENDIF IF (xm GE 0) AND (ym GE 0) THEN BEGIN ; Prompt user to return cursor to window so ; MOVCROSS doesn't fail at TVRD. PRINT,'Click in plot window to continue.' CURSOR,jx,jy,/DOWN,/DEVICE ENDIF dmovcross,pkel,pkint,color=pcol ; Write meridian data into the temporary file. WRITEU,merunit,hdb,maz,pkel,pkint $ ,N_ELEMENTS(elev),elev,slice ENDIF ELSE BEGIN ; If a second image is displayed, change the parameters ; and repeat the process for that image. ; First identify the meridian on the second image azval=!D.N_COLORS-1 waz=WHERE(ABS(az2-maz) LT 0.5,nwaz) IF nwaz GT 0 THEN tvim2(waz)=azval oaz=(maz+180) MOD 360 waz=WHERE(ABS(oaz-az2) LT 0.5,nwaz) IF nwaz GT 0 THEN tvim2(waz)=azval TV,tvim2,xsh,ysh2+61 ; Then generate and plot the meridian slice merslice,ROTATE(im2,2),az2,za2,maz,elev,slice,sd $ ,swidth=wideslice pcol=((1.0+0.6)/2.)*(!D.N_COLORS-1) OPLOT,elev,slice,COLOR=pcol,LINESTYLE=2 IF plotsd THEN BEGIN OPLOT,elev,slice+sd,LINESTYLE=1,COLOR=!D.N_COLORS-1 OPLOT,elev,slice-sd,LINESTYLE=1,COLOR=!D.N_COLORS-1 ENDIF dmovcross,pkel,pkint,color=pcol ; Write meridian data into the temporary file. WRITEU,merunit,hdb2,maz,pkel,pkint $ ,N_ELEMENTS(elev),elev,slice ENDELSE ENDFOR RETURN END