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
28 changes: 28 additions & 0 deletions lib/iris/tests/integration/plot/test_plot_2d_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np

import iris
from iris.analysis.cartography import unrotate_pole
from iris.cube import Cube
from iris.coords import AuxCoord


# Run tests in no graphics mode if matplotlib is not available.
if tests.MPL_AVAILABLE:
Expand Down Expand Up @@ -63,5 +68,28 @@ def test_2d_coord_bounds_northpolarstereo(self):
self.check_graphic()


@tests.skip_plot
class Test2dContour(tests.GraphicsTest):
def test_2d_coords_contour(self):
ny, nx = 4, 6
x1 = np.linspace(-20, 70, nx)
y1 = np.linspace(10, 60, ny)
data = np.zeros((ny, nx))
data.flat[:] = np.arange(nx * ny) % 7
cube = Cube(data, long_name='Odd data')
x2, y2 = np.meshgrid(x1, y1)
true_lons, true_lats = unrotate_pole(x2, y2, -130., 77.)
co_x = AuxCoord(true_lons, standard_name='longitude', units='degrees')
co_y = AuxCoord(true_lats, standard_name='latitude', units='degrees')
cube.add_aux_coord(co_y, (0, 1))
cube.add_aux_coord(co_x, (0, 1))
ax = plt.axes(projection=ccrs.PlateCarree())
qplt.contourf(cube)
ax.coastlines(color='red')
ax.gridlines(draw_labels=True)
ax.set_extent((0, 180, 0, 90))
self.check_graphic()


if __name__ == "__main__":
tests.main()
Loading