;+ ; NAME fparplot.pro ; ; PURPOSE Plot a parameter vs time in a sequence of FITS files. ; ; SYNTAX fparplot, 'list' ; ; list file containing a list of FITS images. ; wmin display minimum value. ; wmax display maximum value. ; cm color map file name. ; ; EXAMPLES fparplot, 'list' ; ; EXTERNAL ; readfits ; ; HISTORY Andrew L. Stanger HAO/NCAR 2 June 2003 ;- PRO fparplot, fits_list, wmin=wmin, wmax=wmax, cm=cm ;{ ;--- Load color map. lct, '/home/stanger/color/bwy.lut' ; Load default color map. IF (KEYWORD_SET (cm)) THEN $ lct, cm set_plot, 'Z' red = bytarr (256) green = bytarr (256) blue = bytarr (256) tvlct, red, green, blue, /GET ; Fetch RGB color look-up tables. month_name = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', $ 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] CLOSE, 11 fits_name = '' index = 0 ;--- Count the number to images files. OPENR, 11, fits_list WHILE (NOT EOF (11)) DO $ BEGIN ;{ READF, 11, fits_name IF (index EQ 0) THEN $ BEGIN img = readfits (fits_name, hdu, /noscale) telescop = STRLOWCASE (STRTRIM (fxpar (hdu, 'TELESCOP'), 2)) date = fxpar (hdu, 'DATE-OBS') END index = index + 1 ENDWHILE ;} nimg = index doytab = FLTARR (nimg) o1xtab = FLTARR (nimg) o1ytab = FLTARR (nimg) doymin = 1000.0 doymax = -1000.0 o1xmin = 1.0E+10 o1xmax = -1.0E+10 o1ymin = 1.0E+10 o1ymax = -1.0E+10 CLOSE, 11 syear = STRTRIM (STRMID (date, 0, 4), 2) smonth = STRTRIM (STRMID (date, 5, 2), 2) iyear = FIX (syear) imonth = FIX (smonth) month = STRTRIM (month_name [imonth - 1], 2) textname = telescop + '.' + month + syear + '.txt' print, 'textname: ', textname CLOSE, 12 OPENW, 12, textname PRINTF, 12, 'MLSO/CHIP O1 x & y axis positions' PRINTF, 12, '' PRINTF, 12, 'Date DOY o1x o1y' PRINTF, 12, '-----------------------------------------------------' ;--- Image list loop. index = 0 OPENR, 11, fits_list WHILE (NOT EOF (11)) DO $ BEGIN ;{ ;--- Read FITS image header & pixel data. READF, 11, fits_name ; Get file name. PRINT, 'fits_name: ', fits_name ;--- Read FITS image & extension. img = readfits (fits_name, hdu, /noscale) ext = readfits (fits_name, hduext, /noscale, exten_no=1) telescop = STRLOWCASE (STRTRIM (fxpar (hdu, 'TELESCOP'), 2)) date = fxpar (hdu, 'DATE-OBS') time = fxpar (hdu, 'TIME-OBS') syear = STRMID (date, 0, 4) smonth = STRMID (date, 5, 2) sday = STRMID (date, 8, 2) shour = STRMID (time, 0, 2) sminute = STRMID (time, 3, 2) ssecond = STRMID (time, 6, 2) iyear = FIX (syear) imonth = FIX (smonth) iday = FIX (sday) ihour = FIX (shour) iminute = FIX (sminute) isecond = FIX (ssecond) hour = FLOAT (ihour) + iminute / 60.0 + isecond / 3600.0 dayfrac = hour / 24.0 doy = FLOAT (day_of_year (iyear, imonth, iday)) + dayfrac IF (doy LT doymin) THEN doymin = doy IF (doy GT doymax) THEN doymax = doy o1x = fxpar (hduext, 'MIC01') o1y = fxpar (hduext, 'MIC02') IF (o1x LT o1xmin) THEN o1xmin = o1x IF (o1x GT o1xmax) THEN o1xmax = o1x IF (o1y LT o1ymin) THEN o1ymin = o1y IF (o1y GT o1ymax) THEN o1ymax = o1y print, 'index: ', index, ' doy: ', doy, ' o1x/o1y: ', o1x, o1y printf, 12, date + ' ' + time, ' doy: ', doy, ' o1x/o1y: ', o1x, o1y doytab [index] = doy o1xtab [index] = o1x o1ytab [index] = o1y index = index + 1 ENDWHILE ;} CLOSE, 12 doy1 = FLOAT (FIX (doymin)) doy2 = FLOAT (FIX (doymax) + 1) print, 'doy1/doy2: ', doy1, doy2 print, 'o1xmin/o1xmax: ', o1xmin, o1xmax print, 'o1ymin/o1ymax: ', o1ymin, o1ymax print, 'doytab: ' print, doytab print, 'o1xtab: ' print, o1xtab print, 'o1ytab: ' print, o1ytab ptitlex = telescop + ' O1 X-axis vs. Time ' + ' year ' + syear ptitley = telescop + ' O1 Y-axis vs. Time ' + ' year ' + syear PLOT, doytab, o1xtab, $ title=ptitlex, $ xtitle='Day-Of-Year', $ ytitle='O1 x-axis', $ xrange = [doy1, doy2], $ yrange = [o1xmin, o1xmax], $ psym=5 pimg = TVRD () gifname = telescop + '.o1x.' + month + syear + '.gif' print, 'gifname: ', gifname WRITE_GIF, gifname, pimg, r, g, b ;STOP PLOT, doytab, o1ytab, $ title=ptitley, $ xtitle='Day-Of-Year', $ ytitle='O1 y-axis', $ xrange = [doy1, doy2], $ yrange = [o1ymin, o1ymax], $ psym=5 pimg = TVRD () gifname = telescop + '.o1y.' + month + syear + '.gif' print, 'gifname: ', gifname WRITE_GIF, gifname, pimg, r, g, b SET_PLOT, 'X' END ;}