pro foo, daynum ;+ ;NAME: ; mag_summary ;PURPOSE: ; To save daily magnetograms as a gif image for display and ; a postscript file for printing ; ;SAMPLE CALLING SEQUENCE: ; mag_summary, daynum ;HISTORY: ; Written Jan 1998 - R. Bush ; Version 1.1 May 1998 - R. Bush daystr = strtrim(string(daynum),1) fits_dir = '/mag/fd_M_96m_01d.00' + daystr bmin = -100 bmax = 100 nss = 15 mag = bytarr(256,256,nss) miss_pc = fltarr(nss) pc = strarr(nss) obstype = strarr(nss) id = strarr(nss) posx = [0, 128, 256] posy = [ 512, 384, 256, 128, 0] for i=0,nss-1 do begin cnt = strtrim(string(i),1) if (i lt 10) then cnt = '0' + cnt ; filename = 'fd_M_96m_01d.' + daystr + '.00'+ cnt + '.fits.Z' filename = 'fd_M_96m_01d.' + daystr + '.00'+ cnt + '.fits infil0 = concat_dir(fits_dir, filename) infil = '' if (file_exist(infil0)) then infil = infil0 if (file_exist(infil)) then begin print, infil ; spawn, 'zcat ' + infil + '> /tmp/tmp.fits' spawn, 'cp ' + infil + ' /tmp/tmp.fits' dat = rfits('/tmp/tmp.fits', head=hd, /scale) t_obs = sxpar(hd, 'T_OBS') missvals = strtrim(sxpar(hd, 'MISSVALS'),1) datavals = strtrim(sxpar(hd, 'DATAVALS'),1) dpc_obsr = strtrim(sxpar(hd, 'DPC_OBSR'),1) pangle = strtrim(sxpar(hd, 'P_ANGLE'),1) x0 = strtrim(sxpar(hd, 'X0'),1) y0 = strtrim(sxpar(hd, 'Y0'),1) date = strmid(t_obs,0,10) miss_pc(i) = (float(missvals)*100.)/(float(missvals)+float(datavals)) end else begin print, 'No file found - ' + filename dat = intarr(1024,1024) dat(*,*) = -32768 missvals = 'all' miss_pc(i) = 100. dpc_obsr = ' ' end img_rot = rot(dat,pangle,1,x0,y0) img = rebin(img_rot, 256, 256) mag(*,*,i) = bytscl(img, min=bmin, max=bmax) pc(i) = strtrim(fix(miss_pc(i)),1) + '%' if (miss_pc(i) eq 0.0) then pc(i) = ' ' obstype(i) = ' ' if (dpc_obsr eq 'FD_Magnetogram_Sum') then obstype(i) = '*' id(i) = strtrim(i,1) + obstype(i) ; print, i, miss_pc(i),' ', dpc_obsr,' ', obstype(i),' ', id(i),' ', pc(i) end if (n_elements(date) eq 0) then date = ' ' save_dev = !d.name set_plot, 'z' tv2, 384, 700, /init erase xyouts2, 40, 680, 'MDI Magnetograms - fd_M_96m', charsize=1.4 xyouts2, 4, 660, 'Day = ' + daystr, charsize=1.2 xyouts2, 220, 660, 'Date = ' + date, charsize=1.2 xyouts2, 4, 1, 'Mag_Summary Ver 1.1' xyouts2, 210, 1, 'Plot Made '+strmid(!stime, 0, 11) for i = 0, 2 do begin for j = 0, 4 do begin index = i + 3*j smmag = rebin(mag(*,*,index), 128, 128) tv2, smmag, posx(i), posy(j)+10 if (miss_pc(index) eq 100.) then begin pc(index) = ' ' xyouts2, posx(i)+35, posy(j)+70, 'Missing' end xyouts2, posx(i)+1, posy(j)+15, id(index) xyouts2, posx(i)+1, posy(j)+120, pc(index) end end out=tvrd() ;outfil = '/surge40/synoptic/mag_images/fd_M.' + daystr + '.gif' outfil = '/surge40/synoptic/mag_images/fd_M.rotated.' + date + '.gif' write_gif, outfil, out set_plot, 'ps' device,bits=8 ;device, filename = '/surge40/synoptic/mag_images/fd_M.' + daystr + '.ps' device, filename = '/surge40/synoptic/mag_images/fd_M.rotated.' + date + '.ps' mag(where(mag eq 0b)) = 255b tv2, 768, 1380, /init, ppinch=140, xoff=1.5 xyouts2, 120, 1350, 'MDI Magnetograms - fd_M_96m', charsize=1.5 xyouts2, 10, 1320, 'Day = ' + daystr, charsize=1.5 xyouts2, 440, 1320, 'Date = ' + date, charsize=1.5 xyouts2, 10, 2, 'Mag_Summary Ver 1.1' xyouts2, 420, 2, 'Plot Made ' + strmid(!stime, 0, 17) for i = 0, 2 do begin for j = 0, 4 do begin index = i + 3*j tv2, mag(*,*,index), 2*posx(i), 2*posy(j) + 20 mm = where(mag(*,*,index) eq 255b,nmm) if ((nmm eq 65536) and (miss_pc(index) eq 0.)) then begin xyouts2, 2*posx(i)+80, 2*posy(j)+140, 'SATURATED' end if (miss_pc(index) eq 100.) then begin pc(index) = ' ' xyouts2, 2*posx(i)+80, 2*posy(j)+140, ' MISSING ' end xyouts2, 2*posx(i)+10, 2*posy(j)+30, id(index) xyouts2, 2*posx(i)+200, 2*posy(j)+30, pc(index) end end device,/close set_plot, save_dev end