cds-astro / cds.pyreadme

ReadMe and MRT builder for authors
Other
33 stars 6 forks source link

makeReadMe() fails when columns contain NaN values, writeCDSTables() replaces NaN values with zero. #7

Closed mphanderson closed 3 years ago

mphanderson commented 3 years ago

Hi, I have some astropy tables which I am converting into CDS tables for upload. Some of the physical quantities for my table entries are missing, and those array elements are filled with NaNs.

The writeCDSTables() runs without crashing, but replaces all NaN values with 0 (this is problematic).

The makeReadMe() crashes and returns: ValueError: cannot convert float NaN to integer, and hence does not generate an output.

Is there a way for NaN values to be supported?

Many thanks.

Version: 1.3.4

gilleslandais commented 3 years ago

Hello - there are different ways: you can use the astropy MaskedColumn to remove NaN or use the nullvalue parameter in the CDSTablesMaker.addtable(...) method

it seems that it depends of the input format .. Do you have an example ? what is the format that you use in input: CSV, FITS other?

mphanderson commented 3 years ago

Hi, thank you for your suggestions. By converting the astropy Columns with NaNs to MaskedColumn (with NaNs masked) I now avoid the errors, and I get an expected table/ReadMe output.