nctoolkit.DataSet.shift¶
- DataSet.shift(self, \*\*kwargs)¶
Shift method. A wrapper for shift_days, shift_hours Operations are applied in the order supplied.
- Parameters
*kwargs –
hours maps to shift_hours days maps to shift_days months maps to shift_months years maps to shift_years
Note: this uses partial matches. So hour, day, month, year will also work.
Examples
If you wanted to shift all times back 1 hour, you would do the following:
>>> ds.shift(hours = -1)
If you wanted to shift all times forward 2 days, you would do the following:
>>> ds.shift(days = 2)
If you wanted to shift all times forward 6 months, you would do the following:
>>> ds.shift(months = 6)
If you wanted to shift all times forward 1 year, you would do the following:
>>> ds.shift(years = 1)
This method will allow partial matches in arguments. So the following will do the same thing:
>>> ds.shift(year = 2)
>>> ds.shift(years = 2)