Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update baseline images for updates of earth relief data #452

Merged
merged 5 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
# Cache the ${HOME}/.gmt directory, for docs and testing
- task: Cache@2
inputs:
key: cachedata | 20200519
key: cachedata | 20200524
path: $(HOME)/.gmt
cacheHitVar: CACHE_CACHEDATA_RESTORED
displayName: Cache GMT remote data for testing
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
# Cache the ${HOME}/.gmt directory, for docs and testing
- task: Cache@2
inputs:
key: cachedata | 20200519
key: cachedata | 20200524
path: $(HOMEPATH)/.gmt
cacheHitVar: CACHE_CACHEDATA_RESTORED
displayName: Cache GMT remote data for testing
Expand Down
6 changes: 3 additions & 3 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Session:
... )
... # Read the contents of the temp file before it's deleted.
... print(fout.read().strip())
-180 180 -90 90 -8592 5559 1 1 361 181
-180 180 -90 90 -8592.14453125 5558.79248047 1 1 361 181
"""

# The minimum version of GMT required
Expand Down Expand Up @@ -1218,15 +1218,15 @@ 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())
-8592.0 5559.0
-8592.145 5558.7925
>>> with Session() as ses:
... with ses.virtualfile_from_grid(data) as fin:
... # Send the output to a file so that we can read it
... with GMTTempFile() as fout:
... args = '{} -L0 -Cn ->{}'.format(fin, fout.name)
... ses.call_module('grdinfo', args)
... print(fout.read().strip())
-180 180 -90 90 -8592 5559 1 1 361 181
-180 180 -90 90 -8592.14453125 5558.79248047 1 1 361 181
>>> # The output is: w e s n z0 z1 dx dy n_columns n_rows

"""
Expand Down
Binary file modified pygmt/tests/baseline/test_grdcontour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pygmt/tests/baseline/test_grdcontour_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pygmt/tests/baseline/test_grdcontour_interval_file_full_opts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pygmt/tests/baseline/test_grdcontour_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pygmt/tests/baseline/test_grdcontour_slice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pygmt/tests/baseline/test_grdview_on_a_plane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pygmt/tests/baseline/test_grdview_with_perspective_and_zsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions pygmt/tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,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(), -8592)
npt.assert_allclose(data.max(), 5559)
npt.assert_allclose(data.min(), -8592.144531)
npt.assert_allclose(data.max(), 5558.79248)


def test_earth_relief_30():
Expand All @@ -84,5 +84,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(), -9460)
npt.assert_allclose(data.max(), 5888)
npt.assert_allclose(data.min(), -9460.310547)
npt.assert_allclose(data.max(), 5887.60791)
8 changes: 4 additions & 4 deletions pygmt/tests/test_grdtrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_grdtrack_input_dataframe_and_dataarray():
output = grdtrack(points=dataframe, grid=dataarray, newcolname="bathymetry")
assert isinstance(output, pd.DataFrame)
assert output.columns.to_list() == ["longitude", "latitude", "bathymetry"]
npt.assert_allclose(output.iloc[0], [-110.9536, -42.2489, -2797.482959])
npt.assert_allclose(output.iloc[0], [-110.9536, -42.2489, -2797.497251])

return output

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

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

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

return output

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

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

Expand Down
4 changes: 2 additions & 2 deletions pygmt/tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 -8592 5559 1 1 361 181"
assert result.strip() == "-180 180 -90 90 -8592.14453125 5558.79248047 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 -8592 5559 1 1 361 181"
assert result.strip() == "-180 180 -90 90 -8592.14465255 5558.79248047 1 1 361 181"


def test_grdinfo_fails():
Expand Down