diff --git a/lib/iris/plot.py b/lib/iris/plot.py index 88f89cc79a..43cf206e0e 100644 --- a/lib/iris/plot.py +++ b/lib/iris/plot.py @@ -1,4 +1,4 @@ -# (C) British Crown Copyright 2010 - 2018, Met Office +# (C) British Crown Copyright 2010 - 2019, Met Office # # This file is part of Iris. # @@ -873,6 +873,10 @@ def _map_common(draw_method_name, arg_func, mode, cube, plot_defn, y = np.append(y, y[:, 0:1], axis=1) x = np.append(x, x[:, 0:1] + 360 * direction, axis=1) data = ma.concatenate([data, data[:, 0:1]], axis=1) + if '_v_data' in kwargs: + v_data = kwargs['_v_data'] + v_data = ma.concatenate([v_data, v_data[:, 0:1]], axis=1) + kwargs['_v_data'] = v_data # Replace non-cartopy subplot/axes with a cartopy alternative and set the # transform keyword. diff --git a/lib/iris/tests/integration/plot/test_vector_plots.py b/lib/iris/tests/integration/plot/test_vector_plots.py index 497ff3549d..7785cc65ed 100644 --- a/lib/iris/tests/integration/plot/test_vector_plots.py +++ b/lib/iris/tests/integration/plot/test_vector_plots.py @@ -167,6 +167,25 @@ def test_fail_unsupported_coord_system(self): self.plot('2d_rotated', u_cube, v_cube, coords=('longitude', 'latitude')) + def test_circular_longitude(self): + # Test circular longitude does not cause a crash. + res = 5 + lat = DimCoord(np.arange(-90, 91, res), 'latitude', + units='degrees_north') + lon = DimCoord(np.arange(0, 360, res), 'longitude', + units='degrees_east', circular=True) + nlat = len(lat.points) + nlon = len(lon.points) + u_arr = np.ones((nlat, nlon)) + v_arr = np.ones((nlat, nlon)) + u_cube = Cube(u_arr, dim_coords_and_dims=[(lat, 0), (lon, 1)], + standard_name='eastward_wind') + v_cube = Cube(v_arr, dim_coords_and_dims=[(lat, 0), (lon, 1)], + standard_name='northward_wind') + + self.plot('circular', u_cube, v_cube, + coords=('longitude', 'latitude')) + class TestQuiver(MixinVectorPlotCases, tests.GraphicsTest): def setUp(self):