Skip to content

Commit 9fa3b66

Browse files
Change test_grdinfo.py to use static_earth_relief (#1746)
1 parent 17105a3 commit 9fa3b66

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

pygmt/tests/test_grdinfo.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@
44
import numpy as np
55
import pytest
66
from pygmt import grdinfo
7-
from pygmt.datasets import load_earth_relief
87
from pygmt.exceptions import GMTInvalidInput
8+
from pygmt.helpers.testing import load_static_earth_relief
99

1010

11-
def test_grdinfo():
11+
@pytest.fixture(scope="module", name="grid")
12+
def fixture_grid():
1213
"""
13-
Make sure grdinfo works as expected.
14+
Load the grid data from the static_earth_relief file.
1415
"""
15-
grid = load_earth_relief(registration="gridline")
16-
result = grdinfo(grid=grid, force_scan=0, per_column="n")
17-
assert result.strip() == "-180 180 -90 90 -8592.5 5559 1 1 361 181 0 1"
16+
return load_static_earth_relief()
1817

1918

20-
def test_grdinfo_file():
19+
def test_grdinfo(grid):
2120
"""
22-
Test grdinfo with file input.
21+
Make sure grdinfo works as expected.
2322
"""
24-
result = grdinfo(grid="@earth_relief_01d", force_scan=0, per_column="n")
25-
assert result.strip() == "-180 180 -90 90 -8182 5651.5 1 1 360 180 1 1"
23+
result = grdinfo(grid=grid, force_scan=0, per_column="n")
24+
assert result.strip() == "-55 -47 -24 -10 190 981 1 1 8 14 1 1"
2625

2726

2827
def test_grdinfo_fails():
@@ -33,14 +32,11 @@ def test_grdinfo_fails():
3332
grdinfo(np.arange(10).reshape((5, 2)))
3433

3534

36-
def test_grdinfo_region():
35+
def test_grdinfo_region(grid):
3736
"""
3837
Check that the region argument works in grdinfo.
3938
"""
4039
result = grdinfo(
41-
grid="@earth_relief_01d",
42-
force_scan=0,
43-
per_column="n",
44-
region=[-170, 170, -80, 80],
40+
grid=grid, force_scan=0, per_column="n", region=[-54, -50, -23, -20]
4541
)
46-
assert result.strip() == "-170 170 -80 80 -8182 5651.5 1 1 340 160 1 1"
42+
assert result.strip() == "-54 -50 -23 -20 284.5 491 1 1 4 3 1 1"

0 commit comments

Comments
 (0)