Skip to content

Commit

Permalink
TST: Update test images due to changes to skewT transform
Browse files Browse the repository at this point in the history
  • Loading branch information
dopplershift committed Aug 16, 2019
1 parent 91bf02d commit 13eb1e2
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 15 deletions.
Binary file modified metpy/plots/tests/baseline/test_skewt_api.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_arbitrary_rect.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_barb_color.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_barb_unit_conversion.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_gridspec.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_shade_area.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_shade_area_kwargs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_shade_cape_cin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metpy/plots/tests/baseline/test_skewt_subplot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 20 additions & 15 deletions metpy/plots/tests/test_skewt.py
Expand Up @@ -14,10 +14,11 @@
from metpy.testing import patch_round, set_agg_backend # noqa: F401, I202
from metpy.units import units

MPL_VERSION = matplotlib.__version__[:3]
MPL_VERSION = matplotlib.__version__[0]


@pytest.mark.mpl_image_compare(tolerance=0.224, remove_text=True)
@pytest.mark.mpl_image_compare(tolerance={'2': 6.45}.get(MPL_VERSION, 0.02), remove_text=True,
style='default')
def test_skewt_api():
"""Test the SkewT API."""
with matplotlib.rc_context({'axes.autolimit_mode': 'data'}):
Expand All @@ -43,15 +44,15 @@ def test_skewt_api():
return fig


@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='default')
def test_skewt_subplot():
"""Test using SkewT on a sub-plot."""
fig = plt.figure(figsize=(9, 9))
SkewT(fig, subplot=(2, 2, 1))
return fig


@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='default')
def test_skewt_gridspec():
"""Test using SkewT on a sub-plot."""
fig = plt.figure(figsize=(9, 9))
Expand All @@ -67,7 +68,7 @@ def test_skewt_with_grid_enabled():
SkewT()


@pytest.mark.mpl_image_compare(tolerance=0., remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0., remove_text=True, style='default')
def test_skewt_arbitrary_rect():
"""Test placing the SkewT in an arbitrary rectangle."""
fig = plt.figure(figsize=(9, 9))
Expand All @@ -87,8 +88,8 @@ def test_profile():
return np.linspace(1000, 100, 10), np.linspace(20, -20, 10), np.linspace(25, -30, 10)


@pytest.mark.mpl_image_compare(tolerance={'2.0': 1.12}.get(MPL_VERSION, 0.2432),
remove_text=True)
@pytest.mark.mpl_image_compare(tolerance={'2': 0.89}.get(MPL_VERSION, 0.02), remove_text=True,
style='default')
def test_skewt_shade_cape_cin(test_profile):
"""Test shading CAPE and CIN on a SkewT plot."""
p, t, tp = test_profile
Expand All @@ -101,12 +102,12 @@ def test_skewt_shade_cape_cin(test_profile):
skew.shade_cape(p, t, tp)
skew.shade_cin(p, t, tp)
skew.ax.set_xlim(-50, 50)
skew.ax.set_ylim(1000, 100)

return fig


@pytest.mark.mpl_image_compare(tolerance={'1.4': 1.70}.get(MPL_VERSION, 0.2432),
remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_skewt_shade_area(test_profile):
"""Test shading areas on a SkewT plot."""
p, t, tp = test_profile
Expand All @@ -118,6 +119,7 @@ def test_skewt_shade_area(test_profile):
skew.plot(p, tp, 'k')
skew.shade_area(p, t, tp)
skew.ax.set_xlim(-50, 50)
skew.ax.set_ylim(1000, 100)

return fig

Expand All @@ -133,8 +135,7 @@ def test_skewt_shade_area_invalid(test_profile):
skew.shade_area(p, t, tp, which='positve')


@pytest.mark.mpl_image_compare(tolerance={'1.4': 1.75}.get(MPL_VERSION, 0.2432),
remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_skewt_shade_area_kwargs(test_profile):
"""Test shading areas on a SkewT plot with kwargs."""
p, t, tp = test_profile
Expand All @@ -146,10 +147,12 @@ def test_skewt_shade_area_kwargs(test_profile):
skew.plot(p, tp, 'k')
skew.shade_area(p, t, tp, facecolor='m')
skew.ax.set_xlim(-50, 50)
skew.ax.set_ylim(1000, 100)

return fig


@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='mpl20')
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='default')
def test_skewt_wide_aspect_ratio(test_profile):
"""Test plotting a skewT with a wide aspect ratio."""
p, t, tp = test_profile
Expand Down Expand Up @@ -212,7 +215,7 @@ def test_hodograph_plot_colormapped():
return fig


@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='default')
def test_skewt_barb_color():
"""Test plotting colored wind barbs on the Skew-T."""
fig = plt.figure(figsize=(9, 9))
Expand All @@ -225,7 +228,7 @@ def test_skewt_barb_color():
return fig


@pytest.mark.mpl_image_compare(tolerance=0.2, remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='default')
def test_skewt_barb_unit_conversion():
"""Test that barbs units can be converted at plot time (#737)."""
u_wind = np.array([3.63767155210412]) * units('m/s')
Expand All @@ -238,11 +241,12 @@ def test_skewt_barb_unit_conversion():
skew.plot_barbs(p_wind, u_wind, v_wind, plot_units='knots')
skew.ax.set_ylim(1000, 500)
skew.ax.set_yticks([1000, 750, 500])
skew.ax.set_xlim(-20, 20)

return fig


@pytest.mark.mpl_image_compare(tolerance={'1.4': 1.88}.get(MPL_VERSION, 0), remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='default')
def test_skewt_barb_no_default_unit_conversion():
"""Test that barbs units are left alone by default (#737)."""
u_wind = np.array([3.63767155210412]) * units('m/s')
Expand All @@ -255,6 +259,7 @@ def test_skewt_barb_no_default_unit_conversion():
skew.plot_barbs(p_wind, u_wind, v_wind)
skew.ax.set_ylim(1000, 500)
skew.ax.set_yticks([1000, 750, 500])
skew.ax.set_xlim(-20, 20)

return fig

Expand Down

0 comments on commit 13eb1e2

Please sign in to comment.