Skip to content

Commit 1126c9b

Browse files
authored
cast type to PDDatetimeUnitOptions (#9963)
1 parent 70997ef commit 1126c9b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

xarray/coding/times.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,9 @@ def _numbers_to_timedelta(
595595
# estimate fitting resolution for floating point values
596596
# this iterates until all floats are fractionless or time_unit == "ns"
597597
if flat_num.dtype.kind == "f" and time_unit != "ns":
598-
flat_num, new_time_unit = _check_higher_resolution(flat_num, time_unit)
598+
flat_num, new_time_unit = _check_higher_resolution(
599+
flat_num, cast(PDDatetimeUnitOptions, time_unit)
600+
)
599601
if time_unit != new_time_unit:
600602
msg = (
601603
f"Can't decode floating point {datatype} to {time_unit!r} without "

0 commit comments

Comments
 (0)