()
| 121 | |
| 122 | @requires_scipy |
| 123 | def test_tree_index_sel_errors() -> None: |
| 124 | xx, yy = np.meshgrid([1.0, 2.0], [3.0, 4.0]) |
| 125 | ds = xr.Dataset(coords={"xx": (("y", "x"), xx), "yy": (("y", "x"), yy)}).set_xindex( |
| 126 | ("xx", "yy"), NDPointIndex |
| 127 | ) |
| 128 | |
| 129 | with pytest.raises(ValueError, match="method='nearest'"): |
| 130 | ds.sel(xx=1.1, yy=3.1) |
| 131 | |
| 132 | with pytest.raises(ValueError, match="missing labels"): |
| 133 | ds.sel(xx=1.1, method="nearest") |
| 134 | |
| 135 | with pytest.raises(ValueError, match="invalid label value"): |
| 136 | # invalid array-like dimensions |
| 137 | ds.sel(xx=[1.1, 1.9], yy=[3.1, 3.9], method="nearest") |
| 138 | |
| 139 | # error while trying to broadcast labels |
| 140 | with pytest.raises(xr.AlignmentError, match=r".*conflicting dimension sizes"): |
| 141 | ds.sel( |
| 142 | xx=xr.Variable("u", [1.1, 1.1, 1.1]), |
| 143 | yy=xr.Variable("u", [3.1, 3.1]), |
| 144 | method="nearest", |
| 145 | ) |
| 146 | |
| 147 | |
| 148 | @requires_scipy |
nothing calls this directly
no test coverage detected
searching dependent graphs…