MCPcopy Create free account
hub / github.com/dask/dask / test_from_xarray

Function test_from_xarray

dask/dataframe/tests/test_dataframe.py:5331–5346  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5329
5330
5331def test_from_xarray():
5332 xr = pytest.importorskip("xarray")
5333
5334 a = da.zeros(shape=(6000, 45000), chunks=(30, 6000))
5335 a = xr.DataArray(
5336 a, coords={"c1": list(range(6000)), "c2": list(range(45000))}, dims=["c1", "c2"]
5337 )
5338 sel_coords = {
5339 "c1": pd.date_range("2024-11-01", "2024-11-10").to_numpy(),
5340 "c2": [29094],
5341 }
5342
5343 result = a.reindex(**sel_coords).to_dask_dataframe()
5344 assert (
5345 len(collections_to_expr([result]).optimize().__dask_graph__()) < 30
5346 ) # previously 3000
5347
5348
5349def test_from_xarray_string_conversion():

Callers

nothing calls this directly

Calls 5

collections_to_exprFunction · 0.90
to_dask_dataframeMethod · 0.80
zerosMethod · 0.45
__dask_graph__Method · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected