;+ ; NAME fits_annotatew.pro ; ; PURPOSE Annotate a FITS image. ; ; SYNTAX fits_annotatew, hdu ; ; hdu: FITS header ; xdim: x-axis dimension ; ydim: y-axis dimension ; xb: x-axis border for annotation ; yb: y-axis border for annotation ; ; HISTORY Andrew L. Stanger HAO/NCAR 14 September 2001 ; 26 Sep 2001: wide version; no colorbar BELOW image. ;- PRO fits_annotatew, hdu, xdim, ydim, xb, yb, wmin=wmin, wmax=wmax ;--- Character sizes: xoff = 2 yoff = 2 x1 = 8 x2 = 12 x3 = 8 y1 = 12 y2 = 12 y3 = 8 xend = xdim + xb - x1 yend = ydim + yb - y1 cfac = 2.0 IF (STRLOWCASE (!version.os) EQ 'irix') THEN cfac = 1.0 IF (STRLOWCASE (!version.os) EQ 'sunos' ) THEN cfac = 2.0 cs = cfac * 0.6 ; character size ;--- Color assignments for annotation. white = 255 red = 254 green = 253 blue = 252 grey = 251 yellow = 250 black = 0 ;--- Get information from FITS header. telescop = STRTRIM (fxpar (hdu, 'TELESCOP'), 2) instrume = STRTRIM (fxpar (hdu, 'INSTRUME'), 2) IF (telescop NE 'SPARTAN 201' AND instrume NE 'WLC') THEN $ BEGIN ;{ date_obs = fxpar (hdu, 'DATE-OBS') time_obs = fxpar (hdu, 'TIME-OBS') origin = fxpar (hdu, 'ORIGIN') object = fxpar (hdu, 'OBJECT') type_obs = fxpar (hdu, 'TYPE-OBS') dataform = fxpar (hdu, 'DATAFORM') datamin = fxpar (hdu, 'DATAMIN') datamax = fxpar (hdu, 'DATAMAX') dispmin = fxpar (hdu, 'DISPMIN') dispmax = fxpar (hdu, 'DISPMAX') ; datamin = STRTRIM (STRING (fxpar (hdu, 'DATAMIN'), FORMAT='(E8.2)'), 2) ; datamax = STRTRIM (STRING (fxpar (hdu, 'DATAMAX'), FORMAT='(E8.2)'), 2) ; dispmin = STRTRIM (STRING (fxpar (hdu, 'DISPMIN'), FORMAT='(E8.2)'), 2) ; dispmax = STRTRIM (STRING (fxpar (hdu, 'DISPMAX'), FORMAT='(E8.2)'), 2) bunit = fxpar (hdu, 'BUNIT') ;--- Annotate image. yloc = yend - yoff XYOUTS, xoff, yloc, 'DATE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, date_obs + ' UT',/device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'TIME', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, time_obs + ' UT',/device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'TELESCOPE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, telescop, /device, charsize=cs, color=grey yloc = yloc - y2 - y2 - y3 XYOUTS, xoff, yloc, 'INSTRUME', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, instrume, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'OBJECT', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, object, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'TYPE-OBS', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, type_obs, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DATA FORM', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, dataform, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DATA MIN', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, datamin, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DATA MAX', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, datamax, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DISP MIN', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, dispmin, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DISP MAX', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, dispmax, /device, charsize=cs, color=grey ; print, 'wmin: ', wmin ; IF (KEYWORD_SET (wmin) OR wmin EQ 0.0) THEN $ IF (KEYWORD_SET (wmin)) THEN $ BEGIN yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'WMIN', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, wmin, /device, charsize=cs, color=grey END IF (KEYWORD_SET (wmax)) THEN $ BEGIN yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'WMAX', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, wmax, /device, charsize=cs, color=grey END yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'BRIGHTNESS UNIT', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, bunit, /device, charsize=cs, color=grey ;--- Create color bar array. collin = bindgen (256) ; collin = rebin (collin, 512) colbar = bytarr (256, 20) for i = 0, 19 DO $ colbar [*, i] = collin [*] ;--- Draw color bar. IF (yb GE 50) THEN $ BEGIN ;{ xc1 = xb + (xdim - 256) / 2 xc2 = xc1 + 256 yc1 = yb - 50 yc2 = yb - 30 tv, colbar, xc1, yc1 ;--- Draw border around color bar. plots, [xc1-1, yc1-1], /device, color=251 plots, [xc1-1, yc2+1], /device, color=251, /CONTINUE plots, [xc1-1+258, yc2+1], /device, color=251, /CONTINUE plots, [xc1-1+258, yc1-1], /device, color=251, /CONTINUE plots, [xc1-1, yc1-1], /device, color=251, /CONTINUE ;--- Draw tick marks below color bar. plots, [xc1, yc1- 3], /device, color=251 plots, [xc1, yc1-12], /device, color=251, /CONTINUE plots, [xc1+ 31, yc1- 3], /device, color=251 plots, [xc1+ 31, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+ 63, yc1- 3], /device, color=251 plots, [xc1+ 63, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+ 95, yc1- 3], /device, color=251 plots, [xc1+ 95, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+127, yc1- 3], /device, color=251 plots, [xc1+127, yc1-12], /device, color=251, /CONTINUE plots, [xc1+159, yc1- 3], /device, color=251 plots, [xc1+159, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+191, yc1- 3], /device, color=251 plots, [xc1+191, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+223, yc1- 3], /device, color=251 plots, [xc1+223, yc1- 7], /device, color=251, /CONTINUE plots, [xc2, yc1- 3], /device, color=251 plots, [xc2, yc1-12], /device, color=251, /CONTINUE ;--- Label color bar. XYOUTS, xc1 - x1 / 2, yc1 - 14 - y1, '0', /device, $ charsize=cs, color=251 XYOUTS, xc1 + 127 - 3*x1 / 2, yc1 - 14 - y1, '127', /device, $ charsize=cs, color=251 XYOUTS, xc1 + 256 - 3*x1 / 2, yc1 - 14 - y1, '255', /device, $ charsize=cs, color=251 ENDIF ;} END ;} IF (telescop EQ 'SPARTAN 201' AND instrume EQ 'WLC') THEN $ BEGIN ;{ orbit_id = fxpar (hdu, 'ORBIT-ID') image_id = fxpar (hdu, 'IMAGE-ID') sorbit_id = STRTRIM (STRING (orbit_id, FORMAT='(I4)'), 2) simage_id = STRTRIM (STRING (image_id, FORMAT='(I4)'), 2) telescop = fxpar (hdu, 'TELESCOP') instrume = fxpar (hdu, 'INSTRUME') dateobs = fxpar (hdu, 'DATE-OBS') timeobs = fxpar (hdu, 'TIME-OBS') met = fxpar (hdu, 'MET') type_obs = fxpar (hdu, 'TYPE-OBS') dataform = fxpar (hdu, 'DATAFORM') rsun = fxpar (hdu, 'RSUN') srsun = STRTRIM (STRING (rsun, FORMAT='(F7.2)'), 2) bunit = fxpar (hdu, 'BUNIT') datamin = fxpar (hdu, 'DATAMIN') datamax = fxpar (hdu, 'DATAMAX') optdev00 = fxpar (hdu, 'OPTDEV00') optpos00 = fxpar (hdu, 'OPTPOS00') optdev01 = fxpar (hdu, 'OPTDEV01') optpos01 = fxpar (hdu, 'OPTPOS01') optdev02 = fxpar (hdu, 'OPTDEV02') optpos02 = fxpar (hdu, 'OPTPOS02') optdev03 = fxpar (hdu, 'OPTDEV03') optpos03 = fxpar (hdu, 'OPTPOS03') ccdtemp1 = fxpar (hdu, 'CCDTEMP1') ccdtemp2 = fxpar (hdu, 'CCDTEMP2') sccdtemp1 = STRTRIM (STRING (ccdtemp1, FORMAT='(F8.2)'), 2) sccdtemp2 = STRTRIM (STRING (ccdtemp2, FORMAT='(F8.2)'), 2) yaw_ave = fxpar (hdu, 'YAW_AVE') yaw_min = fxpar (hdu, 'YAW_MIN') yaw_max = fxpar (hdu, 'YAW_MAX') pitchave = fxpar (hdu, 'PITCHAVE') pitchmin = fxpar (hdu, 'PITCHMIN') pitchmax = fxpar (hdu, 'PITCHMAX') syaw_ave = STRTRIM (STRING (yaw_ave, FORMAT='(F8.2)'), 2) syaw_min = STRTRIM (STRING (yaw_min, FORMAT='(F8.2)'), 2) syaw_max = STRTRIM (STRING (yaw_max, FORMAT='(F8.2)'), 2) spitchave = STRTRIM (STRING (pitchave, FORMAT='(F8.2)'), 2) spitchmin = STRTRIM (STRING (pitchmin, FORMAT='(F8.2)'), 2) spitchmax = STRTRIM (STRING (pitchmax, FORMAT='(F8.2)'), 2) ocp_ang = fxpar (hdu, 'OCP_ANG') rcp_ang = fxpar (hdu, 'RCP_ANG') wlc_ang = fxpar (hdu, 'WLC_ANG') socp_ang = STRTRIM (STRING (ocp_ang, FORMAT='(F8.2)'), 2) srcp_ang = STRTRIM (STRING (rcp_ang, FORMAT='(F8.2)'), 2) swlc_ang = STRTRIM (STRING (wlc_ang, FORMAT='(F8.2)'), 2) solar_p0 = fxpar (hdu, 'SOLAR_P0') ssolar_p0 = STRTRIM (STRING (solar_p0, FORMAT='(F8.2)'), 2) expdur = fxpar (hdu, 'EXPDUR') nimsum = fxpar (hdu, 'NIMSUM') sexpdur = STRTRIM (STRING (expdur, FORMAT='(F6.3)'), 2) snimsum = STRTRIM (STRING (nimsum, FORMAT='(I6)'), 2) crota1 = fxpar (hdu, 'CROTA1') scrota1 = STRTRIM (STRING (crota1, FORMAT='(F8.2)'), 2) ;--- Annotate image. yloc = yend - yoff XYOUTS, xoff, yloc, 'TELESCOPE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, telescop, /device, charsize=cs, color=grey yloc = yloc - y2 XYOUTS, xoff, yloc - y1, instrume, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DATE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, dateobs + ' UT', /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'TIME', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, timeobs + ' UT', /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'MET', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, met, /device, charsize=cs, color=grey ; print, 'orbit_id: ', orbit_id ; print, 'image_id: ', image_id yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'ORB-IMG ID', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, sorbit_id + '-' + simage_id, /device, $ charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'EXP DUR / # SUMMED', /device, $ charsize=cs, color=red XYOUTS, xoff, yloc - y1, sexpdur + ' - ' + snimsum, /device, $ charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, optdev00, /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, optpos00, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, optdev01, /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, optpos01, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, optdev02, /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, optpos02, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, optdev03, /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, optpos03, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'CCD T BEG/END', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, sccdtemp1 + ' ' + sccdtemp2, /device, $ charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'YAW AVE/MIN/MAX', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, syaw_ave + ' ' + syaw_min + ' ' + syaw_max, $ /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'PITCH AVE/MIN/MAX', /device, $ charsize=cs, color=red XYOUTS, xoff, yloc - y1, spitchave + ' ' + spitchmin + ' ' + spitchmax, $ /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'OCP_ANGLE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, socp_ang, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'RCP_ANGLE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, srcp_ang, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'WLC_ANGLE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, swlc_ang, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'P-ANGLE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, ssolar_p0, /device, charsize=cs, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'NHP ANGLE', /device, charsize=cs, color=red XYOUTS, xoff, yloc - y1, scrota1, /device, charsize=cs, color=grey ;--- Create color bar array. collin = bindgen (256) collin = rebin (collin, 512) colbar = bytarr (512, 20) for i = 0, 19 DO $ colbar [*, i] = collin [*] ;--- Draw color bar. xc1 = xb + (xdim - 512) / 2 xc2 = xc1 + 511 yc1 = yb - 50 yc2 = yb - 30 tv, colbar, xc1, yc1 ;--- Draw border around color bar. plots, [xc1-1, yc1-1], /device, color=251 plots, [xc1-1, yc2+1], /device, color=251, /CONTINUE plots, [xc1-1+514, yc2+1], /device, color=251, /CONTINUE plots, [xc1-1+514, yc1-1], /device, color=251, /CONTINUE plots, [xc1-1, yc1-1], /device, color=251, /CONTINUE ;--- Draw tick marks below color bar. plots, [xc1, yc1- 3], /device, color=251 plots, [xc1, yc1-12], /device, color=251, /CONTINUE plots, [xc1+ 63, yc1- 3], /device, color=251 plots, [xc1+ 63, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+127, yc1- 3], /device, color=251 plots, [xc1+127, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+191, yc1- 3], /device, color=251 plots, [xc1+191, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+255, yc1- 3], /device, color=251 plots, [xc1+255, yc1-12], /device, color=251, /CONTINUE plots, [xc1+319, yc1- 3], /device, color=251 plots, [xc1+319, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+383, yc1- 3], /device, color=251 plots, [xc1+383, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+447, yc1- 3], /device, color=251 plots, [xc1+447, yc1- 7], /device, color=251, /CONTINUE plots, [xc2, yc1- 3], /device, color=251 plots, [xc2, yc1-12], /device, color=251, /CONTINUE ;--- Label color bar. XYOUTS, xc1 - x1 / 2, yc1 - 14 - y1, '0', /device, $ charsize=cs, color=251 XYOUTS, xc1 + 255 - 3*x1 / 2, yc1 - 14 - y1, '127', /device, $ charsize=cs, color=251 XYOUTS, xc1 + 512 - 3*x1 / 2, yc1 - 14 - y1, '255', /device, $ charsize=cs, color=251 END ;} RETURN ;} END