MCPcopy Index your code
hub / github.com/pydata/xarray / interp_calendar

Method interp_calendar

xarray/core/dataset.py:10081–10110  ·  view source on GitHub ↗

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 i

(
        self,
        target: pd.DatetimeIndex | CFTimeIndex | DataArray,
        dim: Hashable = "time",
    )

Source from the content-addressed store, hash-verified

10079 )
10080
10081 def interp_calendar(
10082 self,
10083 target: pd.DatetimeIndex | CFTimeIndex | DataArray,
10084 dim: Hashable = "time",
10085 ) -> Self:
10086 """Interpolates the Dataset to another calendar based on decimal year measure.
10087
10088 Each timestamp in `source` and `target` are first converted to their decimal
10089 year equivalent then `source` is interpolated on the target coordinate.
10090 The decimal year of a timestamp is its year plus its sub-year component
10091 converted to the fraction of its year. For example "2000-03-01 12:00" is
10092 2000.1653 in a standard calendar or 2000.16301 in a `"noleap"` calendar.
10093
10094 This method should only be used when the time (HH:MM:SS) information of
10095 time coordinate is not important.
10096
10097 Parameters
10098 ----------
10099 target: DataArray or DatetimeIndex or CFTimeIndex
10100 The target time coordinate of a valid dtype
10101 (np.datetime64 or cftime objects)
10102 dim : Hashable, default: "time"
10103 The time coordinate name.
10104
10105 Returns
10106 -------
10107 DataArray
10108 The source interpolated on the decimal years of target,
10109 """
10110 return interp_calendar(self, target, dim=dim)
10111
10112 @_deprecate_positional_args("v2024.07.0")
10113 def groupby(

Callers

nothing calls this directly

Calls 1

interp_calendarFunction · 0.90

Tested by

no test coverage detected