Skip to content

Commit

Permalink
cast type to PDDatetimeUnitOptions (#9963)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuehlbauer authored Jan 20, 2025
1 parent 70997ef commit 1126c9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xarray/coding/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,9 @@ def _numbers_to_timedelta(
# estimate fitting resolution for floating point values
# this iterates until all floats are fractionless or time_unit == "ns"
if flat_num.dtype.kind == "f" and time_unit != "ns":
flat_num, new_time_unit = _check_higher_resolution(flat_num, time_unit)
flat_num, new_time_unit = _check_higher_resolution(
flat_num, cast(PDDatetimeUnitOptions, time_unit)
)
if time_unit != new_time_unit:
msg = (
f"Can't decode floating point {datatype} to {time_unit!r} without "
Expand Down

0 comments on commit 1126c9b

Please sign in to comment.