Skip to content

Commit

Permalink
Restore code in bounds.py that was accidentally deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder committed Nov 6, 2024
1 parent 67377ce commit b770b91
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xcdat/bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,13 @@ def _create_time_bounds( # noqa: C901
# Determine the daily frequency for generating time bounds.
if daily_subfreq is None:
diff = time.values[1] - time.values[0]

# Arrays with `dtype="timedelta64[ns]"` must be converted to
# pandas timedelta objects in order to access the `.seconds`
# time component.
if isinstance(diff, np.timedelta64):
diff = pd.to_timedelta(diff)

hrs = diff.seconds / 3600
daily_subfreq = int(24 / hrs) # type: ignore

Expand Down

0 comments on commit b770b91

Please sign in to comment.