Skip to content

Commit

Permalink
Merge pull request #3474 from Unidata/dependabot-pip-ci-cartopy-0.23.0
Browse files Browse the repository at this point in the history
CI: (deps): Bump cartopy from 0.22.0 to 0.23.0 in /ci
  • Loading branch information
dopplershift authored Jul 25, 2024
2 parents eaf608d + afbd01e commit b01c60e
Show file tree
Hide file tree
Showing 31 changed files with 64 additions and 31 deletions.
2 changes: 1 addition & 1 deletion ci/extra_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cartopy==0.22.0
cartopy==0.23.0
dask==2024.7.1
shapely==2.0.5
9 changes: 7 additions & 2 deletions src/metpy/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
import contextlib
import functools
from importlib.metadata import requires, version
from importlib.metadata import PackageNotFoundError, requires, version
import operator as op
import re

Expand Down Expand Up @@ -55,7 +55,12 @@ def version_check(version_spec):
metadata_spec = _get_metadata_spec(module_name)
_, _, minimum_version_number = _parse_version_spec(metadata_spec)

installed_version = Version(version(module_name))
try:
installed_version = Version(version(module_name))
except PackageNotFoundError:
# Package not installed considered false condition for spec
return False

specified_version = Version(version_number)
minimum_version = Version(minimum_version_number)

Expand Down
Binary file modified tests/plots/baseline/test_au_plotting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_colorfill_no_colorbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_colorfill_with_image_range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_barb_gfs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_barb_gfs_knots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_colorbar_fontsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_contour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_contour_convert_units.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_contour_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_figsize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_gridded_scale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_layers_plot_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_region_modifier_zoom_out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs_args.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs_change_units.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_sfc_obs_changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_smooth_contour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_smooth_contour_order.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_declarative_smooth_field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_us_states_scales.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_uslcc_plotting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion tests/plots/test_cartopy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest

import metpy.plots as mpplots
from metpy.testing import version_check


@pytest.mark.mpl_image_compare(tolerance=0.053, remove_text=True)
Expand Down Expand Up @@ -48,7 +49,8 @@ def test_us_states_defaults(ccrs):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.092, remove_text=True)
@pytest.mark.mpl_image_compare(tolerance=0.248 if version_check('cartopy<0.23') else 0.,
remove_text=True)
def test_us_states_scales(ccrs):
"""Test the default US States plotting with all scales."""
proj = ccrs.LambertConformal(central_longitude=-85.0, central_latitude=45.0)
Expand Down
70 changes: 45 additions & 25 deletions tests/plots/test_declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def test_declarative_four_dims_error():
pc.draw()


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.096)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.163 if version_check('cartopy<0.23') else 0.09)
@needs_cartopy
def test_declarative_contour():
"""Test making a contour plot."""
Expand Down Expand Up @@ -151,7 +152,8 @@ def test_declarative_titles():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.101)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.159 if version_check('cartopy<0.23') else 0.066)
@needs_cartopy
def test_declarative_smooth_contour():
"""Test making a contour plot using smooth_contour."""
Expand Down Expand Up @@ -180,7 +182,8 @@ def test_declarative_smooth_contour():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.121)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.155 if version_check('cartopy<0.23') else 0.006)
@needs_cartopy
def test_declarative_smooth_contour_calculation():
"""Test making a contour plot using smooth_contour."""
Expand Down Expand Up @@ -222,7 +225,8 @@ def test_declarative_smooth_contour_calculation():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.034)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.142 if version_check('cartopy<0.23') else 0.0038)
@needs_cartopy
def test_declarative_smooth_contour_order():
"""Test making a contour plot using smooth_contour with tuple."""
Expand Down Expand Up @@ -251,7 +255,8 @@ def test_declarative_smooth_contour_order():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.063)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.114 if version_check('cartopy<0.23') else 0.058)
@needs_cartopy
def test_declarative_figsize():
"""Test having an all float figsize."""
Expand Down Expand Up @@ -279,7 +284,8 @@ def test_declarative_figsize():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.039)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.104 if version_check('cartopy<0.23') else 0.031)
@needs_cartopy
def test_declarative_smooth_field():
"""Test the smoothing of the field with smooth_field trait."""
Expand Down Expand Up @@ -367,7 +373,8 @@ def test_declarative_contour_options():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.085)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.152 if version_check('cartopy<0.23') else 0.009)
@needs_cartopy
def test_declarative_layers_plot_options():
"""Test declarative layer options of edgecolor and linewidth."""
Expand Down Expand Up @@ -397,7 +404,8 @@ def test_declarative_layers_plot_options():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.021)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.055 if version_check('cartopy<0.23') else 0.009)
@needs_cartopy
def test_declarative_additional_layers_plot_options():
"""Test additional declarative layer options of linestyle, zorder, and alpha."""
Expand Down Expand Up @@ -432,7 +440,9 @@ def test_declarative_additional_layers_plot_options():

@pytest.mark.mpl_image_compare(
remove_text=True,
tolerance=2.74 if version_check('matplotlib<3.8') else 1.91)
tolerance=(
3.34 if version_check('cartopy<0.23') else
2.74 if version_check('matplotlib<3.8') else 1.91))
@needs_cartopy
def test_declarative_contour_convert_units():
"""Test making a contour plot."""
Expand Down Expand Up @@ -468,7 +478,6 @@ def test_declarative_contour_convert_units():
def test_declarative_events():
"""Test that resetting traitlets properly propagates."""
data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))

contour = ContourPlot()
contour.data = data
contour.field = 'Temperature'
Expand Down Expand Up @@ -658,7 +667,8 @@ def test_colorfill():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.238 if version_check('cartopy<0.23') else 0.004)
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 @@ -685,7 +695,9 @@ def test_colorfill_with_image_range(cfeature):


@pytest.mark.mpl_image_compare(
remove_text=True, tolerance=0.02, filename='test_colorfill_with_image_range.png'
remove_text=True,
tolerance=0.238 if version_check('cartopy<0.23') else 0.004,
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 Down Expand Up @@ -763,7 +775,8 @@ def test_colorbar_kwargs(cfeature):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.02)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.370 if version_check('cartopy<0.23') else 0.005)
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 @@ -1041,7 +1054,8 @@ def test_declarative_overlay_projections():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.047)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.133 if version_check('cartopy<0.23') else 0.0094)
@needs_cartopy
def test_declarative_gridded_scale():
"""Test making a contour plot."""
Expand Down Expand Up @@ -1099,7 +1113,7 @@ def test_declarative_global_gfs():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=1.05)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=1.42)
@needs_cartopy
def test_declarative_barb_gfs():
"""Test making a contour plot."""
Expand Down Expand Up @@ -1128,7 +1142,7 @@ def test_declarative_barb_gfs():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.607)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.665)
@needs_cartopy
def test_declarative_barb_scale():
"""Test making a contour plot."""
Expand Down Expand Up @@ -1158,7 +1172,7 @@ def test_declarative_barb_scale():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.668)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.722)
@needs_cartopy
def test_declarative_barb_gfs_knots():
"""Test making a contour plot."""
Expand Down Expand Up @@ -1334,7 +1348,8 @@ def test_plotobs_units_with_formatter(ccrs, pandas_sfc):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.025)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.081 if version_check('cartopy<0.23') else 0.025)
def test_declarative_sfc_obs(ccrs, pandas_sfc):
"""Test making a surface observation plot."""
obs = PlotObs()
Expand Down Expand Up @@ -1363,7 +1378,8 @@ def test_declarative_sfc_obs(ccrs, pandas_sfc):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.025)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.075 if version_check('cartopy<0.23') else 0.)
def test_declarative_sfc_obs_args(ccrs, pandas_sfc):
"""Test making a surface observation plot with mpl arguments."""
obs = PlotObs()
Expand Down Expand Up @@ -1424,7 +1440,8 @@ def test_declarative_sfc_text(pandas_sfc):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.025)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.081 if version_check('cartopy<0.23') else 0.)
def test_declarative_sfc_obs_changes(ccrs, pandas_sfc):
"""Test making a surface observation plot, changing the field."""
obs = PlotObs()
Expand Down Expand Up @@ -1486,7 +1503,7 @@ def test_declarative_colored_barbs(ccrs, pandas_sfc):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.305)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.314)
def test_declarative_sfc_obs_full(ccrs, pandas_sfc):
"""Test making a full surface observation plot."""
obs = PlotObs()
Expand Down Expand Up @@ -1663,7 +1680,8 @@ def test_attribute_error_station(ccrs, pandas_sfc):
plt.close(pc.figure)


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.024)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.082 if version_check('cartopy<0.23') else 0.)
def test_declarative_sfc_obs_change_units(ccrs):
"""Test making a surface observation plot."""
data = parse_metar_file(get_test_data('metar_20190701_1200.txt', as_file_obj=False),
Expand Down Expand Up @@ -1696,7 +1714,8 @@ def test_declarative_sfc_obs_change_units(ccrs):
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.022)
@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=0.125 if version_check('cartopy<0.23') else 0.0)
def test_declarative_multiple_sfc_obs_change_units(ccrs):
"""Test making a surface observation plot."""
data = parse_metar_file(get_test_data('metar_20190701_1200.txt', as_file_obj=False),
Expand Down Expand Up @@ -1761,7 +1780,8 @@ def test_declarative_title_fontsize():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=False, tolerance=0.607)
@pytest.mark.mpl_image_compare(remove_text=False,
tolerance=0.951 if version_check('cartopy<0.23') else 0.)
@needs_cartopy
def test_declarative_colorbar_fontsize():
"""Test adjusting the font size of a colorbar."""
Expand Down Expand Up @@ -1933,7 +1953,7 @@ def test_declarative_region_modifier_zoom_in():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.338)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.377)
@needs_cartopy
def test_declarative_region_modifier_zoom_out():
"""Test that '-' suffix on area string properly expands extent of map."""
Expand Down
4 changes: 4 additions & 0 deletions tests/plots/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import pytest

