Skip to content

Commit 72c0f21

Browse files
authored
Quickfix min/max elevation for new SRTM15+V2 earth relief grids (#350)
Upstream GMT has updated its earth relief grids to use the new [Tozer et al. 2019](https://doi.org/10.1029/2019EA000658) Global Bathymetry and Topography at 15 Arc Sec (SRTM15+V2) data, see GenericMappingTools/gmt#1846. This resulted in a couple of test failures because of changed minimum/maximum elevation values, which this commit addresses.
1 parent cdcdf70 commit 72c0f21

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

pygmt/clib/session.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ class Session:
107107
... ses.call_module("grdinfo", "{} -C ->{}".format(fin, fout.name))
108108
... # Read the contents of the temp file before it's deleted.
109109
... print(fout.read().strip())
110-
-180 180 -90 90 -8425 5551 1 1 361 181
111-
110+
-180 180 -90 90 -8596 5559 1 1 361 181
112111
"""
113112

114113
# The minimum version of GMT required
@@ -1188,15 +1187,15 @@ def virtualfile_from_grid(self, grid):
11881187
>>> print(data.lat.values.min(), data.lat.values.max())
11891188
-90.0 90.0
11901189
>>> print(data.values.min(), data.values.max())
1191-
-8425.0 5551.0
1190+
-8596.0 5559.0
11921191
>>> with Session() as ses:
11931192
... with ses.virtualfile_from_grid(data) as fin:
11941193
... # Send the output to a file so that we can read it
11951194
... with GMTTempFile() as fout:
11961195
... args = '{} -L0 -Cn ->{}'.format(fin, fout.name)
11971196
... ses.call_module('grdinfo', args)
11981197
... print(fout.read().strip())
1199-
-180 180 -90 90 -8425 5551 1 1 361 181
1198+
-180 180 -90 90 -8596 5559 1 1 361 181
12001199
>>> # The output is: w e s n z0 z1 dx dy n_columns n_rows
12011200
12021201
"""

pygmt/tests/test_datasets.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ 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(), -8425)
66-
npt.assert_allclose(data.max(), 5551)
65+
npt.assert_allclose(data.min(), -8596)
66+
npt.assert_allclose(data.max(), 5559)
6767

6868

6969
def test_earth_relief_30():
@@ -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(), -9214)
76-
npt.assert_allclose(data.max(), 5859)
75+
npt.assert_allclose(data.min(), -9458)
76+
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 -8425 5551 1 1 361 181"
62+
assert result.strip() == "-180 180 -90 90 -8596 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 -8425 5551 1 1 361 181"
68+
assert result.strip() == "-180 180 -90 90 -8596 5559 1 1 361 181"
6969

7070

7171
def test_grdinfo_fails():

0 commit comments

Comments
 (0)