Interpolates the DataArray 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
(
self,
target: pd.DatetimeIndex | CFTimeIndex | DataArray,
dim: str = "time",
)
| 6897 | ) |
| 6898 | |
| 6899 | def interp_calendar( |
| 6900 | self, |
| 6901 | target: pd.DatetimeIndex | CFTimeIndex | DataArray, |
| 6902 | dim: str = "time", |
| 6903 | ) -> Self: |
| 6904 | """Interpolates the DataArray to another calendar based on decimal year measure. |
| 6905 | |
| 6906 | Each timestamp in `source` and `target` are first converted to their decimal |
| 6907 | year equivalent then `source` is interpolated on the target coordinate. |
| 6908 | The decimal year of a timestamp is its year plus its sub-year component |
| 6909 | converted to the fraction of its year. For example "2000-03-01 12:00" is |
| 6910 | 2000.1653 in a standard calendar or 2000.16301 in a `"noleap"` calendar. |
| 6911 | |
| 6912 | This method should only be used when the time (HH:MM:SS) information of |
| 6913 | time coordinate is not important. |
| 6914 | |
| 6915 | Parameters |
| 6916 | ---------- |
| 6917 | target: DataArray or DatetimeIndex or CFTimeIndex |
| 6918 | The target time coordinate of a valid dtype |
| 6919 | (np.datetime64 or cftime objects) |
| 6920 | dim : str |
| 6921 | The time coordinate name. |
| 6922 | |
| 6923 | Returns |
| 6924 | ------- |
| 6925 | DataArray |
| 6926 | The source interpolated on the decimal years of target, |
| 6927 | """ |
| 6928 | return interp_calendar(self, target, dim=dim) |
| 6929 | |
| 6930 | @_deprecate_positional_args("v2024.07.0") |
| 6931 | def groupby( |
nothing calls this directly
no test coverage detected