; ---------------------------------------------------------------------------------- ; NAME : displaysynoptic.pro ; ; PURPOSE: To generally plot all synoptic data -- MDI, HMI; ; LOS, Radial, Daily Frame ; ; INPUTS : file1 -- Input filename (including path) ; filename -- Output filename ; table -- Input colortable ; type -- 'Radial' or 'LOS' or 'Daily' ; please type exactly as above; the code uses ; these strings ; ; SUBROUTINES: carr_label.pro ; fitsio_read_image.pro ; ; ENVIRONMENT: run in sswidl ; ; OUTPUT : synoptic chart with HMI.MagColor.IDL_256.lut color table as .ps ; ; AUTHOR : Monica Bobra, 5 October 2012 ; ; MODIFICATION HISTORY: Removed cr keyword (1 November 2012) ; ; EXAMPLE : ; displaysynoptic,file1='hmi.Synoptic_Ml.2128.fits', $ ; filename='test.ps',table='HMI.MagColor.IDL_256.lut', type='LOS' $ ; ; displaysynoptic,file1='hmi.Mrdailysynframe_720s_nrt.fits', $ ; filename='test.ps',table='HMI.MagColor.IDL_256.lut', type='Daily' ; ---------------------------------------------------------------------------------- pro displaysynoptic, file1=file1, filename=filename, table=table, type=type ; READ THE DATA ; Read the exported data using fitsio_read_image.pro, which handles ; the NaNs correctly. However, fitsio_read_image.pro does not read the ; header into a structure but rather into a string array, which begs ; for reading the header into a structure later in this code. map = fitsio_read_image(file1,index1) ; Create the image in the postscript device with true-type fonts set_plot,'ps' !p.font=0 device, xsize=45.0,ysize=17.22,xoffset=0,yoffset=0,bits=8,/color,/landscape,/helvetica,filename=filename ; READ COLOR TABLE readcol,table,r_orig,g_orig,b_orig r_orig = r_orig*(255.) g_orig = g_orig*(255.) b_orig = b_orig*(255.) ;Create a white color to apply to NaN's r_orig[255]=255 g_orig[255]=255 b_orig[255]=255 ;Create a black color to apply to the labels r_orig[0]=0 g_orig[0]=0 b_orig[0]=0 ; Load color table tvlct, r_orig,g_orig,b_orig ; Create a byte array of values from 1 to 254 ; by solving the following equations: ; f(-1500)=1 and f(1500)=254 bmap = byte(round(map*253./3000.+127.5)>1<254) ;Set NaN values to 255 such that they get their own color bin (white) newarray=finite(map,/nan) find_nans = where(newarray eq 1) bmap[find_nans]=255b ; To get the header into a structure array,use mreadfits: mreadfits,file1,index1 ; Determine Carrington Location numbers Cdeg1 = index1.lon_frst Crot = ceil(Cdeg1/360.0) Clon = Crot*360 - Cdeg1 Cdeg2 = index1.lon_last ; PLOT THE DATA ; Plot the data for the Radial or LOS maps ;if (type eq 'Radial') or (type eq 'LOS') or (type eq 'Rho') or (type eq 'Theta') or (type eq 'Phi') then begin if (type eq 'Radial') or (type eq 'LOS') or (type eq 'Br') or (type eq 'Bt') or (type eq 'Bp') then begin ; Create the plot plot_image,bmap, min=0,max=255,xthick=3.0,ythick=3.0,xtitle='Carrington Longitude', ytitle='Sine Latitude',yticks=4,ytickname=['-1',' ','0',' ','1'],xticks=12,xticklen=0.01,yticklen=0.005,ticklen=0.005,xtickname=['0',' ','60',' ','120',' ','180',' ','240',' ','300',' ','360'],position=[0.05,0.1,0.875,0.875],/true,/norm ; Add Carrington Location numbers if index1.instrume eq 'MDI' then carr_label,startct=Cdeg1,finalct=Cdeg2,yoff=1145.22 if index1.telescop eq 'SDO/HMI' then carr_label,startct=Cdeg1,finalct=Cdeg2,yoff=1535.22 ; Create a title if index1.instrume eq 'MDI' then xyouts, .3, .95, 'MDI ' + type + ' Synoptic Chart for Carrington Rotation '+ string(index1.car_rot,Format='(I4)'), chars=1.5, /norm if index1.telescop eq 'SDO/HMI' then xyouts, .3, .95, 'HMI ' + type + ' Synoptic Chart for Carrington Rotation '+ string(index1.car_rot,Format='(I4)'), chars=1.5, /norm endif ; Plot the data for the daily synoptic frames if type eq 'Daily' then begin ; Determine the starting and ending Carrington longitude start_lon = ((floor(index1.lon_frst/360.)+1)*360.)-index1.lon_frst end_lon = ((floor(index1.lon_last/360.)+1)*360.)-index1.lon_last ; Determine the starting and ending Carrington rotation number start_num = floor(index1.lon_frst/360.)+1 end_num = floor(index1.lon_last/360.)+1 ; Create the plot plot_image,bmap, min=0,max=255,xthick=3.0,ythick=3.0,xtitle='Carrington Longitude', ytitle='Sine Latitude',yticks=4,ytickname=['-1',' ','0',' ','1'],yticklen=0.005,position=[0.05,0.1,0.875,0.875],xticks=1,xtickname=[' ',' '],/true,/norm ; Determine the starting and ending Carrington rotation number for the lables start_label = fix(start_lon) end_label = fix(((start_lon + 360) mod 360)) ; Add a line at Carrington Longitude = 0 line = 360. - start_lon normx = 0.05 totalx = 0.875-0.05 lonextent = 360 scale = totalx/lonextent plots,[normx+line*scale,normx+line*scale],[0.1,0.875],color=0,thick=3.0,/norm xyouts, (normx+line*scale)-0.002, 0.075, '0 ', color=0, chars=1.0,/norm ; Add labels at the start and ending points of the plot xyouts, 0.03, 0.075, start_label, color=0, chars=1.0,/norm xyouts, 0.85, 0.075, end_label, color=0, chars=1.0,/norm ; Add a line at Carrington Longitude = 180 but no label if the line is too close to the edge line180= (360. - start_lon + 180.) mod 360 plots,[normx+line180*scale,normx+line180*scale],[0.1,0.875],color=0,thick=3.0,/norm if (normx+line180*scale) gt 0.05 or (normx+line180*scale) lt 0.83 then begin xyouts, (normx+line180*scale)-0.035, 0.075, 'CR ' + string(crot,Format='(I4)') + ': 180 ', color=0, chars=1.0,/norm endif else begin xyouts, (normx+line180*scale)-0.035, 0.075, ' ', color=0, chars=1.0,/norm endelse ; Add a tick at Carrington Longitude = + 90 but no label if the line is too close to the edge lineplus90= (360. - start_lon + 90.) mod 360 plots,[normx+lineplus90*scale,normx+lineplus90*scale],[0.1,0.11],color=0,thick=3.0,/norm if (normx+lineplus90*scale) gt 0.05 or (normx+lineplus90*scale) lt 0.83 then begin xyouts, (normx+lineplus90*scale)-0.0045, 0.075, '90', color=0, chars=1.0,/norm endif else begin xyouts, (normx+lineplus90*scale)-0.0045, 0.075, ' ', color=0, chars=1.0,/norm endelse ; Add a tick at Carrington Longitude = 270 but no label if the line is too close to the edge lineminus90= (360. - start_lon + 270) mod 360 plots,[normx+lineminus90*scale,normx+lineminus90*scale],[0.1,0.11],color=0,thick=3.0,/norm if (normx+lineminus90*scale) gt 0.05 or (normx+lineminus90*scale) lt 0.83 then begin xyouts, (normx+lineminus90*scale)-0.005, 0.075, '270', color=0, chars=1.0,/norm endif else begin xyouts, (normx+lineminus90*scale)-0.005, 0.075, ' ', color=0, chars=1.0,/norm endelse ; Add Carrington Location numbers if index1.instrume eq 'MDI' then carr_label,startct=Cdeg1,finalct=Cdeg2,yoff=1145.22 if index1.telescop eq 'SDO/HMI' then carr_label,startct=Cdeg1,finalct=Cdeg2,yoff=1535.22 ; Create a title with the T_OBS timestamp in blue, the same color as the T_OBS label if index1.instrume eq 'MDI' then xyouts, .17, .95, 'MDI ' + type + ' Synoptic Frame for Carrington Rotation '+string(crot,Format='(I4)')+'-'+string(crot+1,Format='(I4)')+ ' at ', chars=1.5, /norm if index1.telescop eq 'SDO/HMI' then xyouts, .17, .95, 'HMI ' + type + ' Synoptic Frame for Carrington Rotation '+string(crot,Format='(I4)')+'-'+string(crot+1,Format='(I4)')+ ' at ', chars=1.5, /norm xyouts, .572, .95, index1.t_obs, color=220, chars=1.5, /norm ; Add a label for T_OBS in blue, the ; same color as the T_OBS portion of the title spawn_value = '/home/wso/bin/_linux4/ctimes -u -p ' + index1.t_obs + ' | grep CT | cut -f1 | cut -d: -f2' spawn,spawn_value,t_obs_carr ; TEST THE FOLLOWING TWO LINES -- NEED CASE STATEMENTS line_carr = (t_obs_carr + abs(start_lon - 360)) ;line_carr = (t_obs_carr - start_lon) mod 360 plots,[normx+line_carr*scale,normx+line_carr*scale],[0.875,0.864],color=220,thick=6.0,/norm plots,[normx+line_carr*scale,normx+line_carr*scale],[0.100,0.111],color=220,thick=6.0,/norm endif ; Create the latitude labels on the right-hand side of the plot axis,yaxis=1,ytitle='Latitude',ticklen=0.005,ytickv=((sin((!PI/18)*(findgen(19)-9.0)))), ytickname=[' ','-80 ',' ','-60',' ','-40',' ','-20',' ','0',' ',' 20',' ',' 40',' ',' 60',' ',' 80',' '], ystyle=1,yticks=18,yrange=[-1,1],xthick=4.0,ythick=4.0 ; CREATE COLORBAR ; Re-read color table to make a color bar that does not include white readcol,table,r_orig,g_orig,b_orig r_orig = r_orig*(255.) g_orig = g_orig*(255.) b_orig = b_orig*(255.) ; Re-create a black color to apply to the labels r_orig[0]=0 g_orig[0]=0 b_orig[0]=0 ; Re-load color table tvlct, r_orig,g_orig,b_orig ; Draw colorbar colorbar,ncolors=256,minrange=-1500,maxrange=1500,chars=.7,divisions=6,pos=[0.92, 0.097, 0.9375, 0.8775],/right,/vertical,/top plots,[0,0],[1000,1000],color=0,thick=3,/device xyouts, .3, .18, 'Plot Made '+!stime, chars=.7,/device device,/close end