Calling Sequence

Inputs

FILENAME/FCB = Scalar string containing either the name of the FITS file
to be modified, or the IO file control block returned after
opening the file with FITS_OPEN,/UPDATE. The explicit
use of FITS_OPEN can save time if many extensions in a
single file will be updated.
DATA - data array to be inserted into the FITS file. Set DATA = 0
to leave the data portion of the FITS file unmodified. Data
can also be an IDL structure (e.g. as returned by MRDFITS).
provided that it does not include IDL pointers.
HEADER - FITS header (string array) to be updated in the FITS file.

Optional Input Keywords

A specific extension can be specified with either the EXTNAME or
EXTEN_NO keyword

EXTEN_NO - scalar integer specifying the FITS extension to modified. For
example, specify EXTEN = 1 or /EXTEN to modify the first
FITS extension.
EXTNAME - string name of the extension to modify.

Optional Output Keyword

ERRMSG - If this keyword is supplied, then any error mesasges will be
returned to the user in this parameter rather than depending on
on the MESSAGE routine in IDL. If no errors are encountered
then a null string is returned.

Notes

Uses the BLKSHIFT procedure to shift the contents of the FITS file if
the new data or header differs in size by more than 2880 bytes from the
old data or header. If a file control block (FCB) structure is
supplied, then the values of START_HEADER, START_DATA and NBYTES may
be modified if the file size changes.
Also see the procedures FXHMODIFY to add a single FITS keyword to a
header in a FITS files, and FXBGROW to enlarge the size of a binary
table.

Restrictions

(1) Cannot be used to modify the data in FITS files with random
groups or variable length binary tables. (The headers in such
files *can* be modified.)
(2) If a data array but no FITS header is supplied, then MODFITS does
not check to make sure that the existing header is consistent with
the new data.
(3) Does not work with compressed files
(4) The Checksum keywords will not be updated if the array to be
updated is supplied as a structure (e.g. from MRDFITS).