Previous: Binary Table Bit Format Columns
Up: Basic FITSIO Conventions
Next: Error Status Values
Previous Page: Binary Table Bit Format Columns
Next Page: Error Status Values

Data Scaling

When reading b,i,j,e, or d data values in the primary array (or a table column) the values will be scaled automatically by the BSCALE and BZERO (or TSCALnnn and TZEROnnn) header keyword values if they are present. The returned data will have

output value = (FITS value) * BSCALE + BZERO
(corresponding formula using TSCALnnn and TZEROnnn are used when reading from table columns). The ftpscl and fttscl subroutines may be used to override the scaling parameters defined in the header.

When writing b,i,j,e, or d data to the primary array or to a table column the data values may be scaled by defining the scaling parameters with the ftpscl and fttscl subroutines. Note that even if the BSCALE or TSCALnnn keywords are written to the FITS header, the ftpscl or fttscl subroutine still must be called to cause the data to be scaled as they are written to the FITS file. If scaling is performed, the scaled output value will have

FITS value = ((input value) - BZERO) / BSCALE
(corresponding formula using TSCALnnn and TZEROnnn are used when writing to table columns). Rounding to the nearest integer, rather than truncation, is performed when writing integer datatypes to the FITS file.

asterix@space.starlink
Wed Feb 16 08:18:45 GMT 1994