Skip to content
16 changes: 15 additions & 1 deletion imap_processing/ena_maps/ena_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,11 +1498,25 @@ def build_cdf_dataset( # noqa: PLR0912
# Now set global attributes
map_attrs = cdf_attrs.get_global_attributes(f"imap_{instrument}_{level}_enamap")
map_attrs["Spacing_degrees"] = str(self.spacing_deg)
for key in ["Data_type", "Logical_source", "Logical_source_description"]:
for key in ["Data_type", "Logical_source"]:
map_attrs[key] = map_attrs[key].format(
descriptor=descriptor,
sensor=sensor,
)
# Use the MapDescriptor to generate the Logical_source_description
# when possible, but preserve previous behavior for non-descriptor
# strings so later validation still raises the intended errors.
try:
md = naming.MapDescriptor.from_string(descriptor)
except ValueError:
map_attrs["Logical_source_description"] = map_attrs[
"Logical_source_description"
].format(
descriptor=descriptor,
sensor=sensor,
)
else:
map_attrs["Logical_source_description"] = md.to_logical_source_description()
# Always add the following attributes to the map
map_attrs.update(
Comment thread
tmplummer marked this conversation as resolved.
{
Expand Down
Loading
Loading