MCPcopy
hub / github.com/pydata/xarray / _validate_interp_indexer

Method _validate_interp_indexer

xarray/core/dataset.py:3908–3922  ·  view source on GitHub ↗
(x, new_x)

Source from the content-addressed store, hash-verified

3906 return as_variable((k, range(obj.sizes[k])))
3907
3908 def _validate_interp_indexer(x, new_x):
3909 # In the case of datetimes, the restrictions placed on indexers
3910 # used with interp are stronger than those which are placed on
3911 # isel, so we need an additional check after _validate_indexers.
3912 if _contains_datetime_like_objects(
3913 x
3914 ) and not _contains_datetime_like_objects(new_x):
3915 raise TypeError(
3916 "When interpolating over a datetime-like "
3917 "coordinate, the coordinates to "
3918 "interpolate to must be either datetime "
3919 "strings or datetimes. "
3920 f"Instead got\n{new_x}"
3921 )
3922 return x, new_x
3923
3924 validated_indexers = {
3925 k: _validate_interp_indexer(maybe_variable(obj, k), v)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected