idlastro / FITS I/O: FITS_INFO

[Source code]

NAME
FITS_INFO
PURPOSE
Provide information about the contents of a FITS file
EXPLANATION
Information includes number of header records and size of data array.
Applies to primary header and all extensions.    Information can be 
printed at the terminal and/or stored in a common block
This routine is mostly obsolete, and better results can be usually be
performed with FITS_HELP (for display) or FITS_OPEN (to read FITS 
information into a structure)
CALLING SEQUENCE
FITS_INFO, Filename, [ /SILENT , TEXTOUT = , N_ext =, EXTNAME= ]
INPUT
Filename - Scalar string giving the name of the FITS file(s)
          Can include wildcards such as '*.fits', or regular expressions 
          allowed by the FILE_SEARCH() function.     One can also search 
          gzip compressed  FITS files, but their extension must
          end in .gz or .ftz.
OPTIONAL INPUT KEYWORDS
/SILENT - If set, then the display of the file description on the 
           terminal will be suppressed
 TEXTOUT - specifies output device.
          textout=1        TERMINAL using /more option
          textout=2        TERMINAL without /more option
          textout=3        .prt
          textout=4        laser.tmp
          textout=5        user must open file, see TEXTOPEN
          textout=7       append to existing  file
          textout = filename (default extension of .prt)
          If TEXTOUT is not supplied, then !TEXTOUT is used
OPTIONAL OUTPUT KEYWORDS
The following keyowrds are for use when only one file is processed
N_ext - Returns an integer scalar giving the number of extensions in
        the FITS file
extname - returns a list containing the EXTNAME keywords for each
         extension.
COMMON BLOCKS
DESCRIPTOR =  File descriptor string of the form N_hdrrec Naxis IDL_type
        Naxis1 Naxis2 ... Naxisn [N_hdrrec table_type Naxis
        IDL_type Naxis1 ... Naxisn] (repeated for each extension) 
        For example, the following descriptor 
             167 2 4 3839 4 55 BINTABLE 2 1 89 5
        indicates that the  primary header containing 167 lines, and 
        the primary (2D) floating point image (IDL type 4) 
        is of size 3839 x 4.    The first extension header contains
        55 lines, and the  byte (IDL type 1) table array is of size
        89 x 5.
        The DESCRIPTOR is *only* computed if /SILENT is set.
EXAMPLE
Display info about all FITS files of the form '*.fit' in the current
        directory
        IDL> fits_info, '*.fit'
Any time a *.fit file is found which is *not* in FITS format, an error 
message is displayed at the terminal and the program continues
PROCEDURES USED
GETTOK(), MRD_SKIP, STRN(), SXPAR(), TEXTOPEN, TEXTCLOSE 
SYSTEM VARIABLES
The non-standard system variables !TEXTOUT and !TEXTUNIT will be  
created by FITS_INFO if they are not previously defined.   
DEFSYSV,'!TEXTOUT',1
DEFSYSV,'!TEXTUNIT',0
See TEXTOPEN.PRO for more info
MODIFICATION HISTORY
Written, K. Venkatakrishna, Hughes STX, May 1992
Added N_ext keyword, and table_name info, G. Reichert
Work on *very* large FITS files   October 92
More checks to recognize corrupted FITS files     February, 1993
Proper check for END keyword    December 1994
Correctly size variable length binary tables  WBL December 1994
EXTNAME keyword can be anywhere in extension header WBL  January 1998
Correctly skip past extensions with no data   WBL   April 1998
Converted to IDL V5.0, W. Landsman, April 1998
No need for !TEXTOUT if /SILENT D.Finkbeiner   February 2002
Define !TEXTOUT if needed.  R. Sterner, 2002 Aug 27
Work on gzip compressed files for V5.3 or later  W. Landsman 2003 Jan
Improve speed by only reading first 36 lines of header 
Count headers with more than 32767 lines         W. Landsman Feb. 2003
Assume since V5.3 (OPENR,/COMPRESS)   W. Landsman Feb 2004
EXTNAME keyword can be anywhere in extension header again 
                  WBL/S. Bansal Dec 2004
Read more than 200 extensions  WBL   March 2005
Work for FITS files with SIMPLE=F   WBL July 2005
Assume since V5.4, fstat.compress available WBL April 2006
Added EXTNAME as an IDL keyword to return values. M. Perrin Dec 2007
make Ndata a long64 to deal with large files. E. Hivon Mar 2008
For GDL compatibility, first check if file is compressed  before using
   OPENR,/COMPRESS  B. Roukema/WL    Apr 2010
Increased nmax (max number of extensions) from 400 to 2000   Sept 2012
Correctly fills EXTNAME when SILENT is set    EH   Jan 2013
Turned ptr to long64 for very large files EH Dec 2013
Replace 2880L with 2880LL for very large files  EH  Mar 2015
Let TEXTOPEN test for !TEXTOUT  WL Sep 2016