Skip to content

Commit

Permalink
Feat: new and old data format compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jdiasn committed Sep 10, 2024
1 parent fe0ff67 commit d33ea72
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lidarwind/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ def open_sweep(file_name):

del raw_data

assert "time_reference" in ds, "missing time_reference in input sweep"
# Guarantee that it is a valid datetime
reference_time = pd.to_datetime(ds["time_reference"].values).isoformat()
ds["time"].attrs["units"] = f"seconds since {reference_time}"
if "time_reference" in ds:
# Guarantee that it is a valid datetime
reference_time = pd.to_datetime(
ds["time_reference"].values
).isoformat()
ds["time"].attrs["units"] = f"seconds since {reference_time}"

ds = xr.decode_cf(ds)

Expand Down

0 comments on commit d33ea72

Please sign in to comment.