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

Function test_interp_non_numeric_1d

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

Source from the content-addressed store, hash-verified

1089
1090@requires_scipy
1091def test_interp_non_numeric_1d() -> None:
1092 ds = xr.Dataset(
1093 {
1094 "numeric": ("time", 1 + np.arange(0, 4, 1)),
1095 "non_numeric": ("time", np.array(["a", "b", "c", "d"])),
1096 },
1097 coords={"time": (np.arange(0, 4, 1))},
1098 )
1099 actual = ds.interp(time=np.linspace(0, 3, 7))
1100
1101 expected = xr.Dataset(
1102 {
1103 "numeric": ("time", 1 + np.linspace(0, 3, 7)),
1104 "non_numeric": ("time", np.array(["a", "b", "b", "c", "c", "d", "d"])),
1105 },
1106 coords={"time": np.linspace(0, 3, 7)},
1107 )
1108 xr.testing.assert_identical(actual, expected)
1109
1110
1111@requires_scipy

Callers

nothing calls this directly

Calls 3

interpMethod · 0.95
arangeMethod · 0.80
linspaceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…