Code Duplication    Length = 15-16 lines in 2 locations

metpy/plots/tests/test_skewt.py 2 locations

@@ 180-195 (lines=16) @@
177
    return fig
178
179
180
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
181
def test_hodograph_plot_layers():
182
    """Test hodograph colored height layers with interpolation."""
183
    u = np.arange(5, 65, 5) * units('knot')
184
    v = np.arange(-5, -65, -5) * units('knot')
185
    h = [178, 213, 610, 656, 721, 914, 1060,
186
         1219, 1372, 1412, 1512, 1524] * units('meter')
187
    colors = ['red', 'green']
188
    levels = [0, 500, 1000] * units('meter')
189
    fig = plt.figure(figsize=(9, 9))
190
    ax = fig.add_subplot(1, 1, 1)
191
    hodo = Hodograph(ax, component_range=80)
192
    hodo.add_grid(increment=20, color='k')
193
    hodo.plot_colormapped(u, v, h, bounds=levels, colors=colors)
194
195
    return fig
196
197
198
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
@@ 198-212 (lines=15) @@
195
    return fig
196
197
198
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
199
def test_hodograph_plot_arbitrary_layer():
200
    """Test hodograph colored layers for arbitrary variables without interpolation."""
201
    u = np.arange(5, 65, 5) * units('knot')
202
    v = np.arange(-5, -65, -5) * units('knot')
203
    speed = np.sqrt(u ** 2 + v ** 2)
204
    colors = ['red', 'green', 'blue']
205
    levels = [0, 10, 20, 30] * units('knot')
206
    fig = plt.figure(figsize=(9, 9))
207
    ax = fig.add_subplot(1, 1, 1)
208
    hodo = Hodograph(ax, component_range=80)
209
    hodo.add_grid(increment=20, color='k')
210
    hodo.plot_colormapped(u, v, speed, bounds=levels, colors=colors)
211
212
    return fig
213