File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
from matplotlib .testing .compare import compare_images
9
9
from pygmt .exceptions import GMTImageComparisonFailure
10
+ from pygmt .io import load_dataarray
10
11
from pygmt .src import which
11
12
12
13
@@ -178,10 +179,24 @@ def download_test_data():
178
179
"@ridge.txt" ,
179
180
"@mars370d.txt" ,
180
181
"@srtm_tiles.nc" , # needed for 03s and 01s relief data
182
+ "@static_earth_relief.nc" ,
181
183
"@test.dat.nc" ,
182
184
"@tut_bathy.nc" ,
183
185
"@tut_quakes.ngdc" ,
184
186
"@tut_ship.xyz" ,
185
187
"@usgs_quakes_22.txt" ,
186
188
]
187
189
which (fname = datasets , download = "a" )
190
+
191
+
192
+ def load_static_earth_relief ():
193
+ """
194
+ Load the static_earth_relief file for internal testing.
195
+
196
+ Returns
197
+ -------
198
+ data : xarray.DataArray
199
+ A grid of Earth relief for internal tests.
200
+ """
201
+ fname = which ("@static_earth_relief.nc" , download = "c" )
202
+ return load_dataarray (fname )
Original file line number Diff line number Diff line change 5
5
6
6
import numpy as np
7
7
import pytest
8
+ import xarray as xr
8
9
from pygmt .exceptions import GMTInvalidInput
9
10
from pygmt .helpers import (
10
11
GMTTempFile ,
13
14
kwargs_to_strings ,
14
15
unique_name ,
15
16
)
17
+ from pygmt .helpers .testing import load_static_earth_relief
18
+
19
+
20
+ def test_load_static_earth_relief ():
21
+ """
22
+ Check that @static_earth_relief.nc loads without errors.
23
+ """
24
+ data = load_static_earth_relief ()
25
+ assert data .dims == ("lat" , "lon" )
26
+ assert data .shape == (14 , 8 )
27
+ assert data .min () == 190
28
+ assert data .max () == 981
29
+ assert data .median () == 467
30
+ assert isinstance (data , xr .DataArray )
16
31
17
32
18
33
@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments