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

Function test_dataset_interp_datetime_nat

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

Source from the content-addressed store, hash-verified

1233
1234@requires_scipy
1235def test_dataset_interp_datetime_nat() -> None:
1236 # GH#10900 - NaT propagates like NaN
1237 time_data = np.array(
1238 ["2024-01-01", "2024-01-02", "NaT", "2024-01-04", "2024-01-05"],
1239 dtype="datetime64[D]",
1240 )
1241 ds = xr.Dataset(
1242 data_vars={"time": (["x"], time_data)},
1243 coords={"x": np.arange(5)},
1244 )
1245
1246 result = ds.interp(x=[0.5, 1.5, 2.5, 3.5])
1247
1248 assert not np.isnat(result["time"].values[0])
1249 assert np.isnat(result["time"].values[1])
1250 assert np.isnat(result["time"].values[2])
1251 assert not np.isnat(result["time"].values[3])
1252
1253
1254@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…