esheldon / fitsio

A python package for FITS input/output wrapping cfitsio
GNU General Public License v2.0
133 stars 57 forks source link

weird error with big columns #327

Open beckermr opened 3 years ago

beckermr commented 3 years ago

I cannot tell if this is a cfitsio error or something else, but here it is:

import fitsio
import numpy as np

d = np.ones(1, dtype=[("blah", "S35000")])

fitsio.write("test.fits", d, clobber=True)

produces

Traceback (most recent call last):
  File "test_fitsio_bug.py", line 6, in <module>
    fitsio.write("test.fits", d, clobber=True)
  File "/gpfs02/astro/workarea/beckermr/miniconda3/envs/des-y6a2-test2/lib/python3.8/site-packages/fitsio/fitslib.py", line 396, in write
    fits.write(
  File "/gpfs02/astro/workarea/beckermr/miniconda3/envs/des-y6a2-test2/lib/python3.8/site-packages/fitsio/fitslib.py", line 702, in write
    self.write_table(data, units=units,
  File "/gpfs02/astro/workarea/beckermr/miniconda3/envs/des-y6a2-test2/lib/python3.8/site-packages/fitsio/fitslib.py", line 1097, in write_table
    self[-1].write(data, names=names)
  File "/gpfs02/astro/workarea/beckermr/miniconda3/envs/des-y6a2-test2/lib/python3.8/site-packages/fitsio/hdu/table.py", line 278, in write
    self._FITS.write_columns(
OSError: FITSIO status = 236: column exceeds width of table
esheldon commented 3 years ago

If its a limit in cfitsio then we should probably just provide a better error message. This one makes it seem like there is an inconsistency in the data