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

Function test_datetime

xarray/tests/test_interp.py:720–734  ·  view source on GitHub ↗
(x_new, expected)

Source from the content-addressed store, hash-verified

718 ],
719)
720def test_datetime(x_new, expected) -> None:
721 da = xr.DataArray(
722 np.arange(24),
723 dims="time",
724 coords={"time": pd.date_range("2000-01-01", periods=24, unit="ns")},
725 )
726
727 actual = da.interp(time=x_new)
728 expected_da = xr.DataArray(
729 np.atleast_1d(expected),
730 dims=["time"],
731 coords={"time": (np.atleast_1d(x_new).astype("datetime64[ns]"))},
732 )
733
734 assert_allclose(actual, expected_da)
735
736
737@requires_scipy

Callers

nothing calls this directly

Calls 4

interpMethod · 0.95
assert_allcloseFunction · 0.90
arangeMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…