MRD_HREAD
Name
MRD_HREAD
Purpose
Reads a FITS header from an opened disk file or Unix pipe
Explanation
Like FXHREAD but also works with compressed Unix files
Calling Sequence
MRD_HREAD, UNIT, HEADER [, STATUS, /SILENT, ERRMSG =, /FIRSTBLOCK ]
Inputs
UNIT = Logical unit number of an open FITS file
Outputs
HEADER = String array containing the FITS header.
OPT. OUTPUTS:
STATUS = Condition code giving the status of the read. Normally, this
is zero, but is set to -1 if an error occurs, or if the
first byte of the header is zero (ASCII null).
Optional Keyword Input
/FIRSTBLOCK - If set, then only the first block (36 lines or less) of
the FITS header are read into the output variable. If only
size information (e.g. BITPIX, NAXIS) is needed from the
header, then the use of this keyword can save time. The
file pointer is still positioned at the end of the header,
even if the /FIRSTBLOCK keyword is supplied.
/SILENT - If set, then warning messages about any invalid characters in
the header are suppressed.
/SKIPDATA - If set, then the file point is positioned at the end of the
HDU after the header is read, i.e. the following data block
is skipped. Useful, when one wants to the read the headers
of multiple extensions.
/NO_BADHEADER - if set, returns if FITS header has illegal characters
By default, MRD_HREAD replaces bad characters with blanks,
issues a warning, and continues.
Optional Output Parameter
ERRMSG = If this keyword is present, then any error messages will be
returned to the user in this parameter rather than
depending on the MESSAGE routine in IDL. If no errors are
encountered, then a null string is returned.
Restrictions
The file must already be positioned at the start of the header. It
must be a proper FITS file.
Side Effects
The file ends by being positioned at the end of the FITS header, unless
an error occurs.
Revision History
Written, Thomas McGlynn August 1995
Modified, Thomas McGlynn January 1996
Changed MRD_HREAD to handle Headers which have null characters
A warning message is printed out but the program continues.
Previously MRD_HREAD would fail if the null characters were
not in the last 2880 byte block of the header. Note that
such characters are illegal in the header but frequently
are produced by poor FITS writers.
Added /SILENT keyword W. Landsman December 2000
Added /FIRSTBLOCK keyword W. Landsman February 2003
Added ERRMSG, SKIPDATA keyword W. Landsman April 2009
Close file unit even after error message W.L. October 2010
Added /NO_BADHEADER Zarro (ADNET), January 2012