Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  Libraries  >  ASTROLIB  >  FITS_TEST_CHECKSUM

FITS_TEST_CHECKSUM

FITS_TEST_CHECKSUM

Name


    FITS_TEST_CHECKSUM()

Purpose


    Verify the values of the CHECKSUM and DATASUM keywords in a FITS header

Explanation


    Follows the 2007 version of the FITS checksum proposal at
    http://fits.gsfc.nasa.gov/registry/checksum.html
 

Calling Sequence


    result = FITS_TEST_CHECKSUM(HDR, [ DATA, ERRMSG=, /FROM_IEEE ])

Inputs


    HDR - FITS header (vector string)
  OPTIONAL DATA:
    DATA - data array associated with the FITS header. An IDL structure is
          not allowed. If not supplied, or
          set to a scalar, then there is assumed to be no data array
          associated with the FITS header.

Result


    An integer -1, 0 or 1 indicating the following conditions:
          1 - CHECKSUM (and DATASUM) keywords are present with correct values
          0 - CHECKSUM keyword is not present
          -1 - CHECKSUM or DATASUM keyword does not have the correct value
              indicating possible data corruption.

Optional Input Keyword


    /FROM_IEEE - If this keyword is set, then the input is assumed to be in
            big endian format (e.g. an untranslated FITS array). This
            keyword only has an effect on little endian machines (e.g.
            a Linux box).

Optional Output Keyword


    ERRMSG - will contain a scalar string giving the error condition. If
              RESULT = 1 then ERRMSG will be an empty string. If this
              output keyword is not supplied, then the error message will be
              printed at the terminal.

Notes


    The header and data must be *exactly* as originally written in the FITS
    file. By default, some FITS readers may alter keyword values (e.g.
    BSCALE) or append information (e.g. HISTORY or an inherited primary
    header) and this will alter the checksum value.

Procedures Used


    CHECKSUM32, FITS_ASCII_ENCODE(), SXPAR()

Example


    Verify the CHECKSUM keywords in the primary header/data unit of a FITS
    file 'test.fits'
    FITS_READ,'test.fits',data,hdr,/no_PDU,/NoSCALE
    print,FITS_TEST_CHECKSUM(hdr,data)
    Note the use of the /No_PDU and /NoSCALE keywords to avoid any alteration
    of the FITS header

Revision History


    W. Landsman SSAI December 2002
    Return quietly if CHECKSUM keywords not found W. Landsman May 2003
    Add /NOSAVE to CHECKSUM32 calls when possible W. Landsman Sep 2004



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us