Code Duplication    Length = 16-17 lines in 2 locations

metpy/plots/tests/test_skewt.py 2 locations

@@ 185-201 (lines=17) @@
182
    return fig
183
184
185
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
186
def test_hodograph_plot_layers():
187
    """Test hodograph colored height layers with interpolation."""
188
    u = np.zeros((6)) * units.knots
189
    v = np.array([0, 10, 20, 30, 40, 50]) * units.knots
190
    heights = np.array([0, 1000, 2000, 3000, 4000, 5000]) * units.m
191
    bounds = np.array([500, 1500, 2500, 3500, 4500]) * units.m
192
    colors = ['r', 'g', 'b', 'r']
193
    fig = plt.figure(figsize=(7, 7))
194
    ax1 = fig.add_subplot(1, 1, 1)
195
    h = Hodograph(ax1)
196
    h.add_grid(increment=10)
197
    h.plot_colormapped(u, v, heights, colors=colors, bounds=bounds)
198
    ax1.set_xlim(-50, 50)
199
    ax1.set_ylim(-5, 50)
200
201
    return fig
202
203
204
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
@@ 204-219 (lines=16) @@
201
    return fig
202
203
204
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)
205
def test_hodograph_plot_layers_different_units():
206
    """Test hodograph colored height layers with interpolation and different units."""
207
    u = np.zeros((6)) * units.knots
208
    v = np.array([0, 10, 20, 30, 40, 50]) * units.knots
209
    heights = np.array([0, 1, 2, 3, 4, 5]) * units.km
210
    bounds = np.array([500, 1500, 2500, 3500, 4500]) * units.m
211
    colors = ['r', 'g', 'b', 'r']
212
    fig = plt.figure(figsize=(7, 7))
213
    ax1 = fig.add_subplot(1, 1, 1)
214
    h = Hodograph(ax1)
215
    h.add_grid(increment=10)
216
    h.plot_colormapped(u, v, heights, colors=colors, bounds=bounds)
217
    ax1.set_xlim(-50, 50)
218
    ax1.set_ylim(-5, 50)
219
    return fig
220
221
222
@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True)