;+
;NAME:
; hsi_obs_summ_inp
;PURPOSE:
; Reads the HESSI observing summary from a fits file
;CALLING SEQUENCE
; hsi_obs_summ_inp, filename, obs_summary
;INPUT:
; filename = the FITS file containing the summary
;OUTPUT:
;HISTORY:
; 8-feb-1999, jmm, jimm@ssl.berkeley.edu
; 10-feb-1999, jmm, Pointers in obs_summary
; 30-mar-1999, jmm, Add ephemeris
; 13-apr-1999, jmm, Changed structures...
;-
PRO Hsi_obs_summ_inp, filename, obs_summary

;Ok, first deal with the file
   filex = findfile(filename, count = bb)
   IF(bb EQ 0) THEN BEGIN
      message, /info, filename+' NOT Found, Bye...'
      RETURN
   ENDIF
   filex = filex(0)

;Open and get the ID and n_summaries
   fxbopen, unit0, filex, 'HESSI OBS SUMMARY ID TABLE', h00
   ncols = 2
   fxbread, unit0, summary_id, 1, 1
   summary_id = strtrim(summary_id, 2)
   fxbread, unit0, n_summaries, 2, 1
   fxbclose, unit0
   
;Ok, that's it, you now have a file, read it...
   hsi_obs_summ_info_fxbr, filex, info
   hsi_obs_summ_data_fxbr, filex, data
   hsi_data_gap_fxbr, filex, data_gaps
   hsi_ephemeris_fxbr, filex, ephemeris

;Create the structure, and fill the pointers
   obs_summary = {hsi_obs_summ}
   obs_summary.summary_id = summary_id
   obs_summary.n_summaries = n_summaries
   ptr_free, obs_summary.info_ptr
   obs_summary.info_ptr = ptr_new(info)
   ptr_free, obs_summary.data_ptr
   obs_summary.data_ptr = ptr_new(data)
   ptr_free, obs_summary.data_gap_ptr
   obs_summary.data_gap_ptr = ptr_new(data_gaps)
   ptr_free, obs_summary.ephemeris_ptr
   obs_summary.ephemeris_ptr = ptr_new(ephemeris)

;And that should be it
   RETURN
END

      
      
