From d2d2f6263146ae38714a36f6cdf3e953d92c7bb7 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Sun, 20 Oct 2019 21:42:57 +1300 Subject: [PATCH] Quickfix min/max elevation for new SRTM15+V2 earth relief grids 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 https://github.com/GenericMappingTools/gmt/pull/1846. This resulted in a couple of test failures because of changed minimum/maximum elevation values, which this commit addresses. --- pygmt/clib/session.py | 7 +++---- pygmt/tests/test_datasets.py | 8 ++++---- pygmt/tests/test_info.py | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pygmt/clib/session.py b/pygmt/clib/session.py index b03c3cdfa0a..36e656d938b 100644 --- a/pygmt/clib/session.py +++ b/pygmt/clib/session.py @@ -107,8 +107,7 @@ class Session: ... ses.call_module("grdinfo", "{} -C ->{}".format(fin, fout.name)) ... # Read the contents of the temp file before it's deleted. ... print(fout.read().strip()) - -180 180 -90 90 -8425 5551 1 1 361 181 - + -180 180 -90 90 -8596 5559 1 1 361 181 """ # The minimum version of GMT required @@ -1188,7 +1187,7 @@ def virtualfile_from_grid(self, grid): >>> print(data.lat.values.min(), data.lat.values.max()) -90.0 90.0 >>> print(data.values.min(), data.values.max()) - -8425.0 5551.0 + -8596.0 5559.0 >>> with Session() as ses: ... with ses.virtualfile_from_grid(data) as fin: ... # Send the output to a file so that we can read it @@ -1196,7 +1195,7 @@ def virtualfile_from_grid(self, grid): ... args = '{} -L0 -Cn ->{}'.format(fin, fout.name) ... ses.call_module('grdinfo', args) ... print(fout.read().strip()) - -180 180 -90 90 -8425 5551 1 1 361 181 + -180 180 -90 90 -8596 5559 1 1 361 181 >>> # The output is: w e s n z0 z1 dx dy n_columns n_rows """ diff --git a/pygmt/tests/test_datasets.py b/pygmt/tests/test_datasets.py index 23594de5031..40ed1e751cd 100644 --- a/pygmt/tests/test_datasets.py +++ b/pygmt/tests/test_datasets.py @@ -62,8 +62,8 @@ def test_earth_relief_60(): assert data.shape == (181, 361) npt.assert_allclose(data.lat, np.arange(-90, 91, 1)) npt.assert_allclose(data.lon, np.arange(-180, 181, 1)) - npt.assert_allclose(data.min(), -8425) - npt.assert_allclose(data.max(), 5551) + npt.assert_allclose(data.min(), -8596) + npt.assert_allclose(data.max(), 5559) def test_earth_relief_30(): @@ -72,5 +72,5 @@ def test_earth_relief_30(): assert data.shape == (361, 721) npt.assert_allclose(data.lat, np.arange(-90, 90.5, 0.5)) npt.assert_allclose(data.lon, np.arange(-180, 180.5, 0.5)) - npt.assert_allclose(data.min(), -9214) - npt.assert_allclose(data.max(), 5859) + npt.assert_allclose(data.min(), -9458) + npt.assert_allclose(data.max(), 5888) diff --git a/pygmt/tests/test_info.py b/pygmt/tests/test_info.py index d0c714be07c..5ff0739d313 100644 --- a/pygmt/tests/test_info.py +++ b/pygmt/tests/test_info.py @@ -59,13 +59,13 @@ def test_grdinfo(): "Make sure grd info works as expected" grid = load_earth_relief() result = grdinfo(grid, L=0, C="n") - assert result.strip() == "-180 180 -90 90 -8425 5551 1 1 361 181" + assert result.strip() == "-180 180 -90 90 -8596 5559 1 1 361 181" def test_grdinfo_file(): "Test grdinfo with file input" result = grdinfo("@earth_relief_60m", L=0, C="n") - assert result.strip() == "-180 180 -90 90 -8425 5551 1 1 361 181" + assert result.strip() == "-180 180 -90 90 -8596 5559 1 1 361 181" def test_grdinfo_fails():