Skip to content

Commit

Permalink
MNT: Remove outdated CartoPy work-around (Fixes #1229)
Browse files Browse the repository at this point in the history
This was working around CartoPy <=0.14.3 issues for transforming
vectors. Latest CartoPy is 0.17.0. 0.15.0 is almost 3 years old at this
point, I think we can rely on it.
  • Loading branch information
dopplershift committed Dec 23, 2019
1 parent ac8c818 commit 9c8632f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -53,7 +53,7 @@ where = src
[options.extras_require]
dev = ipython[all]>=3.1
doc = sphinx>=2.1; sphinx-gallery>=0.4; doc8; m2r; netCDF4
examples = cartopy>=0.13.1; matplotlib>=2.2.0; pyproj>=1.9.4,!=2.0.0
examples = cartopy>=0.15.0; matplotlib>=2.2.0; pyproj>=1.9.4,!=2.0.0
test = pytest>=2.4; pytest-mpl; pytest-flake8; cartopy>=0.16.0; flake8>3.2.0; flake8-builtins!=1.4.0; flake8-comprehensions; flake8-copyright; flake8-docstrings; flake8-import-order; flake8-mutable; flake8-pep3101; flake8-print; flake8-quotes; flake8-rst-docstrings; pep8-naming; netCDF4; pyproj>=1.9.4,!=2.0.0

[build_sphinx]
Expand Down
32 changes: 2 additions & 30 deletions src/metpy/plots/station_plot.py
Expand Up @@ -5,7 +5,6 @@

from enum import Enum

import matplotlib
import numpy as np

from .wx_symbols import (current_weather, high_clouds, low_clouds, mid_clouds,
Expand Down Expand Up @@ -276,20 +275,7 @@ def plot_barb(self, u, v, **kwargs):
if self.barbs:
self.barbs.remove()

# Handle transforming our center points. CartoPy doesn't like 1D barbs
# TODO: This can be removed for cartopy > 0.14.3
if hasattr(self.ax, 'projection') and 'transform' in kwargs:
trans = kwargs['transform']
try:
kwargs['transform'] = trans._as_mpl_transform(self.ax)
except AttributeError:
pass
u, v = self.ax.projection.transform_vectors(trans, self.x, self.y, u, v)

# Since we've re-implemented CartoPy's barbs, we need to skip calling it here
self.barbs = matplotlib.axes.Axes.barbs(self.ax, self.x, self.y, u, v, **defaults)
else:
self.barbs = self.ax.barbs(self.x, self.y, u, v, **defaults)
self.barbs = self.ax.barbs(self.x, self.y, u, v, **defaults)

def plot_arrow(self, u, v, **kwargs):
r"""At the center of the station model plot wind arrows.
Expand Down Expand Up @@ -328,21 +314,7 @@ def plot_arrow(self, u, v, **kwargs):
if self.arrows:
self.arrows.remove()

# Handle transforming our center points. CartoPy doesn't like 1D arrows
# TODO: This can be removed for cartopy > 0.14.3
if hasattr(self.ax, 'projection') and 'transform' in kwargs:
trans = kwargs['transform']
try:
kwargs['transform'] = trans._as_mpl_transform(self.ax)
except AttributeError:
pass
u, v = self.ax.projection.transform_vectors(trans, self.x, self.y, u, v)

# Since we've re-implemented CartoPy's arrows, we need to skip calling it here
self.arrows = matplotlib.axes.Axes.quiver(self.ax, self.x, self.y, u, v,
**defaults)
else:
self.arrows = self.ax.quiver(self.x, self.y, u, v, **defaults)
self.arrows = self.ax.quiver(self.x, self.y, u, v, **defaults)

@staticmethod
def _plotting_units(u, v, plotting_units):
Expand Down

0 comments on commit 9c8632f

Please sign in to comment.