|
24 | 24 | if tests.MPL_AVAILABLE: |
25 | 25 | import matplotlib.pyplot as plt |
26 | 26 |
|
27 | | - from iris.plot import quiver |
| 27 | + from iris.plot import barbs, quiver |
28 | 28 |
|
29 | 29 |
|
30 | 30 | @tests.skip_plot |
31 | 31 | class MixinVectorPlotCases: |
32 | 32 | """ |
33 | | - Test examples mixin, used by separate quiver + streamplot classes. |
| 33 | + Test examples mixin, used by separate barb, quiver + streamplot classes. |
34 | 34 |
|
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. |
37 | 37 |
|
38 | 38 | """ |
39 | 39 |
|
@@ -193,6 +193,34 @@ def test_circular_longitude(self): |
193 | 193 | self.plot("circular", u_cube, v_cube, coords=("longitude", "latitude")) |
194 | 194 |
|
195 | 195 |
|
| 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 | + |
196 | 224 | class TestQuiver(MixinVectorPlotCases, tests.GraphicsTest): |
197 | 225 | def setUp(self): |
198 | 226 | super().setUp() |
|
0 commit comments