Code Duplication    Length = 10-12 lines in 2 locations

metpy/calc/tests/test_indices.py 2 locations

@@ 38-49 (lines=12) @@
35
    assert_almost_equal(v, 7.966031839967931 * units('m/s'), 7)
36
37
38
def test_mean_pressure_weighted_elevated():
39
    """Test pressure-weighted mean wind function with a base above the surface."""
40
    with UseSampleData():
41
        data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
42
    u, v = mean_pressure_weighted(data.variables['pressure'][:],
43
                                  data.variables['u_wind'][:],
44
                                  data.variables['v_wind'][:],
45
                                  heights=data.variables['height'][:],
46
                                  depth=3000 * units('meter'),
47
                                  bottom=data.variables['height'][0] + 3000 * units('meter'))
48
    assert_almost_equal(u, 8.270829843626476 * units('m/s'), 7)
49
    assert_almost_equal(v, 1.7392601775853547 * units('m/s'), 7)
50
51
52
def test_bunkers_motion():
@@ 64-73 (lines=10) @@
61
    assert_almost_equal(motion.flatten(), truth, 8)
62
63
64
def test_bulk_shear():
65
    """Test bulk shear with observed sounding."""
66
    with UseSampleData():
67
        data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
68
    u, v = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:],
69
                      data.variables['v_wind'][:], heights=data.variables['height'][:],
70
                      depth=6000 * units('meter'))
71
    truth = [29.899581266946115, -14.389225800205509] * units('knots')
72
    assert_almost_equal(u.to('knots'), truth[0], 8)
73
    assert_almost_equal(v.to('knots'), truth[1], 8)
74
75
76
def test_bulk_shear_elevated():