Skip to content

Commit

Permalink
force load of time before min/max (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
nocollier authored Jan 30, 2025
1 parent 9c520b6 commit 3645ca5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ilamb3/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _stamp(t: xr.DataArray, ymd: tuple[int]):
cls = t.item().__class__
try:
stamp = cls(*ymd)
except Exception:
except Exception: # assume it was datetime64
stamp = np.datetime64(f"{ymd[0]:4d}-{ymd[1]:02d}-{ymd[2]:02d}")
return stamp

Expand Down
1 change: 1 addition & 0 deletions ilamb3/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def get_time_extent(
if "bounds" in time.attrs:
if time.attrs["bounds"] in dset:
time = dset[time.attrs["bounds"]]
time.load()
return time.min(), time.max()


Expand Down

0 comments on commit 3645ca5

Please sign in to comment.