Skip to content

Commit

Permalink
TST: Adding a test for pcolormesh wrapping
Browse files Browse the repository at this point in the history
Adds a test of a cell that cross the boundary at a diagonal with
the top edge on one side of the boundary and the bottom edge
on the other.
  • Loading branch information
greglucas committed Aug 7, 2020
1 parent 1238077 commit 24b1edc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/cartopy/tests/mpl/test_mpl_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,22 @@ def test_pcolormesh_single_column_wrap():
ax.set_global()


def test_pcolormesh_diagonal_wrap():
# Check that a cell with the top edge on one side of the domain
# and the bottom edge on the other gets wrapped properly
xs = [[160, 170], [190, 200]]
ys = [[-10, -10], [10, 10]]
zs = [[0, 1], [0, 1]]

ax = plt.axes(projection=ccrs.PlateCarree())
mesh = ax.pcolormesh(xs, ys, zs)

# Check that the quadmesh is masked
assert np.ma.is_masked(mesh.get_array())
# And that the wrapped_collection is added
assert hasattr(mesh, "_wrapped_collection_fix")


@pytest.mark.xfail(MPL_VERSION < '2.1.0', reason='Matplotlib is broken.')
@pytest.mark.natural_earth
@ImageTesting(['pcolormesh_goode_wrap'])
Expand Down

0 comments on commit 24b1edc

Please sign in to comment.