9
9
from .. import Figure
10
10
from ..exceptions import GMTInvalidInput
11
11
from ..datasets import load_earth_relief
12
+ from ..helpers .testing import check_figures_equal
12
13
13
14
14
15
TEST_DATA_DIR = os .path .join (os .path .dirname (__file__ ), "data" )
@@ -21,49 +22,49 @@ def fixture_grid():
21
22
return load_earth_relief (registration = "gridline" )
22
23
23
24
24
- @pytest .mark .xfail (
25
- reason = "Baseline image not updated to use earth relief grid in GMT 6.1.0" ,
26
- )
27
- @pytest .mark .mpl_image_compare
25
+ @check_figures_equal ()
28
26
def test_grdcontour (grid ):
29
27
"""Plot a contour image using an xarray grid
30
28
with fixed contour interval
31
29
"""
32
- fig = Figure ()
33
- fig .grdcontour (grid , interval = "1000" , projection = "W0/6i" )
34
- return fig
30
+ fig_ref , fig_test = Figure (), Figure ()
31
+ kwargs = dict (interval = "1000" , projection = "W0/6i" )
32
+ fig_ref .grdcontour ("@earth_relief_01d_g" , ** kwargs )
33
+ fig_test .grdcontour (grid , ** kwargs )
34
+ return fig_ref , fig_test
35
35
36
36
37
- @pytest .mark .xfail (
38
- reason = "Baseline image not updated to use earth relief grid in GMT 6.1.0" ,
39
- )
40
- @pytest .mark .mpl_image_compare
37
+ @check_figures_equal ()
41
38
def test_grdcontour_labels (grid ):
42
39
"""Plot a contour image using a xarray grid
43
40
with contour labels and alternate colors
44
41
"""
45
- fig = Figure ()
46
- fig .grdcontour (
47
- grid ,
42
+ fig_ref , fig_test = Figure (), Figure ()
43
+ kwargs = dict (
48
44
interval = "1000" ,
49
45
annotation = "5000" ,
50
46
projection = "W0/6i" ,
51
47
pen = ["a1p,red" , "c0.5p,black" ],
52
48
label_placement = "d3i" ,
53
49
)
54
- return fig
50
+ fig_ref .grdcontour ("@earth_relief_01d_g" , ** kwargs )
51
+ fig_test .grdcontour (grid , ** kwargs )
52
+ return fig_ref , fig_test
55
53
56
54
57
- @pytest .mark .xfail (
58
- reason = "Baseline image not updated to use earth relief grid in GMT 6.1.0" ,
59
- )
60
- @pytest .mark .mpl_image_compare
55
+ @check_figures_equal ()
61
56
def test_grdcontour_slice (grid ):
62
57
"Plot an contour image using an xarray grid that has been sliced"
58
+
59
+ fig_ref , fig_test = Figure (), Figure ()
60
+
63
61
grid_ = grid .sel (lat = slice (- 30 , 30 ))
64
- fig = Figure ()
65
- fig .grdcontour (grid_ , interval = "1000" , projection = "M6i" )
66
- return fig
62
+ kwargs = dict (interval = "1000" , projection = "M6i" )
63
+ fig_ref .grdcontour (
64
+ grid = "@earth_relief_01d_g" , region = [- 180 , 180 , - 30 , 30 ], ** kwargs
65
+ )
66
+ fig_test .grdcontour (grid = grid_ , ** kwargs )
67
+ return fig_ref , fig_test
67
68
68
69
69
70
@pytest .mark .mpl_image_compare
0 commit comments