;
;+
;NAME:
;	disp_rot
;PURPOSE:
;	To display a single SFD image per day for a single month
;CALLING SEQUENCE:
;	.run disp_rot
;COMMENTS:
;	The first time that it is called, it will load a red color
;	table which is stretched to enhance the contrast.
;HISTORY:
;	Written 25-Mar-93 by M.Morrison
;-
;
;
ff = file_list('$DIR_SXT_SFM', 'sfm*')
rd_roadmap, ff, roadmap
break_file, ff, dsk_log, dir, filnam, ext
fid = strmid(filnam, 3, 6) + ext
tarr = fid2ex(fid)
months = strmid(fmt_tim(tarr), 3, 6)
;
qdone = 0
while not qdone do begin
    input, 'Enter the starting date (or QUIT or EXIT) ', st_date, '1-feb-92'
    if (strupcase(st_date) eq 'QUIT') then qdone = 1
    if (strupcase(st_date) eq 'EXIT') then qdone = 1
    ;
    if (not qdone) then begin
	    if (n_elements(disp_factor) eq 0) then disp_factor = 1.	;use disp_factor = 1.29 for ramtek
	    if (n_elements(char_factor) eq 0) then char_factor = 1.
	    nx = 6
	    ny = 7
	    siz = 128
	    win_xsiz = fix(nx*siz*disp_factor+.5)
	    win_ysiz = fix((ny*siz+25)*disp_factor)
	    qmake_window = 0
	    if (!d.window eq -1) then qmake_window = 1
	    if ((!d.x_size ne win_xsiz) or (!d.y_size ne win_ysiz)) then qmake_window=1
	    if (qmake_window) then begin
		case !d.name of
			'X': wdef, ws, win_xsiz, win_ysiz, /free, /ur
			'Z': device, set_res=[win_xsiz, win_ysiz]
			else: stop, 'Device not recognized'
		endcase
	    end
	    if (n_elements(qdisp_month_firsttime) eq 0) then begin
		qdisp_month_firsttime = 0
		restore, concat_dir('$DIR_SXT_SFM', 'idl_color.red_.3gamma')
		tvlct, r, g, b
	    end
	    erase

	    ist = tim2dset(roadmap, st_date+ ' 12:00')
	    for ix=0,nx-1 do for iy=0,ny-1 do begin
		day = roadmap(ist).day + ((ix*ny)+iy)*4
		ss = where(roadmap.day eq day)
		if (ss(0) ne -1) then begin
		    rd_xda, ff, ss, index, data, roadmap
		    x0 = (ix)*siz*disp_factor
		    y0 = (ny-1 - iy)*siz*disp_factor
		    tv, congrid(data, siz*disp_factor, siz*disp_factor, interp=0), x0, y0
		    xyouts, x0, y0, fmt_tim(index), /device, charsize=disp_factor*char_factor
		end
	    end
    end
end
;
end
