xarray.CFTimeIndex.shift¶
-
CFTimeIndex.
shift
(n, freq)¶ Shift the CFTimeIndex a multiple of the given frequency.
See the documentation for
cftime_range()
for a complete listing of valid frequency strings.- Parameters
n (
int
) – Periods to shift byfreq (
str
ordatetime.timedelta
) – A frequency string or datetime.timedelta object to shift by
- Returns
See also
pandas.DatetimeIndex.shift
Examples
>>> index = xr.cftime_range("2000", periods=1, freq="M") >>> index CFTimeIndex([2000-01-31 00:00:00], dtype='object', length=1, calendar='gregorian', freq=None) >>> index.shift(1, "M") CFTimeIndex([2000-02-29 00:00:00], dtype='object', length=1, calendar='gregorian', freq=None)