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

Function ds

xarray/tests/conftest.py:56–92  ·  view source on GitHub ↗
(request, backend)

Source from the content-addressed store, hash-verified

54
55@pytest.fixture(params=[1])
56def ds(request, backend):
57 if request.param == 1:
58 ds = Dataset(
59 dict(
60 z1=(["y", "x"], np.random.randn(2, 8)),
61 z2=(["time", "y"], np.random.randn(10, 2)),
62 ),
63 dict(
64 x=("x", np.linspace(0, 1.0, 8)),
65 time=("time", np.linspace(0, 1.0, 10)),
66 c=("y", ["a", "b"]),
67 y=range(2),
68 ),
69 )
70 elif request.param == 2:
71 ds = Dataset(
72 dict(
73 z1=(["time", "y"], np.random.randn(10, 2)),
74 z2=(["time"], np.random.randn(10)),
75 z3=(["x", "time"], np.random.randn(8, 10)),
76 ),
77 dict(
78 x=("x", np.linspace(0, 1.0, 8)),
79 time=("time", np.linspace(0, 1.0, 10)),
80 c=("y", ["a", "b"]),
81 y=range(2),
82 ),
83 )
84 elif request.param == 3:
85 ds = create_test_data()
86 else:
87 raise ValueError
88
89 if backend == "dask":
90 return ds.chunk()
91
92 return ds
93
94
95@pytest.fixture(params=[1])

Callers 15

test_1dMethod · 0.70
test_2dMethod · 0.70
test_3dMethod · 0.70
test_concat_onceMethod · 0.70
test_concat_twiceMethod · 0.70
test_auto_combine_2dMethod · 0.70

Calls 4

chunkMethod · 0.95
DatasetClass · 0.90
create_test_dataFunction · 0.90
linspaceMethod · 0.80

Tested by

no test coverage detected