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

Function da

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

Source from the content-addressed store, hash-verified

94
95@pytest.fixture(params=[1])
96def da(request, backend):
97 if request.param == 1:
98 times = pd.date_range("2000-01-01", freq="1D", periods=21)
99 da = DataArray(
100 np.random.random((3, 21, 4)),
101 dims=("a", "time", "x"),
102 coords=dict(time=times),
103 )
104
105 if request.param == 2:
106 da = DataArray([0, np.nan, 1, 2, np.nan, 3, 4, 5, np.nan, 6, 7], dims="time")
107
108 if request.param == "repeating_ints":
109 da = DataArray(
110 np.tile(np.arange(12), 5).reshape(5, 4, 3),
111 coords={"x": list("abc"), "y": list("defg")},
112 dims=list("zyx"),
113 )
114
115 if backend == "dask":
116 return da.chunk()
117 elif backend == "numpy":
118 return da
119 else:
120 raise ValueError
121
122
123@pytest.fixture(

Callers 1

test_slice_replaceFunction · 0.70

Calls 3

chunkMethod · 0.95
DataArrayClass · 0.90
arangeMethod · 0.80

Tested by

no test coverage detected