Skip to content

Commit cda1fe8

Browse files
authored
Fix several failures due to updates of earth relief data (#498)
Update some numbers due to the recent changes in GMT earth relief data. We don't update the failing baseline images to minimize images updates. Partially address #451.
1 parent f7b6d6c commit cda1fe8

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
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 -8592.14453125 5558.79248047 1 1 361 181
114+
-180 180 -90 90 -8592.5 5559 1 1 361 181
115115
"""
116116

117117
# The minimum version of GMT required
@@ -1225,15 +1225,15 @@ def virtualfile_from_grid(self, grid):
12251225
>>> print(data.lat.values.min(), data.lat.values.max())
12261226
-90.0 90.0
12271227
>>> print(data.values.min(), data.values.max())
1228-
-8592.145 5558.7925
1228+
-8592.5 5559.0
12291229
>>> with Session() as ses:
12301230
... with ses.virtualfile_from_grid(data) as fin:
12311231
... # Send the output to a file so that we can read it
12321232
... with GMTTempFile() as fout:
12331233
... args = '{} -L0 -Cn ->{}'.format(fin, fout.name)
12341234
... ses.call_module('grdinfo', args)
12351235
... print(fout.read().strip())
1236-
-180 180 -90 90 -8592.14453125 5558.79248047 1 1 361 181
1236+
-180 180 -90 90 -8592.5 5559 1 1 361 181
12371237
>>> # The output is: w e s n z0 z1 dx dy n_columns n_rows
12381238
12391239
"""

pygmt/tests/test_datasets.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def test_earth_relief_01d():
7474
assert data.shape == (181, 361)
7575
npt.assert_allclose(data.lat, np.arange(-90, 91, 1))
7676
npt.assert_allclose(data.lon, np.arange(-180, 181, 1))
77-
npt.assert_allclose(data.min(), -8592.144531)
78-
npt.assert_allclose(data.max(), 5558.79248)
77+
npt.assert_allclose(data.min(), -8592.5)
78+
npt.assert_allclose(data.max(), 5559.0)
7979

8080

8181
def test_earth_relief_30m():
@@ -84,5 +84,5 @@ def test_earth_relief_30m():
8484
assert data.shape == (361, 721)
8585
npt.assert_allclose(data.lat, np.arange(-90, 90.5, 0.5))
8686
npt.assert_allclose(data.lon, np.arange(-180, 180.5, 0.5))
87-
npt.assert_allclose(data.min(), -9460.310547)
88-
npt.assert_allclose(data.max(), 5887.60791)
87+
npt.assert_allclose(data.min(), -9460.5)
88+
npt.assert_allclose(data.max(), 5887.5)

pygmt/tests/test_grdinfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def test_grdinfo():
1313
"Make sure grd info works as expected"
1414
grid = load_earth_relief()
1515
result = grdinfo(grid, L=0, C="n")
16-
assert result.strip() == "-180 180 -90 90 -8592.14453125 5558.79248047 1 1 361 181"
16+
assert result.strip() == "-180 180 -90 90 -8592.5 5559 1 1 361 181"
1717

1818

1919
def test_grdinfo_file():
2020
"Test grdinfo with file input"
2121
result = grdinfo("@earth_relief_01d", L=0, C="n")
22-
assert result.strip() == "-180 180 -90 90 -8592.14465255 5558.79248047 1 1 361 181"
22+
assert result.strip() == "-180 180 -90 90 -8592.5 5559 1 1 361 181"
2323

2424

2525
def test_grdinfo_fails():

pygmt/tests/test_grdtrack.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_grdtrack_input_dataframe_and_dataarray():
2828
output = grdtrack(points=dataframe, grid=dataarray, newcolname="bathymetry")
2929
assert isinstance(output, pd.DataFrame)
3030
assert output.columns.to_list() == ["longitude", "latitude", "bathymetry"]
31-
npt.assert_allclose(output.iloc[0], [-110.9536, -42.2489, -2797.497251])
31+
npt.assert_allclose(output.iloc[0], [-110.9536, -42.2489, -2797.394987])
3232

3333
return output
3434

@@ -46,7 +46,7 @@ def test_grdtrack_input_csvfile_and_dataarray():
4646
assert os.path.exists(path=TEMP_TRACK) # check that outfile exists at path
4747

4848
track = pd.read_csv(TEMP_TRACK, sep="\t", header=None, comment=">")
49-
npt.assert_allclose(track.iloc[0], [-110.9536, -42.2489, -2797.497251])
49+
npt.assert_allclose(track.iloc[0], [-110.9536, -42.2489, -2797.394987])
5050
finally:
5151
os.remove(path=TEMP_TRACK)
5252

@@ -63,7 +63,7 @@ def test_grdtrack_input_dataframe_and_ncfile():
6363
output = grdtrack(points=dataframe, grid=ncfile, newcolname="bathymetry")
6464
assert isinstance(output, pd.DataFrame)
6565
assert output.columns.to_list() == ["longitude", "latitude", "bathymetry"]
66-
npt.assert_allclose(output.iloc[0], [-32.2971, 37.4118, -1686.878079])
66+
npt.assert_allclose(output.iloc[0], [-32.2971, 37.4118, -1686.748899])
6767

6868
return output
6969

@@ -81,7 +81,7 @@ def test_grdtrack_input_csvfile_and_ncfile():
8181
assert os.path.exists(path=TEMP_TRACK) # check that outfile exists at path
8282

8383
track = pd.read_csv(TEMP_TRACK, sep="\t", header=None, comment=">")
84-
npt.assert_allclose(track.iloc[0], [-32.2971, 37.4118, -1686.878079])
84+
npt.assert_allclose(track.iloc[0], [-32.2971, 37.4118, -1686.748899])
8585
finally:
8686
os.remove(path=TEMP_TRACK)
8787

0 commit comments

Comments
 (0)