Skip to content

Commit 5d67a67

Browse files
committed
Test vector plots
1 parent 69ff70d commit 5d67a67

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

lib/iris/tests/integration/plot/test_vector_plots.py

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
if tests.MPL_AVAILABLE:
2525
import matplotlib.pyplot as plt
2626

27-
from iris.plot import quiver
27+
from iris.plot import barbs, quiver
2828

2929

3030
@tests.skip_plot
3131
class MixinVectorPlotCases:
3232
"""
33-
Test examples mixin, used by separate quiver + streamplot classes.
33+
Test examples mixin, used by separate barb, quiver + streamplot classes.
3434
35-
NOTE: at present for quiver only, as streamplot does not support arbitrary
36-
coordinates.
35+
NOTE: at present for barb and quiver only, as streamplot does not support
36+
arbitrary coordinates.
3737
3838
"""
3939

@@ -193,6 +193,34 @@ def test_circular_longitude(self):
193193
self.plot("circular", u_cube, v_cube, coords=("longitude", "latitude"))
194194

195195

196+
class TestBarbs(MixinVectorPlotCases, tests.GraphicsTest):
197+
def setUp(self):
198+
super().setUp()
199+
200+
@staticmethod
201+
def _nonlatlon_xyuv():
202+
# Increase the range of wind speeds used in the barbs test to test more
203+
# barbs shapes than just circles
204+
x, y, u, v = MixinVectorPlotCases._nonlatlon_xyuv()
205+
scale_factor = 50
206+
u *= scale_factor
207+
v *= scale_factor
208+
return x, y, u, v
209+
210+
@staticmethod
211+
def _latlon_uv_cubes(grid_cube):
212+
# Increase the range of wind speeds used in the barbs test to test all
213+
# barbs shapes
214+
u_cube, v_cube = MixinVectorPlotCases._latlon_uv_cubes(grid_cube)
215+
scale_factor = 30
216+
u_cube.data *= scale_factor
217+
v_cube.data *= scale_factor
218+
return u_cube, v_cube
219+
220+
def plot_function_to_test(self):
221+
return barbs
222+
223+
196224
class TestQuiver(MixinVectorPlotCases, tests.GraphicsTest):
197225
def setUp(self):
198226
super().setUp()

lib/iris/tests/results/imagerepo.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@
177177
"iris.tests.integration.plot.test_plot_2d_coords.Test2dContour.test_2d_coords_contour.0": [
178178
"https://scitools.github.io/test-iris-imagehash/images/v4/b4b2643ecb05cb43b0f23d80c53c4e1d3e5990eb1f81c19f2f983cb1c4ff3e42.png"
179179
],
180+
"iris.tests.integration.plot.test_vector_plots.TestBarbs.test_2d_plain_latlon.0": [
181+
"https://scitools.github.io/test-iris-imagehash/images/v4/eb036726c47c9273918e6e2c6f216336787590eb969a165890ee6c676925b3b3.png"
182+
],
183+
"iris.tests.integration.plot.test_vector_plots.TestBarbs.test_2d_plain_latlon_on_polar_map.0": [
184+
"https://scitools.github.io/test-iris-imagehash/images/v4/e66d673c999031cd6667663398dc332c676364e798959336636660d933998666.png"
185+
],
186+
"iris.tests.integration.plot.test_vector_plots.TestBarbs.test_2d_rotated_latlon.0": [
187+
"https://scitools.github.io/test-iris-imagehash/images/v4/eba037a4c479c273b2963f2c6f6126966865d86f969e33c9b1706c26692793b0.png"
188+
],
189+
"iris.tests.integration.plot.test_vector_plots.TestBarbs.test_non_latlon_1d_coords.0": [
190+
"https://scitools.github.io/test-iris-imagehash/images/v4/a7ac334934d2e65c72596325b343338cb41c92d9c5b36f65330d379692ca6d6c.png"
191+
],
192+
"iris.tests.integration.plot.test_vector_plots.TestBarbs.test_non_latlon_2d_coords.0": [
193+
"https://scitools.github.io/test-iris-imagehash/images/v4/a7acb36134d2e676627963259343330cb43e92d9c5336e67330d379292ca6d6c.png"
194+
],
180195
"iris.tests.integration.plot.test_vector_plots.TestQuiver.test_2d_plain_latlon.0": [
181196
"https://scitools.github.io/test-iris-imagehash/images/v4/fb8d4f21c472b27e919d2e216f216b3178e69c7e961ab39a84696c616d245b94.png"
182197
],

0 commit comments

Comments
 (0)