We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
bounds.py
1 parent 67377ce commit b770b91Copy full SHA for b770b91
xcdat/bounds.py
@@ -641,6 +641,13 @@ def _create_time_bounds( # noqa: C901
641
# Determine the daily frequency for generating time bounds.
642
if daily_subfreq is None:
643
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
651
hrs = diff.seconds / 3600
652
daily_subfreq = int(24 / hrs) # type: ignore
653
0 commit comments