Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuehlbauer committed Jan 3, 2025
1 parent 48dea20 commit 1145f4b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xarray/coding/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,14 @@ def _check_date_for_units_since_refdate(
return pd.Timestamp("NaT")


def _align_reference_date_and_unit(ref_date: pd.Timestamp, unit: str) -> pd.Timestamp:
def _align_reference_date_and_unit(
ref_date: pd.Timestamp, unit: NPDatetimeUnitOptions
) -> pd.Timestamp:
# align to the highest needed resolution of ref_date or unit
if np.timedelta64(1, ref_date.unit) > np.timedelta64(1, unit):
# this will raise accordingly
# if data can't be represented in the higher resolution
return timestamp_as_unit(ref_date, unit)
return timestamp_as_unit(ref_date, cast(PDDatetimeUnitOptions, unit))
return ref_date


Expand Down

0 comments on commit 1145f4b

Please sign in to comment.