(self)
| 1291 | |
| 1292 | @pytest.fixture(autouse=True) |
| 1293 | def setUp(self) -> None: |
| 1294 | da = DataArray( |
| 1295 | easy_array((10, 15), start=-1), |
| 1296 | dims=["y", "x"], |
| 1297 | coords={"y": np.arange(10), "x": np.arange(15)}, |
| 1298 | ) |
| 1299 | # add 2d coords |
| 1300 | ds = da.to_dataset(name="testvar") |
| 1301 | x, y = np.meshgrid(da.x.values, da.y.values) |
| 1302 | ds["x2d"] = DataArray(x, dims=["y", "x"]) |
| 1303 | ds["y2d"] = DataArray(y, dims=["y", "x"]) |
| 1304 | ds = ds.set_coords(["x2d", "y2d"]) |
| 1305 | # set darray and plot method |
| 1306 | self.darray: DataArray = ds.testvar |
| 1307 | |
| 1308 | # Add CF-compliant metadata |
| 1309 | self.darray.attrs["long_name"] = "a_long_name" |
| 1310 | self.darray.attrs["units"] = "a_units" |
| 1311 | self.darray.x.attrs["long_name"] = "x_long_name" |
| 1312 | self.darray.x.attrs["units"] = "x_units" |
| 1313 | self.darray.y.attrs["long_name"] = "y_long_name" |
| 1314 | self.darray.y.attrs["units"] = "y_units" |
| 1315 | |
| 1316 | self.plotmethod = getattr(self.darray.plot, self.plotfunc.__name__) |
| 1317 | |
| 1318 | def test_label_names(self) -> None: |
| 1319 | self.plotmethod() |
nothing calls this directly
no test coverage detected