Skip to content

Commit

Permalink
try to fix typing, ignore one
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuehlbauer committed Jan 9, 2025
1 parent 0b93dbd commit b38cd7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xarray/coding/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def _check_higher_resolution(
) -> tuple[np.ndarray, PDDatetimeUnitOptions]:
"""Iterate until fitting resolution found."""
res: list[PDDatetimeUnitOptions] = ["s", "ms", "us", "ns"]
new_units = res[res.index(cast(PDDatetimeUnitOptions, time_unit)) :]
new_units = res[res.index(time_unit) :]
for new_time_unit in new_units:
if not ((np.unique(flat_num_dates % 1) > 0).any() and new_time_unit != "ns"):
break
Expand Down Expand Up @@ -582,7 +582,7 @@ 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_dates, new_time_unit = _check_higher_resolution(flat_num, time_unit)
flat_num_dates, new_time_unit = _check_higher_resolution(flat_num, time_unit) # type: ignore[arg-type]
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 b38cd7e

Please sign in to comment.