;+ ; NAME plot_fcorona ; ; FUNCTION Plot F-corona function. ; ; EXTERNALS fcorona.pro ; ; AUTHOR Andrew L. Stanger HAO/NCAR 3 November 2006 ;- PRO plot_fcorona nx = 480 ny = 480 fc = FLTARR (nx, ny) WINDOW, xsize=nx, ysize=ny, retain=2 red = bytarr (256) green = bytarr (256) blue = bytarr (256) lct, '/home/stanger/color/bwcp.lut' tvlct, red, green, blue, /get ; Read color table into arrays. ;--- Get stray light for each height. xcen = nx * 0.5 - 1.0 ycen = ny * 0.5 - 1.0 pixrs = nx / 8.0 dmin = 10 dmax = -10 FOR iy = 0, ny-1 DO $ BEGIN y = float (iy) FOR ix = 0, nx-1 DO $ BEGIN x = float (ix) ierr = rcoord (radius, angle, x, y, -1, 0.0, xcen, ycen, pixrs) ; if (ix EQ iy) THEN PRINT, 'ix/iy: ', ix, $ ; ' radius: ', radius, ' angle: ', angle fc [ix, iy] = fcorona (radius, angle) ; if (ix EQ iy) THEN PRINT, 'fc: ', fc [ix, iy] if (fc [ix, iy] LT 0.0) THEN fc [ix, iy] = 0.0 if (radius LT 1.0) THEN fc [ix, iy] = 0.0 if (dmin GT fc [ix, iy]) then dmin = fc [ix, iy] if (dmax LT fc [ix, iy]) then dmax = fc [ix, iy] END END PRINT, 'dmin/dmax: ', dmin, dmax ;--- Display image. slope = 250 / (dmax - dmin) offset = dmin fc_byte = fc * slope + offset ;fc_byte = BYTSCL (fc, min=dmin, max=dmax, top=249) TVSCL, fc_byte XYOUTS, 10, 10, 'SMM C/P F-CORONA MODEL', color=255, /DEVICE FOR iy = 0, ny-1 DO $ BEGIN FOR ix = 0, nx-1 DO $ BEGIN ; if (ix EQ iy) THEN PRINT, 'ix/iy: ', ix, ' fc_byte: ', fc_byte [ix, iy] END END ;PLOT, fc_byte [*, 240] ;--- Write image to a GIF file. gif_file = "fcorona.gif" img_gif = TVRD () WRITE_GIF, gif_file, img_gif, red, green, blue END