🍾 Xarray is now 10 years old! 🎉

xarray.Dataset.interp_calendar

xarray.Dataset.interp_calendar#

Dataset.interp_calendar(target, dim='time')[source]#

Interpolates the Dataset to another calendar based on decimal year measure.

Each timestamp in source and target are first converted to their decimal year equivalent then source is interpolated on the target coordinate. The decimal year of a timestamp is its year plus its sub-year component converted to the fraction of its year. For example “2000-03-01 12:00” is 2000.1653 in a standard calendar or 2000.16301 in a “noleap” calendar.

This method should only be used when the time (HH:MM:SS) information of time coordinate is not important.

Parameters:
  • target (DataArray or DatetimeIndex or CFTimeIndex) – The target time coordinate of a valid dtype (np.datetime64 or cftime objects)

  • dim (Hashable, default: "time") – The time coordinate name.

Returns:

DataArray – The source interpolated on the decimal years of target,