Over the last while the data centre has made ASDF files with two different naming conventions:
f"{instrument}_L1_{start_time:%Y%m%dT%H%M%S}_{dataset_id}..asdf"
f"{instrument}_L1_{start_time:%Y%m%dT%H%M%S}_{dataset_id}_user_tools..asdf"
In the future this suffix will be changed to:
f"{instrument}_L1_{start_time:%Y%m%dT%H%M%S}_{dataset_id}_metadata.asdf"
Therefore we need to adapt the directory loader to handle picking the most applicable of these patterns if more than one is detected in the folder. I think the algorithm should be as follows:
- Glob the directory for all ASDF files
- Group all results by the dataset id in the filename
- Pick the ASDF file to use with the following priority: (
_metadata, _user_tools, <nothing>)
- Throw a warning to the user if any ASDF files with older suffixes are found