Skip to content

Commit

Permalink
Fixing version in cdf writer to line up with batch starter version
Browse files Browse the repository at this point in the history
  • Loading branch information
maxinelasp committed Apr 18, 2024
1 parent 126cb47 commit bc03904
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion imap_processing/cdf/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Various utility functions to support creation of CDF files."""

import logging
import re

import imap_data_access
import numpy as np
Expand Down Expand Up @@ -66,7 +67,11 @@ def write_cdf(dataset: xr.Dataset):
start_time = np.datetime_as_string(dataset["epoch"].values[0], unit="D").replace(
"-", ""
)
version = f"v{int(dataset.attrs['Data_version']):03d}" # vXXX
r = re.compile(r"v\d{3}")
if r.match(dataset.attrs["Data_version"]) is None:
version = f"v{int(dataset.attrs['Data_version']):03d}" # vXXX
else:
version = dataset.attrs["Data_version"]
repointing = dataset.attrs.get("Repointing", None)
science_file = imap_data_access.ScienceFilePath.generate_from_inputs(
instrument=instrument,
Expand Down

0 comments on commit bc03904

Please sign in to comment.