Identifier   write_fitstable
 
 Purpose      Write an IA struct as a FITS table file
 
 Synopsis     write_fitstable, IAstruct, filename [, blocksize=blocksize]
 
 Arguments    Name        I/O  Type:    Description:
              ------------------------------------------------------------
              IAstruct     I   struct   IA structure (SPD, ERD, AAR, etc.)
              filename     I   string   Name of a FITS file
              blocksize    I   integer  Size of a block

 Returns      --
 
 Description  A FITS file is created and the contents of an IA struct is written
              to it.  The header of the IA struct should be the header for a
              FITS binary table. The validity of this header is not checked.
 
 Comment      Only binary FITS tables can be written and its up to
              the user to supply an IA struct that contains a valid
              header for a binary FITS table.

              Currently only calibration structures can be sensibly written.
              The current default blocksize is set to 512 because
              otherwise the resulting file can't be read by FITSIO.
              AFAIK the default should be set to 2880 ...
 
 Example      cal13 = readcal('cal13')       ; Create and read a calstruct
              write_fitstable, cal13, 'mycal13.fits'
 
 Category     I/O
 
 Filename     write_fitstable.pro (module: write_fitstable)
 
 Author       D.R.Boxhoorn
 
 Version      2.9
 
 History      1.0  11-08-94 DRB Created from scratch
              1.1  30-09-94 DRB IAstruct is no longer being written to
              1.2  10-10-94 DRB Keyword blocksize added
                                Open files in blocks of 512 bytes
                                Longints have to be longswapped ...
              1.3  13-10-94 DRB Default blocksize is 2880 again
              1.4  17-10-94 DRB NAXIS2 is set equal to the number
                                of rows before writing the header
              1.5  17-10-94 DRB Handle multi-dimensional data (CAL08 f.e.)
              1.6  06-03-95 DRB Do not byteswap LONGs under UNIX
              1.7  10-04-95 EkW Add string handling for intermediate
                                products (might be generalized in the 
                                future by extracting necessary informations
                                from header)
              1.8  28-04-95 HB  Unified header
              1.9  27-06-95 NS  Add structure type
              1.10 30-06-95 DRB Give error for headerless structures
              1.11 03-07-95 DRB Completely undo changes done in version 1.9
              2.0  13-07-95 DRB Added SPD. inserted is_fppeakpos, is_fluxtab
              2.1  13-07-95 DRB Resulting filelength is EXACT multiple of 2880
              2.2  14-07-95 DRB Do not write struct with STRING of wrong size
              2.3  26-07-95 DRB Add timestamp
              2.4  08-11-95 EkW Adapt to new AAR structure
              2.5  30-11-95 NS  Adapt to AAR structure with spare tag
              2.6  01-11-95 DRB Put NAXIS2 in the secondary header
              2.7  05-12-95 DRB Handle 2-dimensional structures properly
              2.8  19/11/96 ++rh Adapted to TIMEDEP structure
              2.9  17-03-97 EkW include glitchlist