;+ ; NAME fits_annotate_cp.pro ; ; PURPOSE Annotate a FITS image. ; ; SYNTAX fits_annotate, 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 ; 28 Dec 2005: update for SMM C/P. ;- PRO fits_annotate_cp, hdu, xdim, ydim, xb, yb, wmin=wmin, wmax=wmax print, '*** fits_annotate_cp ***' ;--- Character sizes: xoff = 2 yoff = 2 x1 = 7 x2 = 10 x3 = 7 y1 = 9 y2 = 12 y3 = 10 xend = xdim + xb - x1 yend = ydim + yb - y1 cfac = 1.0 IF (STRLOWCASE (!version.os) EQ 'irix') THEN cfac = 1.0 IF (STRLOWCASE (!version.os) EQ 'sunos' ) THEN cfac = 2.0 cs1 = cfac * 1.0 ; character size cs2 = cfac * 1.4 x1 = FIX (x1 * cs1 + 0.5) x2 = FIX (x2 * cs2 + 0.5) x3 = FIX (x3 * cs1 + 0.5) y1 = FIX (y1 * cs1 + 0.5) y2 = FIX (y2 * cs2 + 0.5) y3 = FIX (y3 * cs1 + 0.5) ;--- 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) object = fxpar (hdu, 'OBJECT') type_obs = fxpar (hdu, 'TYPE-OBS') origin = fxpar (hdu, 'ORIGIN') date_obs = fxpar (hdu, 'DATE-OBS') time_obs = fxpar (hdu, 'TIME-OBS') xcen = fxpar (hdu, 'CRPIX1') ycen = fxpar (hdu, 'CRPIX2') crradius = fxpar (hdu, 'CRRADIUS') bunit = fxpar (hdu, 'BUNIT') 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) scroll = fxpar (hdu, 'SCROLL') pixrs = crradius ;--- Annotate image. yloc = yend - yoff XYOUTS, xoff, yloc, 'DATE', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, date_obs, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'TIME', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, time_obs + ' UT',/device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'TELESCOPE', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, telescop, /device, charsize=cs2, color=grey yloc = yloc - y2 - y2 - y3 XYOUTS, xoff, yloc, 'INSTRUMENT', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, instrume, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'OBJECT', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, object, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'TYPE-OBS', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, type_obs, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DATA FORM', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, dataform, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DATA MIN', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, datamin, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DATA MAX', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, datamax, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DISP MIN', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, dispmin, /device, charsize=cs2, color=grey yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'DISP MAX', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, dispmax, /device, charsize=cs2, 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=cs1, color=red XYOUTS, xoff, yloc - y2, wmin, /device, charsize=cs2, color=grey END IF (KEYWORD_SET (wmax)) THEN $ BEGIN yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'WMAX', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, wmax, /device, charsize=cs2, color=grey END yloc = yloc - y1 - y2 - y3 XYOUTS, xoff, yloc, 'BRIGHTNESS UNIT', /device, charsize=cs1, color=red XYOUTS, xoff, yloc - y2, bunit, /device, charsize=cs2, color=grey ; --- Draw sun circle. gMINCOL = xb gMAXCOL = xb + xdim - 1 gMINROW = yb gMAXROW = yb + ydim - 1 radius = 1.0 angmin = 0.0 angmax = 360.0 anginc = 10.0 suncir_cp, radius, angmin, angmax, anginc, cindex, $ xcen, ycen, pixrs, scroll, $ gMINCOL, gMAXCOL, gMINROW, gMAXROW ; --- Draw radial lines. rmin = 1.0 rmax = 1.5 rinc = 0.2 anginc = 30.0 sunray, rmin, rmax, rinc, anginc, xcen, ycen, pixrs, scroll, cindex, $ gMINCOL, gMAXCOL, gMINROW, gMAXROW ;--- Draw north pointer. cirrad = 1.0 tiprad = 0.3 cindex = 250 cp_north, xcen, ycen, pixrs, scroll, cirrad, tiprad, cindex, $ gMINCOL, gMAXCOL, gMINROW, gMAXROW ;--- Create color bar array. collin = bindgen (256) collin = rebin (collin, 512) colbar = bytarr (512, 12) for i = 0, 11 DO $ colbar [*, i] = collin [*] ;--- Draw color bar. xc1 = xb + (xdim - 256) / 2 xc2 = xc1 + 256 yc1 = yb - 50 yc2 = yb - 30 xc1 = 127 xc2 = 638 yc1 = 20 yc2 = 31 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- 7], /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- 7], /device, color=251, /CONTINUE plots, [xc1+319, yc1- 3], /device, color=251 plots, [xc1+319, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+382, yc1- 3], /device, color=251 plots, [xc1+382, 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- 7], /device, color=251, /CONTINUE ;--- Label color bar. XYOUTS, xc1 - x1 / 2, yc1 - 9 - y1, '0', /device, $ charsize=cs1, color=green XYOUTS, xc1 + 127 - 2*x1 / 2, yc1 - 9 - y1, '63', /device, $ charsize=cs1, color=green XYOUTS, xc1 + 255 - 3*x1 / 2, yc1 - 9 - y1, '127', /device, $ charsize=cs1, color=green XYOUTS, xc1 + 383 - 3*x1 / 2, yc1 - 9 - y1, '191', /device, $ charsize=cs1, color=green XYOUTS, xc1 + 512 - 6*x1 / 2, yc1 - 9 - y1, '255', /device, $ charsize=cs1, color=green RETURN END