Skip to content

Commit 5a5fa16

Browse files
committed
Avoid two unused fixtures
1 parent d26b56d commit 5a5fa16

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed

pygmt/tests/test_xarray_accessor.py

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,6 @@ def fixture_grid():
2727
return load_static_earth_relief()
2828

2929

30-
@pytest.fixture(scope="module", name="expected_clipped_grid")
31-
def fixture_expected_clipped_grid():
32-
"""
33-
The expected grdclip grid result.
34-
"""
35-
return xr.DataArray(
36-
data=[
37-
[1000.0, 570.5, -1000.0, -1000.0],
38-
[1000.0, 1000.0, 571.5, 638.5],
39-
[555.5, 556.0, 580.0, 1000.0],
40-
],
41-
coords={"lon": [-52.5, -51.5, -50.5, -49.5], "lat": [-18.5, -17.5, -16.5]},
42-
dims=["lat", "lon"],
43-
)
44-
45-
46-
@pytest.fixture(scope="module", name="expected_equalized_grid")
47-
def fixture_expected_equalized_grid():
48-
"""
49-
The expected grdhisteq grid result.
50-
"""
51-
return xr.DataArray(
52-
data=[[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 1, 1], [1, 1, 1, 1]],
53-
coords={
54-
"lon": [-51.5, -50.5, -49.5, -48.5],
55-
"lat": [-21.5, -20.5, -19.5, -18.5],
56-
},
57-
dims=["lat", "lon"],
58-
)
59-
60-
6130
def test_xarray_accessor_gridline_cartesian():
6231
"""
6332
Check that the accessor returns the correct registration and gtype values for a
@@ -211,7 +180,7 @@ def test_xarray_accessor_tiled_grid_slice_and_add():
211180
assert added_grid.gmt.gtype is GridType.GEOGRAPHIC
212181

213182

214-
def test_xarray_accessor_clip(grid, expected_clipped_grid):
183+
def test_xarray_accessor_clip(grid):
215184
"""
216185
Check that the accessor has the clip method and that it works correctly.
217186
@@ -220,14 +189,33 @@ def test_xarray_accessor_clip(grid, expected_clipped_grid):
220189
clipped_grid = grid.gmt.clip(
221190
below=[550, -1000], above=[700, 1000], region=[-53, -49, -19, -16]
222191
)
192+
193+
expected_clipped_grid = xr.DataArray(
194+
data=[
195+
[1000.0, 570.5, -1000.0, -1000.0],
196+
[1000.0, 1000.0, 571.5, 638.5],
197+
[555.5, 556.0, 580.0, 1000.0],
198+
],
199+
coords={"lon": [-52.5, -51.5, -50.5, -49.5], "lat": [-18.5, -17.5, -16.5]},
200+
dims=["lat", "lon"],
201+
)
223202
xr.testing.assert_allclose(a=clipped_grid, b=expected_clipped_grid)
224203

225204

226-
def test_xarray_accessor_equalize(grid, expected_equalized_grid):
205+
def test_xarray_accessor_equalize(grid):
227206
"""
228207
Check that the accessor has the equalize_hist method and that it works correctly.
229208
230209
This test is adapted from the `test_equalize_grid_no_outgrid` test.
231210
"""
232211
equalized_grid = grid.gmt.equalize_hist(divisions=2, region=[-52, -48, -22, -18])
212+
213+
expected_equalized_grid = xr.DataArray(
214+
data=[[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 1, 1], [1, 1, 1, 1]],
215+
coords={
216+
"lon": [-51.5, -50.5, -49.5, -48.5],
217+
"lat": [-21.5, -20.5, -19.5, -18.5],
218+
},
219+
dims=["lat", "lon"],
220+
)
233221
xr.testing.assert_allclose(a=equalized_grid, b=expected_equalized_grid)

0 commit comments

Comments
 (0)