MCPcopy
hub / github.com/pydata/xarray / test_outer_indexing

Function test_outer_indexing

properties/test_coordinate_transform.py:99–113  ·  view source on GitHub ↗

Test outer indexing produces identical results for transform and pandas index.

(data, sizes)

Source from the content-addressed store, hash-verified

97 xrst.dimension_sizes(min_dims=1, max_dims=3, min_side=1, max_side=5),
98)
99def test_outer_indexing(data, sizes):
100 """Test outer indexing produces identical results for transform and pandas index."""
101 pandas_da = create_pandas_da(sizes)
102 transform_da = create_transform_da(sizes)
103 idxr = data.draw(xrst.outer_array_indexers(sizes=sizes, min_dims=1))
104 pandas_result = pandas_da.isel(idxr)
105 transform_result = transform_da.isel(idxr)
106 assert_equal(pandas_result, transform_result)
107
108 label_idxr = {
109 dim: np.arange(pandas_da.sizes[dim])[ind.data] for dim, ind in idxr.items()
110 }
111 pandas_result = pandas_da.sel(label_idxr)
112 transform_result = transform_da.sel(label_idxr, method="nearest")
113 assert_equal(pandas_result, transform_result)
114
115
116@given(

Callers

nothing calls this directly

Calls 7

assert_equalFunction · 0.90
create_pandas_daFunction · 0.85
create_transform_daFunction · 0.85
arangeMethod · 0.80
itemsMethod · 0.80
iselMethod · 0.45
selMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…