Fix Version/s: None
In looking at the Source table outputs (SRC*.fits files) in the validation_data_hsc repository, we noticed that the headers are not consistently applied in the FITS files generated by afw.table output. In particular, the TUNIT keywords are missing for the coord_ra and coord_dec columns, making it difficult for a client to determine that the columns are persisted in units of radians, especially since the FITS convention is for the default units for angles to be degrees.
REFERENCE: FITS Standard
COMMENT: column units
DEFINITION: The value field shall contain a character string describing
the physical units in which the quantity in field n, after any
application of TSCALn and TZEROn, is expressed. The units of all FITS
header keyword values, with the exception of measurements of angles,
should conform with the recommendations in the IAU Style Manual. For
angular measurements given as floating point values and specified with
reserved keywords, degrees are the recommended units (with the units,
if specified, given as 'deg').
Accepting that we are not conforming to that convention, the proper value for TUNITn is "rad" for data in units of radians.
While much access to afw.table-produced files will be through the afw.table interfaces, where this issue is irrelevant as long as round-tripping is successful, for exploratory and debugging purposes it is very useful to be able to access the file contents with standard tools.
In addition, if the FITS tables produced from afw.table are to be used as the input to the database ingest, providing units for all columns will assist the database system in providing and validating correct column metadata to its clients, whether through VO standards or other means.
Temporarily taking this out of review, because Jenkins doesn't like it (looks like I broke another test that I hadn't been re-running locally).
Fixed, and once again ready for review. I scaled by my ambitions on reading columns with angle units to only read those tagged specifically as Angles by our code back into Angle fields; converting fields without those tags was backwards incompatible, and hence a bigger change than I should attempt on this issue.
Ready for review; John Parejko, could you take a look?
This is three separate fixes all dealing with afw.table persistence, split into three commits (with another one that's purely cleanup). In addition to the two changes (angle unit writing and AR_NAME header key duplication) described above, I've also modified the angle-column reading code to better handle non-LSST and/or malformed inputs. All changes are on tickets/