Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maxinelasp committed Apr 18, 2024
1 parent bc03904 commit aaf9456
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
Expand Up @@ -67,8 +67,13 @@ def write_cdf(dataset: xr.Dataset):
start_time = np.datetime_as_string(dataset["epoch"].values[0], unit="D").replace(
"-", ""
)

# Will now accept vXXX or XXX formats, as batch starter sends versions as vXXX.
r = re.compile(r"v\d{3}")
if r.match(dataset.attrs["Data_version"]) is None:
if (
not isinstance(dataset.attrs["Data_version"], str)
or r.match(dataset.attrs["Data_version"]) is None
):
version = f"v{int(dataset.attrs['Data_version']):03d}" # vXXX
else:
version = dataset.attrs["Data_version"]
Expand Down

0 comments on commit aaf9456

Please sign in to comment.