mfouesneau/ezpadova

Unable to write files

Closed this issue · 7 comments

Thanks for this awesome tool. I'm getting an error when it is trying to write the table to a fits file (indented are the input commands)
astropy 4.0.1.post1
python 3.7.6

r = parsec.get_one_isochrone(1e10, 0.003, model='parsec12s', phot='acs_hrc')

Interrogating http://stev.oapd.inaf.it...
Downloading data...http://stev.oapd.inaf.it/tmp/output585733563945.dat

r.write('padova12s_10Gyr_0.7.fits')

Traceback (most recent call last):

File "", line 1, in
r.write('padova12s_10Gyr_0.7.fits')

File "/Users/seth/anaconda/envs/py37/lib/python3.7/site-packages/ezpadova/simpletable.py", line 1689, in write
hdr = _fits_generate_header(self)

File "/Users/seth/anaconda/envs/py37/lib/python3.7/site-packages/ezpadova/simpletable.py", line 279, in _fits_generate_header
hdr.update(k, v)

File "/Users/seth/anaconda/envs/py37/lib/python3.7/site-packages/astropy/io/fits/header.py", line 1153, in update
'a keyword, value, and comment string.'.format(idx))

ValueError: Header update sequence item #0 is invalid; the item must either be a 2-tuple containing a keyword and value, or a 3-tuple containing a keyword, value, and comment string.

Could you download manually the file and check that there is content? From the error message, I suspect the file is empty or something is wrong.

(I cannot check the file is temporary on the server)

I see. The fits format writing is broken. Can you save the file in csv? I'll have a look

I just pushed an update on simpletable.py which should correct both the csv and fits export issues. @anilseth Can you test and confirm?

Yes, thanks that fixed it. However, I'm now getting some warning errors associated with outputting the fits header (the csv runs without error). Its very long, but comes from having >8 characters in the header. As I said though, it works just fine, and I can read it back in using astropy Table.read() successfully.
WARNING: VerifyWarning: Keyword name 'cmd_version' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]
WARNING: VerifyWarning: Keyword name 'dust_sourceC' is greater than 8 characters or contains characters not allowed by the FITS standard; a HIERARCH card will be created. [astropy.io.fits.card]

FITS is old :) and astropy tries to tell you the HIERARCH card will be used for the header, which should be the default now. I don't know how to remove these sorry.

Closing the issue. Keep an eye for when the new website is integrated.