9
9
from pygmt .datasets import load_earth_relief
10
10
from pygmt .exceptions import GMTInvalidInput
11
11
from pygmt .helpers import GMTTempFile
12
- from pygmt .helpers .testing import check_figures_equal
13
12
14
13
TEST_DATA_DIR = os .path .join (os .path .dirname (__file__ ), "data" )
15
14
POINTS_DATA = os .path .join (TEST_DATA_DIR , "points.txt" )
@@ -40,7 +39,7 @@ def fixture_grid():
40
39
41
40
42
41
@pytest .mark .mpl_image_compare
43
- def test_makecpt_to_plot_points (points , region ):
42
+ def test_makecpt_plot_points (points , region ):
44
43
"""
45
44
Use static color palette table to change color of points.
46
45
"""
@@ -58,34 +57,29 @@ def test_makecpt_to_plot_points(points, region):
58
57
59
58
60
59
@pytest .mark .mpl_image_compare
61
- def test_makecpt_to_plot_grid (grid ):
60
+ def test_makecpt_plot_grid (grid ):
62
61
"""
63
62
Use static color palette table to change color of grid.
64
63
"""
65
64
fig = Figure ()
66
65
makecpt (cmap = "relief" )
67
- fig .grdimage (grid , projection = "W0/6i " )
66
+ fig .grdimage (grid , projection = "W0/10c " )
68
67
return fig
69
68
70
69
71
- @check_figures_equal ()
72
- def test_makecpt_to_plot_grid_scaled_with_series (grid ):
70
+ @pytest . mark . mpl_image_compare
71
+ def test_makecpt_plot_grid_scaled_with_series (grid ):
73
72
"""
74
73
Use static color palette table scaled to a min/max series to change color
75
74
of grid.
76
75
"""
77
- # Use single-character arguments for the reference image
78
- fig_ref = Figure ()
79
- makecpt (C = "oleron" , T = "-4500/4500" )
80
- fig_ref .grdimage (grid , J = "W0/6i" )
81
-
82
- fig_test = Figure ()
83
- makecpt (cmap = "oleron" , series = "-4500/4500" )
84
- fig_test .grdimage (grid , projection = "W0/6i" )
85
- return fig_ref , fig_test
76
+ fig = Figure ()
77
+ makecpt (cmap = "oleron" , series = [- 4500 , 4500 ])
78
+ fig .grdimage (grid , projection = "W0/10c" )
79
+ return fig
86
80
87
81
88
- def test_makecpt_output_to_cpt_file ():
82
+ def test_makecpt_output_cpt_file ():
89
83
"""
90
84
Save the generated static color palette table to a .cpt file.
91
85
"""
@@ -111,35 +105,13 @@ def test_makecpt_invalid_output():
111
105
112
106
113
107
@pytest .mark .mpl_image_compare
114
- def test_makecpt_truncated_to_zlow_zhigh (grid ):
108
+ def test_makecpt_truncated_zlow_zhigh (grid ):
115
109
"""
116
110
Use static color palette table that is truncated to z-low and z-high.
117
111
"""
118
112
fig = Figure ()
119
113
makecpt (cmap = "rainbow" , truncate = [0.15 , 0.85 ], series = [- 4500 , 4500 ])
120
- fig .grdimage (grid , projection = "W0/6i" )
121
- return fig
122
-
123
-
124
- @pytest .mark .mpl_image_compare
125
- def test_makecpt_truncated_at_zlow_only (grid ):
126
- """
127
- Use static color palette table that is truncated at z-low only.
128
- """
129
- fig = Figure ()
130
- makecpt (cmap = "rainbow" , truncate = [0.5 , None ], series = [- 4500 , 4500 ])
131
- fig .grdimage (grid , projection = "W0/6i" )
132
- return fig
133
-
134
-
135
- @pytest .mark .mpl_image_compare
136
- def test_makecpt_truncated_at_zhigh_only (grid ):
137
- """
138
- Use static color palette table that is truncated at z-high only.
139
- """
140
- fig = Figure ()
141
- makecpt (cmap = "rainbow" , truncate = [None , 0.5 ], series = [- 4500 , 4500 ])
142
- fig .grdimage (grid , projection = "W0/6i" )
114
+ fig .grdimage (grid , projection = "W0/10c" )
143
115
return fig
144
116
145
117
@@ -150,18 +122,7 @@ def test_makecpt_reverse_color_only(grid):
150
122
"""
151
123
fig = Figure ()
152
124
makecpt (cmap = "earth" , reverse = True )
153
- fig .grdimage (grid , projection = "W0/6i" )
154
- return fig
155
-
156
-
157
- @pytest .mark .mpl_image_compare
158
- def test_makecpt_reverse_zsign_only (grid ):
159
- """
160
- Use static color palette table with its z-value sign reversed.
161
- """
162
- fig = Figure ()
163
- makecpt (cmap = "earth" , reverse = "z" )
164
- fig .grdimage (grid , projection = "W0/6i" )
125
+ fig .grdimage (grid , projection = "W0/10c" )
165
126
return fig
166
127
167
128
@@ -173,7 +134,7 @@ def test_makecpt_reverse_color_and_zsign(grid):
173
134
"""
174
135
fig = Figure ()
175
136
makecpt (cmap = "earth" , reverse = "cz" )
176
- fig .grdimage (grid , projection = "W0/6i " )
137
+ fig .grdimage (grid , projection = "W0/10c " )
177
138
return fig
178
139
179
140
@@ -184,39 +145,31 @@ def test_makecpt_continuous(grid):
184
145
scaled from -4500 to 4500m.
185
146
"""
186
147
fig = Figure ()
187
- makecpt (cmap = "blue,white" , continuous = True , series = " -4500,4500" )
188
- fig .grdimage (grid , projection = "W0/6i " )
148
+ makecpt (cmap = "blue,white" , continuous = True , series = [ - 4500 , 4500 ] )
149
+ fig .grdimage (grid , projection = "W0/10c " )
189
150
return fig
190
151
191
152
192
- @check_figures_equal ()
153
+ @pytest . mark . mpl_image_compare
193
154
def test_makecpt_categorical (region ):
194
155
"""
195
156
Use static color palette table that is categorical.
196
157
"""
197
- fig_ref = Figure ()
198
- makecpt (C = "categorical" , W = "" )
199
- fig_ref .colorbar (cmap = True , region = region , frame = True , position = "JBC" )
200
-
201
- fig_test = Figure ()
158
+ fig = Figure ()
202
159
makecpt (cmap = "categorical" , categorical = True )
203
- fig_test .colorbar (cmap = True , region = region , frame = True , position = "JBC" )
204
- return fig_ref , fig_test
160
+ fig .colorbar (cmap = True , region = region , frame = True , position = "JBC" )
161
+ return fig
205
162
206
163
207
- @check_figures_equal ()
164
+ @pytest . mark . mpl_image_compare
208
165
def test_makecpt_cyclic (region ):
209
166
"""
210
167
Use static color palette table that is cyclic.
211
168
"""
212
- fig_ref = Figure ()
213
- makecpt (C = "cork" , W = "w" )
214
- fig_ref .colorbar (cmap = True , region = region , frame = True , position = "JBC" )
215
-
216
- fig_test = Figure ()
169
+ fig = Figure ()
217
170
makecpt (cmap = "cork" , cyclic = True )
218
- fig_test .colorbar (cmap = True , region = region , frame = True , position = "JBC" )
219
- return fig_ref , fig_test
171
+ fig .colorbar (cmap = True , region = region , frame = True , position = "JBC" )
172
+ return fig
220
173
221
174
222
175
def test_makecpt_categorical_and_cyclic ():
0 commit comments