diff --git a/src/ravenpy/utilities/forecasting.py b/src/ravenpy/utilities/forecasting.py index 84d4c10d..5b48c7dd 100644 --- a/src/ravenpy/utilities/forecasting.py +++ b/src/ravenpy/utilities/forecasting.py @@ -297,13 +297,14 @@ def _shift_esp_time(nc, year, dim="member"): Modify time such that it starts on the given year, and add member dimension with original year as value. """ - ds = xr.open_dataset(nc, use_cftime=True) + ds = xr.open_dataset(nc) # Create new time coordinate - start = ds.time.data[0] + start = ds.indexes['time'][0] freq = xr.infer_freq(ds.time) - ds["time"] = xr.cftime_range( - start.replace(year=year), periods=len(ds.time), freq=freq + ds["time"] = xr.date_range( + start.replace(year=year), periods=len(ds.time), freq=freq, + calendar=ds.time.dt.calendar ) # New coordinate dimension to store the original year