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

Function test_dataset_interp_datetime_variable

xarray/tests/test_interp.py:1195–1213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1193
1194@requires_scipy
1195def test_dataset_interp_datetime_variable() -> None:
1196 # GH#10900
1197 ds = xr.Dataset(
1198 data_vars={
1199 "something": (["x", "y"], np.arange(25, dtype=float).reshape(5, 5)),
1200 "time": (
1201 ["x", "y"],
1202 np.datetime64("2024-01-01")
1203 + np.arange(25).reshape(5, 5) * np.timedelta64(1, "D"),
1204 ),
1205 },
1206 coords={"x": np.arange(5), "y": np.arange(5)},
1207 )
1208
1209 result = ds.interp(x=[0.5, 1.5], y=[0.5, 1.5])
1210
1211 assert "time" in result.data_vars
1212 expected_time = np.datetime64("2024-01-01") + np.timedelta64(3, "D")
1213 np.testing.assert_equal(result["time"].values[0, 0], expected_time)
1214
1215
1216@requires_scipy

Callers

nothing calls this directly

Calls 2

interpMethod · 0.95
arangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…