There is an inconsistency between the export and load methods. _add_metadata_to_xarray simply does not add two attributes completed_timestamp_raw and run_timestamp_raw if they were None in the original dataset, but it does add empty placeholders for completed_timestamp and run_timestamp even if they are None.
This is the function:
|
def _add_metadata_to_xarray( |
So the solution should be to always add the *_raw timestamps as attrbiutes upon export. If they are None, set them on xarray dataset as None as well. And when loading from a netcdf file, perform a correct handling on None value for those. And for datasets that were exported to netcdf before this change, apply the following logic: if those attributes are not present, then try to calculate them from the non-raw versions of these timestamp attributes.