;+
; NAME: eis_read_fits_data.pro
;
; PURPOSE: To read solar-B status fits file archives.
;      
; CATEGORY: Engineering
;
; CALLING SEQUENCE: eis_read_fits_data, 'fits_archive', 'parameter_name', header_number
;
; INPUTS: fits_archive:   string of the status archive
;         parameter_name: string name of the status parameter
;         header_number:  unsigned short of the bintable extension
;
; KEYWORD PARAMETERS: None
;
; OUTPUTS: The status data for the parameter
;
; CALLS: fxbopen, fxbread, fxbclose
;
; COMMON BLOCKS: None
;
; PROCEDURE:
;
; RESTRICTIONS: Uses SolarSoft
;
; MODIFICATION HISTORY:
;	02/02/06 mcrw	wrote
;       17/03/06 mcrw
;       03/04/06 mcrw	modifications during thermal vacuum test
;       10/08/06 mcrw	stripped out unwanted code
;
;-------------------------------------------------------------------------------------------------

; Utility function to read a single housekeeping parameter with name
; 'parameter' from the FITS file 'file' in header record 'header_number'.
; No checking - the parameter must exist in this header in this file.
pro eis_get_status_data, file, data, parameter, header_number, stime, etime
    eis_fxbopen, lun, file, header_number, header
    fxbread, lun, pdata, parameter
    fxbclose, lun
    free_lun, lun
    data = pdata
    basetime = fxpar(header, 'UT_START',count=count)
    if count eq 0 then begin
        basetime = fxpar(header, 'DATE_OBS')
    endif
    endtime = fxpar(header, 'UT_END',count=count)
    if count eq 0 then begin
        endtime = fxpar(header, 'DATE_END')
    endif
    stime = basetime
    etime = endtime
end

