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

Function test_interp_vectorized_dask

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

Source from the content-addressed store, hash-verified

1128@requires_dask
1129@requires_scipy
1130def test_interp_vectorized_dask() -> None:
1131 # Synthetic dataset chunked in the two interpolation dimensions
1132 import dask.array as da
1133
1134 nt = 10
1135 nlat = 20
1136 nlon = 10
1137 nq = 21
1138 ds = xr.Dataset(
1139 data_vars={
1140 "foo": (
1141 ("lat", "lon", "dayofyear", "q"),
1142 da.random.random((nlat, nlon, nt, nq), chunks=(10, 10, 10, -1)),
1143 ),
1144 "bar": (("lat", "lon"), da.random.random((nlat, nlon), chunks=(10, 10))),
1145 },
1146 coords={
1147 "lat": np.linspace(-89.5, 89.6, nlat),
1148 "lon": np.linspace(-179.5, 179.6, nlon),
1149 "dayofyear": np.arange(0, nt),
1150 "q": np.linspace(0, 1, nq),
1151 },
1152 )
1153
1154 # Interpolate along non-chunked dimension
1155 with raise_if_dask_computes():
1156 actual = ds.interp(q=ds["bar"], kwargs={"fill_value": None})
1157 expected = ds.compute().interp(q=ds["bar"], kwargs={"fill_value": None})
1158 assert_identical(actual, expected)
1159
1160
1161@requires_scipy

Callers

nothing calls this directly

Calls 6

interpMethod · 0.95
computeMethod · 0.95
raise_if_dask_computesFunction · 0.90
assert_identicalFunction · 0.90
linspaceMethod · 0.80
arangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…