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