;
;==========================================================================
;
; FILE: qview_demo.pro
;
; USAGE: qview_demo, filename
;        ARGUMENTS    filename   Name of UF disk file
;
; ABSTRACT:  Demonstration program to read a relative power field and 
;          display
;
; AUTHOR:  I. Jeff Caylor
;          Science Systems and Applications, Inc.
;          5900 Princess Garden Parkway, Suite 300
;          Lanham, MD  20706
;
;     at:  NASA Goddard Space Flight Center
;          Code 912
;          Greenbelt, MD 20771
;          Voice: (301) 286-3767
;          Fax:   (301) 286-1762
;          Email: jeff.caylor@gsfc.nasa.gov
;
; CREATED: 10 April 1995
;
; MODIFIED: 11 April 1995 - IJC
;           Changed rotate code from 2 to 7
;           13 July 1998  -LT
;           Change count field to relative power field (no cuont field)
;
;==========================================================================
;
PRO qview_demo, filename
  PRINT, 'Reading file: ', filename
  OPENR, infile, filename, /GET_LUN
;
  counts = fltarr(1500, 729)
;
  i = 0
  WHILE (EOF(infile) NE 1)  DO  BEGIN
    UF_read_dwell, infile, ufbuf, /RDSS
;
;   Extract nadir count data from the UF buffer
;help, i
    UFnameddata, ufbuf, 'pn', nc, ngates, ERROR = status
    counts(i, 0 : ngates - 1) = nc
    print, UFstrtime(ufbuf), UFdwell(ufbuf), UFedop_ins_altitude(ufbuf), $
           UFedop_ins_latitude(ufbuf), UFedop_ins_longitude(ufbuf), ngates
    i = i + 1
  ENDWHILE
  CLOSE, infile
  FREE_lun, infile
;
; Trim array and rotate
;
  counts = counts(0 : i - 1, 0 : ngates - 1)
;  counts = rotate(counts, 7)
;
; Display
;
  image_cont, counts
END
