Skip to content

Commit b770b91

Browse files
committed
Restore code in bounds.py that was accidentally deleted
1 parent 67377ce commit b770b91

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

xcdat/bounds.py

+7
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,13 @@ def _create_time_bounds( # noqa: C901
641641
# Determine the daily frequency for generating time bounds.
642642
if daily_subfreq is None:
643643
diff = time.values[1] - time.values[0]
644+
645+
# Arrays with `dtype="timedelta64[ns]"` must be converted to
646+
# pandas timedelta objects in order to access the `.seconds`
647+
# time component.
648+
if isinstance(diff, np.timedelta64):
649+
diff = pd.to_timedelta(diff)
650+
644651
hrs = diff.seconds / 3600
645652
daily_subfreq = int(24 / hrs) # type: ignore
646653

0 commit comments

Comments
 (0)