[fitsbits] Output array type when BZERO is an integer {External}

William Pence wdpence2000 at yahoo.com
Tue Mar 12 15:04:35 EDT 2024


For some  unknown reason fitsbits has been failing to receive and rebroadcast a couple of my emails to it.   For the historical record, here is a repeat of what I sent yesterday afternoon .  Sorry for the this appearing out of sequence:


The FITS standard explicitly defines the datatype of every keyword in the document, and in particular the BZERO keyword “SHALL contain a floating point number” (section 4.4.2.5).  Note also that FITS follows the Fortran numerical notation, so in the case of floating point numbers the decimal point is optional if there is no fractional part to the number.  In that case a floating point value is indistinguishable from an integer value (section 4.2.4).

CFITSIO was designed to allow the calling C or Fortran program to specify whatever datatype it wants when reading data from a FITS file.  Regardless of the intrinsic datatype of the data in the FITS file, CFITSIO will convert it on the fly to whatever the program requests.  For example, even if a FITS image has an intrinsic 16-bit integer datatype, the application program may want the pixel values returned in a floating point array for further data processing.  Similarly when writing data to a FITS file, CFITSIO will convert the datatype of the input data if necessary to conform to the FITS datatype.  

IMHO, it is unnecessary (and maybe even  inappropriate) to make recommendations in the Standards document about how integer values should be converted to single or double floats in various circumstances. 

In regard to a couple suggestions that it may be time to update the FITS Standard document, note that the last update was recently completed in 2018, after a painstaking 2 year process lead by Malcolm Currie and Lucio Chiappetti. A summary of the mainly typographical changes is given in Appendix H.4. 

Since the time of the last update at least 3 relatively minor factual discrepancies in the document have been pointed out. Perhaps the FITS governing bodies should establish and maintain an Official Errata List. 

Bill





More information about the fitsbits mailing list