Skip to content

Commit caa1faf

Browse files
committed
Avoid two unused fixtures
1 parent d26b56d commit caa1faf

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

pygmt/tests/test_xarray_accessor.py

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,11 @@ 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-
4630
@pytest.fixture(scope="module", name="expected_equalized_grid")
4731
def fixture_expected_equalized_grid():
4832
"""
4933
The expected grdhisteq grid result.
5034
"""
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-
)
5935

6036

6137
def test_xarray_accessor_gridline_cartesian():
@@ -211,7 +187,7 @@ def test_xarray_accessor_tiled_grid_slice_and_add():
211187
assert added_grid.gmt.gtype is GridType.GEOGRAPHIC
212188

213189

214-
def test_xarray_accessor_clip(grid, expected_clipped_grid):
190+
def test_xarray_accessor_clip(grid):
215191
"""
216192
Check that the accessor has the clip method and that it works correctly.
217193
@@ -220,6 +196,16 @@ def test_xarray_accessor_clip(grid, expected_clipped_grid):
220196
clipped_grid = grid.gmt.clip(
221197
below=[550, -1000], above=[700, 1000], region=[-53, -49, -19, -16]
222198
)
199+
200+
expected_clipped_grid = xr.DataArray(
201+
data=[
202+
[1000.0, 570.5, -1000.0, -1000.0],
203+
[1000.0, 1000.0, 571.5, 638.5],
204+
[555.5, 556.0, 580.0, 1000.0],
205+
],
206+
coords={"lon": [-52.5, -51.5, -50.5, -49.5], "lat": [-18.5, -17.5, -16.5]},
207+
dims=["lat", "lon"],
208+
)
223209
xr.testing.assert_allclose(a=clipped_grid, b=expected_clipped_grid)
224210

225211

@@ -230,4 +216,13 @@ def test_xarray_accessor_equalize(grid, expected_equalized_grid):
230216
This test is adapted from the `test_equalize_grid_no_outgrid` test.
231217
"""
232218
equalized_grid = grid.gmt.equalize_hist(divisions=2, region=[-52, -48, -22, -18])
219+
220+
expected_equalized_grid = xr.DataArray(
221+
data=[[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 1, 1], [1, 1, 1, 1]],
222+
coords={
223+
"lon": [-51.5, -50.5, -49.5, -48.5],
224+
"lat": [-21.5, -20.5, -19.5, -18.5],
225+
},
226+
dims=["lat", "lon"],
227+
)
233228
xr.testing.assert_allclose(a=equalized_grid, b=expected_equalized_grid)

0 commit comments

Comments
 (0)