Skip to content

Commit

Permalink
Forces x and y to be numpy arrays within StationPlot so that wind bar…
Browse files Browse the repository at this point in the history
…bs can be transformed within cartopy. Raised by an eSupport issue.
  • Loading branch information
zbruick committed Jul 10, 2019
1 parent b1e68bc commit dad1840
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metpy/plots/station_plot.py
Expand Up @@ -59,8 +59,8 @@ def __init__(self, ax, x, y, fontsize=10, spacing=None, transform=None, **kwargs
"""
self.ax = ax
self.x = x
self.y = y
self.x = np.array(x)
self.y = np.array(y)
self.fontsize = fontsize
self.spacing = fontsize if spacing is None else spacing
self.transform = transform
Expand Down
14 changes: 14 additions & 0 deletions metpy/plots/tests/test_station_plot.py
Expand Up @@ -277,6 +277,20 @@ def test_barb_projection():
return fig


def test_barb_projection_list():
"""Test that barbs will be projected when lat/lon lists are provided."""
lat = [38.22, 38.18, 38.25]
lon = [-85.76, -85.86, -85.77]
u = [1.89778964, -3.83776523, 3.64147732] * units('m/s')
v = [1.93480072, 1.31000184, 1.36075552] * units('m/s')

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
stnplot = StationPlot(ax, lon, lat)
stnplot.plot_barb(u, v)
assert stnplot.barbs


@pytest.mark.mpl_image_compare(tolerance={'1.4': 2.28}.get(MPL_VERSION, 0.0048),
remove_text=True)
def test_barb_unit_conversion():
Expand Down

0 comments on commit dad1840

Please sign in to comment.