Skip to content

Commit

Permalink
Improve the xrgrid used in grdimage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Jul 29, 2024
1 parent 3a589fa commit 85e58c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions pygmt/tests/baseline/test_grdimage_over_dateline.png.dvc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
outs:
- md5: cfd6484e1e2eddea0d4b56df54aabe05
size: 10854
- md5: 89b79fd00e185ab840927dad11cb5ec5
size: 8393
path: test_grdimage_over_dateline.png
hash: md5
14 changes: 9 additions & 5 deletions pygmt/tests/test_grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ def fixture_xrgrid():
"""
Create a sample xarray.DataArray grid for testing.
"""
longitude = np.arange(0, 360, 1)
latitude = np.arange(-89, 90, 1)
x = np.sin(np.deg2rad(longitude))
y = np.linspace(start=0, stop=1, num=179)
data = y[:, np.newaxis] * x
longitude = np.arange(0, 361, 1)
latitude = np.arange(-90, 91, 1)

lon_grid, lat_grid = np.meshgrid(longitude, latitude)
data = np.cos(np.deg2rad(lat_grid)) * np.sin(np.deg2rad(lon_grid))

# Consistent data points are North/South poles for all longtiude
data[0, :] = 0.0
data[-1, :] = 0.0

return xr.DataArray(
data,
Expand Down

0 comments on commit 85e58c3

Please sign in to comment.