>  Docs Center  >  Libraries  >  ASTROLIB  >  CHECK_FITS






      Check that keywords in a FITS header array match the associated data


      Given a FITS array IM, and a associated FITS header HDR, this
      procedure will check that
              (1) HDR is a string array, and IM is defined and numeric
              (2) The NAXISi values in HDR are appropriate to the dimensions
                  of IM
              (3) The BITPIX value in HDR is appropriate to the datatype of IM
      If the /UPDATE keyword is present, then the FITS header will be
      modified, if necessary, to force agreement with the image array

Calling Sequence

      check_FITS, im, hdr, [ dimen, idltype, /UPDATE, /NOTYPE, /SILENT
                              ERRMSG = ]'

Input Parameters

      IM - FITS array, e.g. as read by READFITS
      HDR - FITS header (string array) associated with IM

Optional Outputs

      dimen - vector containing actual array dimensions
      idltype- data type of the FITS array as specified in the IDL SIZE
              function (1 for BYTE, 2 for INTEGER*2, 3 for INTEGER*4, etc.)

Optional Keyword Inputs

      /NOTYPE - If this keyword is set, then only agreement of the array
              dimensions with the FITS header are checked, and not the
              data type.
      /UPDATE - If this keyword is set then the BITPIX, NAXIS and NAXISi
              FITS keywords will be updated to agree with the array
      /FITS, /SDAS - these are obsolete keywords that now do nothing
      /SILENT - If keyword is set and nonzero, the informational messages
              will not be printed

Optional Keyword Output

      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.


      Program checks the NAXIS and NAXISi keywords in the header to
      see if they match the image array dimensions, and checks whether
      the BITPIX keyword agrees with the array type.

Procedure Calls


Modification History

      Written, December 1991 W. Landsman Hughes/STX to replace CHKIMHD
      No error returned if NAXIS=0 and IM is a scalar W. Landsman Feb 93
      Fixed bug for REAL*8 STSDAS data W. Landsman July 93
      Make sure NAXIS agrees with NAXISi W. Landsman October 93
        Converted to IDL V5.0 W. Landsman September 1997
      Allow unsigned data types W. Landsman December 1999
      Allow BZERO = 0 for unsigned data types W. Landsman January 2000
      Added ERRMSG keyword, W. Landsman February 2000
      Use FXADDPAR to put NAXISi in proper order W. Landsman August 2000
      Improper FXADDPAR call for DATATYPE keyword W. Landsman December 2000
      Remove explicit setting of obsolete !err W. Landsman February 2004
      Remove SDAS support W. Landsman November 2006
      Fix dimension errors introduced Nov 2006
      Work again for null arrays W. Landsman/E. Hivon May 2007
      Use V6.0 notation W.L. Feb. 2011

© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us