Skip to content

Error message for FITS table with too many columns #19236

@JonahDW

Description

@JonahDW

Same as #3187, writing a table with more than 999 columns to a FITS file yields an error like below

  File "/opt/anaconda/envs/py311/lib/python3.11/site-packages/astropy/table/connect.py", line 130, in __call__
    self.registry.write(instance, *args, **kwargs)
  File "/opt/anaconda/envs/py311/lib/python3.11/site-packages/astropy/io/registry/core.py", line 386, in write
    return writer(data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda/envs/py311/lib/python3.11/site-packages/astropy/io/fits/connect.py", line 470, in write_table_fits
    table_hdu.writeto(output)
  File "/opt/anaconda/envs/py311/lib/python3.11/site-packages/astropy/io/fits/hdu/base.py", line 1541, in writeto
    hdulist.writeto(name, output_verify, overwrite=overwrite, checksum=checksum)
  File "/opt/anaconda/envs/py311/lib/python3.11/site-packages/astropy/io/fits/hdu/hdulist.py", line 1029, in writeto
    self.verify(option=output_verify)
  File "/opt/anaconda/envs/py311/lib/python3.11/site-packages/astropy/io/fits/verify.py", line 128, in verify
    raise VerifyError("\n" + "\n".join(messages))
astropy.io.fits.verify.VerifyError: 
Verification reported errors:
HDU 1:
    'TFIELDS' card has invalid value '1304'.
Note: astropy.io.fits uses zero-based indexing.

From this it is however not clear at all what is actually going wrong. Perhaps when writing to a FITS table specifically there could be a check on the amount of columns, with a more explicit error message if the table has more than 999 columns.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions