idlastro / Disk I/O (e.g. IRAF files): IRAFRD

[Source code]

NAME
IRAFRD
PURPOSE
Read an IRAF (.imh) file into IDL image and header arrays.
EXPLANATION
The internal IRAF format changed somewhat in IRAF V2.11 to a machine
independent format, with longer filename allocations.  This version 
of IRAFRD should be able to read either format. 
CALLING SEQUENCE
IRAFRD, im, hdr, filename, [/SILENT ]  
OPTIONAL INPUT
FILENAME -  Character string giving the name of the IRAF image 
        header.  If omitted, then program will prompt for the 
        file name.  IRAFRD always assumes the header file has an 
        extension '.imh'.    IRAFRD will automatically locate the
        ".pix" file containing the data by parsing the contents of 
        the .imh file.   (If the parse is unsuccesful, then IRAFRD looks
        in the same directory as the .imh file.)
OUTPUTS
IM - array containing image data
HDR - string array containing header.  Basic information in the
        IRAF header is converted to a FITS style header
OPTIONAL INPUT KEYWORDS
/SILENT  - If this keyword is set and non-zero, then messages displayed
        while reading the image will be suppressed.  
RESTRICTIONS
(1)  Image size and history sections of the IRAF header are copied 
        into the FITS header HDR.  Other information (e.g. astrometry)
        might not be included unless it is also in the history section
(2)  IRAFRD ignores the node name when deciphering the name of the
        IRAF ".pix" file.
(3)  Certain FITS keywords ( DATATYPE, IRAFNAME) may appear more than
        once in the output name
(4)  Does not read the DATE keyword for the new (V2.11) IRAF files
NOTES
IRAFRD obtains dimensions and type of image from the IRAF header.
PROCEDURES CALLED
FDECOMP, SXADDPAR, SXPAR()
MODIFICATION HISTORY
Written W. Landsman, STX January 1989
Converted to IDL Version 2.  M. Greason, STX, June 1990
Updated for DecStation compatibility   W. Landsman   March 1992
Don't leave an open LUN  W. Landsman   July 1993
Don't overwrite existing OBS-DATE  W. Landsman  October 1994
Don't bomb on very long FITS headers W. Landsman  April 1995
Work on Alpha/OSF and Linux      W. Landsman     Dec 1995
Remove /VMSIMG keyword, improve efficiency when physical and
        image dimensions differ   W. Landsman     April 1996
Don't use FINDFILE (too slow)     W. Landsman     Oct 1996
Read V2.11 files, remove some parameter checks W. Landsman Nov. 1997
Fixed problem reading V2.11 files with long headers Jan. 1998
Accept names with multiple extensions    W. Landsman   April 98 
Test for big endian machine under V2.11 format W. Landsman Feb. 1999
Don't read past the end of file for V5.4 compatilibity  W.L.  Jan. 2001
Convert to square brackets W.L   May 2001
Assume since V5.4, remove SPEC_DIR()   W. L.   April 2006