MRDFITS currently supports the following FITS data types:
MRDFITS is called as a function similar to the READFITS() utility, e.g.,
str = MRDFITS(file_or_unit, exten_no_or_name, [ header] )where file_or_unit is either a file name or the unit number of an open FITS file, exten_no_or_name is either the extension number to be read (0 for the primary data array), or the extension name (stored in the EXTNAME keyword), and header is an optional variable in which the header information will be stored. A number of optional keyword parameters are available.
For calls from other programs, MRDFITS has an output STATUS keyword to indicate whether it was successful. A status of >=0 indicates a successful read. The returned status value has the following meanings:
One known limitation of MRDFITS is that no special handling is done for NULL values.
Note that MRDFITS is not a FITS checker. It may read in files that are not proper FITS since only a few FITS elements needed by the reader are actually explicitly checked. MRDFITS should read in all correct FITS files and I would appreciate copies of any correct FITS files that break the reader.
MRDFITS uses the /COMPRESS keyword to OPENR to allow it to read gzip'ed files on any machine architecture. On Unix machines, MRDFITS can also read files compressed with `standard' Unix compress utility or the Linux bzip2 utility. MRDFITS assumes that files ending with .Z, .gz, .GZ and .bz2 are to be decompressed, but it also has the COMPRESS keyword so that the user can specify that any file is compressed.
The variable length array facility is a mechanism to save storage space, by allowing each row of an array to have a different length. MRDFITS has two ways of handling such variable length arrays. In the default (or /FIXED_VAR) method, the corresponding structure tag is dimensioned using the largest record. A new "length" column is then added, giving the actual length of each row of the variable length column. For example, suppose the fifth column in a binary table with 3000 rows is a variable length array named MATRIX, with a longest length of 27. The default structure created by MRDFITS would have a tag named MATRIX dimensioned 27 by 3000 containing the data, along with a tag named L5_MATRIX dimensioned LONARR(3000) containing the actual length (always less than or equal to 27) of each row of MATRIX. If the /POINTER_VAR keyword of MRDFITS is set, then the MATRIX tag is returned as an IDL pointer, and the data values for each row can be determined by dereferencing this pointer. For example,
IDL> help,*str(0).matrix
<PtrHeapVar18001>
DOUBLE = Array[14]
IDL> help,*str(1).matrix
<PtrHeapVar18014>
DOUBLE = Array[27]
Instead of a file name, MRDFITS() can be given the unit number of an already opened FITS file. In this case, the EXTEN_NO parameter gives the number of extensions to skip *from the current location in the FITS file*. The use of a unit number instead of a file name is more efficient when multiple extensions of a FITS file are to be read. For example, to process all extension in a FITS file starting with the third one, one might do the following:
lun=fxposit(filename, 3) ;Open a FITS file and move to extension 3 repeat begin thisHDU = mrdfits(lun, 0, hdr, status=status) ... process the HDU ... endrep until status lt 0MRDFITS comprises several files. The following procedures are included in the main file MRDFITS()