opencadc / caom2tools

Common Archive Observation Model - data engineering tools
2 stars 13 forks source link

Error when writing empty emBand tag #48

Closed dr-rodriguez closed 7 years ago

dr-rodriguez commented 7 years ago

While trying to write out some HST observations I get the following errors:

File "caom2/obs_reader_writer.py", line 1992, in _add_energy_element
    self._add_element("emBand", energy.em_band.value, element)
AttributeError: 'NoneType' object has no attribute 'value'

This happens because emBand is being set to UV;OPTICAL, OPTICAL;INFRARED, or similar. Since CAOM 2.3 accepts only a single band, the variable energy.em_band is set to None. However, it looks like when attempting to write the xml (regardless of whether validate=True or False), the caom2 library code attempts to get the .value of the variable and does not have a built in check to pass if it is None.

Note that emBand is optional in the CAOM2.3 schema.