Skip to content

Commit

Permalink
Moved test to already existing script
Browse files Browse the repository at this point in the history
  • Loading branch information
kdpenner committed May 19, 2020
1 parent 947c704 commit c898cf0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 35 deletions.
35 changes: 0 additions & 35 deletions lib/cartopy/tests/mpl/test_alpha.py

This file was deleted.

19 changes: 19 additions & 0 deletions lib/cartopy/tests/mpl/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,22 @@ def test_pil_Image():
def test_background_img():
ax = plt.axes(projection=ccrs.Orthographic())
ax.background_img(name='ne_shaded', resolution='low')


def test_alpha_2d_warp():
# tests that both image and alpha arrays (if alpha is 2D) are warped
plt_crs = ccrs.Geostationary(central_longitude=-155.)
fig = plt.figure(figsize=(5, 5))
ax = fig.add_subplot(1, 1, 1, projection=plt_crs)
latlon_crs = ccrs.PlateCarree()
coords = [-162., -148., 17.5, 23.]
ax.set_extent(coords, crs=latlon_crs)
fake_data = np.zeros([100, 100])
fake_alphas = np.zeros(fake_data.shape)
image = ax.imshow(fake_data, extent=coords, transform=latlon_crs,
alpha=fake_alphas)
plt.close()
image_data = image.get_array()
image_alpha = image.get_alpha()

assert image_data.shape == image_alpha.shape

0 comments on commit c898cf0

Please sign in to comment.