Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/iris/plot.py
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down Expand Up @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions lib/iris/tests/integration/plot/test_vector_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down