from metpy.testing import version_check

ccrs = pytest.importorskip('cartopy.crs')

from metpy.plots.mapping import CFProjection # noqa: E402
Expand Down Expand Up @@ -147,13 +149,15 @@ def test_lcc():
assert crs.globe.to_proj4_params()['ellps'] == 'sphere'


@pytest.mark.xfail(version_check('cartopy==0.23.0'), reason='SciTools/cartopy#2377')
def test_lcc_minimal():
"""Test handling lambert conformal conic projection with minimal attributes."""
attrs = {'grid_mapping_name': 'lambert_conformal_conic'}
crs = CFProjection(attrs).to_cartopy()
assert isinstance(crs, ccrs.LambertConformal)


@pytest.mark.xfail(version_check('cartopy==0.23.0'), reason='SciTools/cartopy#2377')
def test_lcc_single_std_parallel():
"""Test lambert conformal projection with one standard parallel."""
attrs = {'grid_mapping_name': 'lambert_conformal_conic', 'standard_parallel': 25}
Expand Down
6 changes: 4 additions & 2 deletions tests/plots/test_plot_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import matplotlib.pyplot as plt
import pytest

from metpy.testing import version_check

@pytest.mark.mpl_image_compare(tolerance=0.023)

@pytest.mark.mpl_image_compare(tolerance=0.555 if version_check('cartopy<0.23') else 0.002)
def test_uslcc_plotting(ccrs, cfeature):
"""Test plotting the uslcc area with projection."""
from metpy.plots import named_areas
Expand All @@ -27,7 +29,7 @@ def test_uslcc_plotting(ccrs, cfeature):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.016)
@pytest.mark.mpl_image_compare(tolerance=0.119 if version_check('cartopy<0.23') else 0.)
def test_au_plotting(ccrs, cfeature):
"""Test plotting the au area with projection."""
from metpy.plots import named_areas
Expand Down

0 comments on commit b01c60e

Please sign in to comment.