Skip to content

Commit

Permalink
MNT: Bump test tolerances for Cartopy 0.22
Browse files Browse the repository at this point in the history
Looks like this version tweaked something that introduced very minor
pixel changes that were causing failures.
  • Loading branch information
dopplershift committed Aug 11, 2023
1 parent 766e280 commit b33e472
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
32 changes: 16 additions & 16 deletions tests/plots/test_declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from metpy.units import units


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.005)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02)
@needs_cartopy
def test_declarative_image():
"""Test making an image plot."""
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_declarative_smooth_contour_calculation():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.01)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.021)
@needs_cartopy
def test_declarative_smooth_contour_order():
"""Test making a contour plot using smooth_contour with tuple."""
Expand Down Expand Up @@ -334,7 +334,7 @@ def test_declarative_contour_cam():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.03)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.036)
@needs_cartopy
def test_declarative_contour_options():
"""Test making a contour plot."""
Expand Down Expand Up @@ -364,7 +364,7 @@ def test_declarative_contour_options():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.08)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.082)
@needs_cartopy
def test_declarative_layers_plot_options():
"""Test making a contour plot."""
Expand Down Expand Up @@ -394,7 +394,7 @@ def test_declarative_layers_plot_options():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.0152)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.025)
@needs_cartopy
def test_declarative_contour_convert_units():
"""Test making a contour plot."""
Expand Down Expand Up @@ -468,7 +468,7 @@ def test_declarative_events():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.009)
@needs_cartopy
def test_declarative_raster_events():
"""Test that resetting traitlets properly propagates in RasterPlot()."""
Expand Down Expand Up @@ -589,7 +589,7 @@ def test_projection_object(ccrs, cfeature):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.009)
def test_colorfill(cfeature):
"""Test that we can use ContourFillPlot."""
data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))
Expand All @@ -614,7 +614,7 @@ def test_colorfill(cfeature):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.0062)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02)
def test_colorfill_with_image_range(cfeature):
"""Test that we can use ContourFillPlot with image_range bounds."""
data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))
Expand All @@ -641,7 +641,7 @@ def test_colorfill_with_image_range(cfeature):


@pytest.mark.mpl_image_compare(
remove_text=True, tolerance=0.0062, filename='test_colorfill_with_image_range.png'
remove_text=True, tolerance=0.02, filename='test_colorfill_with_image_range.png'
)
def test_colorfill_with_normalize_instance_image_range(cfeature):
"""Test that we can use ContourFillPlot with image_range bounds."""
Expand All @@ -668,7 +668,7 @@ def test_colorfill_with_normalize_instance_image_range(cfeature):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02)
def test_colorfill_horiz_colorbar(cfeature):
"""Test that we can use ContourFillPlot with a horizontal colorbar."""
data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))
Expand All @@ -693,7 +693,7 @@ def test_colorfill_horiz_colorbar(cfeature):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.0062)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02)
def test_colorfill_no_colorbar(cfeature):
"""Test that we can use ContourFillPlot with no colorbar."""
data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))
Expand Down Expand Up @@ -891,7 +891,7 @@ def test_declarative_arrow_changes():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.5)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.51)
@needs_cartopy
def test_declarative_barb_earth_relative():
"""Test making a contour plot."""
Expand Down Expand Up @@ -969,7 +969,7 @@ def test_declarative_overlay_projections():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.021)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.026)
@needs_cartopy
def test_declarative_gridded_scale():
"""Test making a contour plot."""
Expand Down Expand Up @@ -1217,7 +1217,7 @@ def test_plotobs_subset_time_window_level(sample_obs):
pd.testing.assert_frame_equal(obs.obsdata, truth)


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.016)
def test_plotobs_units_with_formatter(ccrs):
"""Test using PlotObs with a field that both has units and a custom formatter."""
df = pd.read_csv(get_test_data('SFC_obs.csv', as_file_obj=False),
Expand Down Expand Up @@ -1285,7 +1285,7 @@ def test_declarative_sfc_obs(ccrs):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.016)
@needs_cartopy
def test_declarative_sfc_text():
"""Test making a surface observation plot with text."""
Expand Down Expand Up @@ -1760,7 +1760,7 @@ def test_declarative_contour_label_fontsize():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02)
@needs_cartopy
def test_declarative_raster():
"""Test making a raster plot."""
Expand Down
10 changes: 5 additions & 5 deletions tests/plots/test_plot_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest


@pytest.mark.mpl_image_compare(tolerance=0.005)
@pytest.mark.mpl_image_compare(tolerance=0.023)
def test_uslcc_plotting(ccrs, cfeature):
"""Test plotting the uslcc area with projection."""
from metpy.plots import named_areas
Expand All @@ -27,7 +27,7 @@ def test_uslcc_plotting(ccrs, cfeature):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.005)
@pytest.mark.mpl_image_compare(tolerance=0.016)
def test_au_plotting(ccrs, cfeature):
"""Test plotting the au area with projection."""
from metpy.plots import named_areas
Expand All @@ -47,7 +47,7 @@ def test_au_plotting(ccrs, cfeature):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.008)
@pytest.mark.mpl_image_compare(tolerance=0.017)
def test_cn_plotting(ccrs, cfeature):
"""Test plotting the cn area with projection."""
from metpy.plots import named_areas
Expand All @@ -67,7 +67,7 @@ def test_cn_plotting(ccrs, cfeature):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.005)
@pytest.mark.mpl_image_compare(tolerance=0.016)
def test_hi_plotting(ccrs, cfeature):
"""Test plotting the hi area with projection."""
from metpy.plots import named_areas
Expand All @@ -87,7 +87,7 @@ def test_hi_plotting(ccrs, cfeature):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.005)
@pytest.mark.mpl_image_compare(tolerance=0.016)
def test_wpac_plotting(ccrs, cfeature):
"""Test plotting the wpac area with projection."""
from metpy.plots import named_areas
Expand Down
2 changes: 1 addition & 1 deletion tests/plots/test_station_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def test_barb_projection(wind_plot, ccrs):
return fig


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.01)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.023)
def test_arrow_projection(wind_plot, ccrs):
"""Test that arrows are properly projected."""
u, v, x, y = wind_plot
Expand Down

0 comments on commit b33e472

Please sign in to comment.