Skip to content

Commit da20303

Browse files
authored
Quickfix min elevation for new SRTM15+V2.1 earth relief grids (#401)
Upstream GMT has updated its earth relief grids to SRTM15+V2.1 to fill in NaN values (see GenericMappingTools/gmt#2920). This commit fixes the test failures due to incorrect minimum elevation values, and minor changes to the contour and grid plots.
1 parent 56dfd85 commit da20303

17 files changed

+7
-7
lines changed

pygmt/clib/session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Session:
111111
... )
112112
... # Read the contents of the temp file before it's deleted.
113113
... print(fout.read().strip())
114-
-180 180 -90 90 -8596 5559 1 1 361 181
114+
-180 180 -90 90 -8592 5559 1 1 361 181
115115
"""
116116

117117
# The minimum version of GMT required
@@ -1218,15 +1218,15 @@ def virtualfile_from_grid(self, grid):
12181218
>>> print(data.lat.values.min(), data.lat.values.max())
12191219
-90.0 90.0
12201220
>>> print(data.values.min(), data.values.max())
1221-
-8596.0 5559.0
1221+
-8592.0 5559.0
12221222
>>> with Session() as ses:
12231223
... with ses.virtualfile_from_grid(data) as fin:
12241224
... # Send the output to a file so that we can read it
12251225
... with GMTTempFile() as fout:
12261226
... args = '{} -L0 -Cn ->{}'.format(fin, fout.name)
12271227
... ses.call_module('grdinfo', args)
12281228
... print(fout.read().strip())
1229-
-180 180 -90 90 -8596 5559 1 1 361 181
1229+
-180 180 -90 90 -8592 5559 1 1 361 181
12301230
>>> # The output is: w e s n z0 z1 dx dy n_columns n_rows
12311231
12321232
"""
-169 Bytes
Loading
191 Bytes
Loading
Loading
-8 Bytes
Loading
37 Bytes
Loading
12 Bytes
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

pygmt/tests/test_datasets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_earth_relief_60():
6262
assert data.shape == (181, 361)
6363
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
6464
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
65-
npt.assert_allclose(data.min(), -8596)
65+
npt.assert_allclose(data.min(), -8592)
6666
npt.assert_allclose(data.max(), 5559)
6767

6868

@@ -72,5 +72,5 @@ def test_earth_relief_30():
7272
assert data.shape == (361, 721)
7373
npt.assert_allclose(data.lat, np.arange(-90, 90.5, 0.5))
7474
npt.assert_allclose(data.lon, np.arange(-180, 180.5, 0.5))
75-
npt.assert_allclose(data.min(), -9458)
75+
npt.assert_allclose(data.min(), -9460)
7676
npt.assert_allclose(data.max(), 5888)

pygmt/tests/test_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ def test_grdinfo():
5959
"Make sure grd info works as expected"
6060
grid = load_earth_relief()
6161
result = grdinfo(grid, L=0, C="n")
62-
assert result.strip() == "-180 180 -90 90 -8596 5559 1 1 361 181"
62+
assert result.strip() == "-180 180 -90 90 -8592 5559 1 1 361 181"
6363

6464

6565
def test_grdinfo_file():
6666
"Test grdinfo with file input"
6767
result = grdinfo("@earth_relief_60m", L=0, C="n")
68-
assert result.strip() == "-180 180 -90 90 -8596 5559 1 1 361 181"
68+
assert result.strip() == "-180 180 -90 90 -8592 5559 1 1 361 181"
6969

7070

7171
def test_grdinfo_fails():

0 commit comments

Comments
 (0)