[fitsbits] TFORM=1D mixed with TDISP=I12 {External}

Francois-Xavier PINEAU francois-xavier.pineau at astro.unistra.fr
Mon Jun 23 08:23:29 EDT 2025


Dear Richard and FITSBITS,

In the FITS standard, section 7.3.4. "Data display" (in the Binary-table 
extension section):

Real data. If the table column contains real data (with
TFORMn = ’rE’, or ’rD’) or contains integer data (with any
of the TFORMn format codes listed in the previous paragraph),
which are recommended to be displayed as real values (i.e., es-
pecially in cases where the integer values represent scaled phys-
ical values using Eq. 7), then the TDISPn format code may have
any of these forms: Fw.d, Ew.dEe, Dw.dEe, ENw.d, or ESw.d.
In all cases, the output is a string of w characters including the
decimal point, any sign characters, and any exponent including
the exponent’s indicators, signs, and values. If the number of
digits required to represent the real datum exceeds w, then the
output field consists of a string of w asterisk (*) characters. In all
cases, d specifies the number of digits to appear to the right of
the decimal point.

In my understanding of the section, using TDISP=I12 with TFORM4=1D is 
not "legal",
so the "fitsverify" error seems coherent to me.

I wonder, why using a real value to store/display an integer?

I have another question, for FITS designers.
 From my perspective, TDISP is used for an ASCII display which is not 
supposed to be lossy
(except when truncating floats to remove (un)significant/useless digits 
due to numerical approximations).
Is it correct?
For a String, are there any use cases for which it makes sense to 
declare a TDISP with a width "w" smaller that "r",
the repeated count in "rA"?
I am asking because 'width' in VOTable seems to be inherited from FITS, 
and there are discussions on the meaning/intention behind
such an option (using TFORM r > TDISP w for Strings)...


François-Xavier Pineau




Le 23/06/2025 à 11:07, Richard J. Mathar via fitsbits a écrit :
> In the header of HDU 2 of the FITS file iter_c.fit of the source code of cfitsio,
> fitsverify complains about the mixture of
> TFORM4=1D and TDISP4=I12 :
>
> uname at comp:~/work/rpmbuild/cfitsio/cfitsio> fitsverify iter_c.fit
>   
>                fitsverify 4.22 (CFITSIO V4.050)
>                --------------------------------
>   
>   
> File: iter_c.fit
>
> 2 Header-Data Units in this file.
>   
> =================== HDU 1: Primary Array ===================
>   
>   9 header keywords
>   
>   Null data array; NAXIS = 0
>   
> =================== HDU 2: BINARY Table ====================
>   
> *** Error:   Keyword #89, TDISP4:  Format "I12" cannot be used for TFORM "1D".
>   
>   97 header keywords
>   
>   EVENTS(1)  (5 columns x 5000 rows)
>   
>   Col# Name (Units)       Format
>     1 X                    1I
>     2 Y                    1I
>     3 PHA                  1I
>     4 TIME                 1D
>     5 DY                   1I
>   
> ++++++++++++++++++++++ Error Summary  ++++++++++++++++++++++
>   
>   HDU#  Name (version)       Type             Warnings  Errors
>   1                          Primary Array    0         0
>   2     EVENTS (1)           Binary Table     0         1
>   
> **** Verification found 0 warning(s) and 1 error(s). ****
>
> Is this actually inconsistent?  That should be at most a warning, not an error, because
> the storage of the data in the floaing point format should not prevent to render them
> as (truncated) integers. fv actually displays the values as integers, as expected.
>
> _______________________________________________
> fitsbits mailing list
> fitsbits at listmgr.nrao.edu
> https://listmgr.nrao.edu/mailman/listinfo/fitsbits



More information about the fitsbits mailing list