99from .. import Figure
1010from ..exceptions import GMTInvalidInput
1111from ..datasets import load_earth_relief
12+ from ..helpers .testing import check_figures_equal
1213
1314
1415TEST_DATA_DIR = os .path .join (os .path .dirname (__file__ ), "data" )
@@ -21,49 +22,49 @@ def fixture_grid():
2122 return load_earth_relief (registration = "gridline" )
2223
2324
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 ()
2826def test_grdcontour (grid ):
2927 """Plot a contour image using an xarray grid
3028 with fixed contour interval
3129 """
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
3535
3636
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 ()
4138def test_grdcontour_labels (grid ):
4239 """Plot a contour image using a xarray grid
4340 with contour labels and alternate colors
4441 """
45- fig = Figure ()
46- fig .grdcontour (
47- grid ,
42+ fig_ref , fig_test = Figure (), Figure ()
43+ kwargs = dict (
4844 interval = "1000" ,
4945 annotation = "5000" ,
5046 projection = "W0/6i" ,
5147 pen = ["a1p,red" , "c0.5p,black" ],
5248 label_placement = "d3i" ,
5349 )
54- return fig
50+ fig_ref .grdcontour ("@earth_relief_01d_g" , ** kwargs )
51+ fig_test .grdcontour (grid , ** kwargs )
52+ return fig_ref , fig_test
5553
5654
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 ()
6156def test_grdcontour_slice (grid ):
6257 "Plot an contour image using an xarray grid that has been sliced"
58+
59+ fig_ref , fig_test = Figure (), Figure ()
60+
6361 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
6768
6869
6970@pytest .mark .mpl_image_compare
0 commit comments