@@ 81-90 (lines=10) @@ | ||
78 | assert_almost_equal(v, 1.7392601775853547 * units('m/s'), 7) |
|
79 | ||
80 | ||
81 | def test_bunkers_motion(): |
|
82 | """Test Bunkers storm motion with observed sounding.""" |
|
83 | with UseSampleData(): |
|
84 | data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming') |
|
85 | motion = concatenate(bunkers_storm_motion(data.variables['pressure'][:], |
|
86 | data.variables['u_wind'][:], data.variables['v_wind'][:], |
|
87 | data.variables['height'][:])) |
|
88 | truth = [1.4537892577864744, 2.0169333025630616, 10.587950761120482, 13.915130377372801, |
|
89 | 6.0208700094534775, 7.9660318399679308] * units('m/s') |
|
90 | assert_almost_equal(motion.flatten(), truth, 8) |
|
91 | ||
92 | ||
93 | def test_bulk_shear(): |
|
@@ 55-66 (lines=12) @@ | ||
52 | ||
53 | ||
54 | def test_mean_pressure_weighted(): |
|
55 | """Test pressure-weighted mean wind function with vertical interpolation.""" |
|
56 | with UseSampleData(): |
|
57 | data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming') |
|
58 | u, v = mean_pressure_weighted(data.variables['pressure'][:], |
|
59 | data.variables['u_wind'][:], |
|
60 | data.variables['v_wind'][:], |
|
61 | heights=data.variables['height'][:], |
|
62 | depth=6000 * units('meter')) |
|
63 | assert_almost_equal(u, 6.0208700094534775 * units('m/s'), 7) |
|
64 | assert_almost_equal(v, 7.966031839967931 * units('m/s'), 7) |
|
65 | ||
66 | ||
67 | def test_mean_pressure_weighted_elevated(): |
|
68 | """Test pressure-weighted mean wind function with a base above the surface.""" |
|
69 | with UseSampleData(): |
|
@@ 93-101 (lines=9) @@ | ||
90 | assert_almost_equal(motion.flatten(), truth, 8) |
|
91 | ||
92 | ||
93 | def test_bulk_shear(): |
|
94 | """Test bulk shear with observed sounding.""" |
|
95 | with UseSampleData(): |
|
96 | data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming') |
|
97 | u, v = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], |
|
98 | data.variables['v_wind'][:], heights=data.variables['height'][:], |
|
99 | depth=6000 * units('meter')) |
|
100 | truth = [29.899581266946115, -14.389225800205509] * units('knots') |
|
101 | assert_almost_equal(u.to('knots'), truth[0], 8) |
|
102 | assert_almost_equal(v.to('knots'), truth[1], 8) |
|
103 | ||
104 |