Skip to content

Invalid TRPOS<n> keyword generated for FITS time column #8773

@taldcroft

Description

@taldcroft

It appears that in simple cases the Time FITS machinery is generating a blank value for the TRPOS<n> keyword that specifies location. I think for no location this keyword should be removed. This came up in https://github.com/astropy/astropy/pull/8754/files#r287430548.

In [14]: tm = Time(['2001-01-01'])
In [15]: t = Table([tm])
In [16]: t.write('time.fits', overwrite=True)
In [17]: !fitsheader time.fits
# HDU 0 in time.fits:
SIMPLE  =                    T / conforms to FITS standard                      
BITPIX  =                    8 / array data type                                
NAXIS   =                    0 / number of array dimensions                     
EXTEND  =                    T                                                  

# HDU 1 in time.fits:
XTENSION= 'BINTABLE'           / binary table extension                         
BITPIX  =                    8 / array data type                                
NAXIS   =                    2 / number of array dimensions                     
NAXIS1  =                   16 / length of dimension 1                          
NAXIS2  =                    1 / length of dimension 2                          
PCOUNT  =                    0 / number of group parameters                     
GCOUNT  =                    1 / number of groups                               
TFIELDS =                    1 / number of table fields                         
TIMESYS = 'UTC     '           / Default time scale                             
JDREF   =                  0.0 / Time columns are jd = jd1 + jd2                
TREFPOS = 'TOPOCENTER'         / Time reference position                        
TTYPE1  = 'col0    '                                                            
TFORM1  = '2D      '                                                            
TUNIT1  = 'd       '                                                            
TCTYP1  = 'UTC     '                                                            
TCUNI1  = 'd       '                                                            
TRPOS1  =                                                                       

In [18]: t2 = Table.read('time.fits', astropy_native=True)
WARNING: VerifyWarning: Invalid keyword for column 1: Time coordinate reference position option (TRPOSn) must be a string (got <astropy.io.fits.card.Undefined object at 0x119711198>). The invalid keyword will be ignored for the purpose of formatting this column. [astropy.io.fits.column]

@aaryapatil ??

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions