From e619a4c96446f5dad39702bec4702abdf93cd230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20M=C3=BChlbauer?= Date: Thu, 9 Jan 2025 11:54:58 +0100 Subject: [PATCH] fix cftime_to_nptime in cftimeindex --- xarray/coding/cftimeindex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/coding/cftimeindex.py b/xarray/coding/cftimeindex.py index 5eb5f6dce12..bd5f51551c7 100644 --- a/xarray/coding/cftimeindex.py +++ b/xarray/coding/cftimeindex.py @@ -588,7 +588,7 @@ def to_datetimeindex(self, unsafe=False): return pd.DatetimeIndex([]) # transform to us-resolution is needed for DatetimeIndex - nptimes = cftime_to_nptime(self).astype("=M8[us]") + nptimes = cftime_to_nptime(self, time_unit="us") calendar = infer_calendar_name(self) if calendar not in _STANDARD_CALENDARS and not unsafe: warnings.warn(