|
@@ 52-64 (lines=13) @@
|
| 49 |
|
assert_array_equal(mean6[1], truth[1]) |
| 50 |
|
|
| 51 |
|
|
| 52 |
|
def test_mean_wind_pressure_weighted_elevated(): |
| 53 |
|
"""Test pressure-weighted mean wind function with a base above the surface.""" |
| 54 |
|
with UseSampleData(): |
| 55 |
|
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming') |
| 56 |
|
mean6 = mean_wind_pressure_weighted(data.variables['u_wind'][:], |
| 57 |
|
data.variables['v_wind'][:], |
| 58 |
|
data.variables['pressure'][:], |
| 59 |
|
data.variables['height'][:], |
| 60 |
|
depth=3000 * units('meter'), |
| 61 |
|
bottom=3000 * units('meter')) |
| 62 |
|
truth = [8.270829843626476, 1.7392601775853547] * units('m/s') |
| 63 |
|
assert_array_equal(mean6[0], truth[0]) |
| 64 |
|
assert_array_equal(mean6[1], truth[1]) |
| 65 |
|
|
|
@@ 38-49 (lines=12) @@
|
| 35 |
|
assert_array_equal(mean6[1], truth[1]) |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
def test_mean_wind_pressure_weighted_interp(): |
| 39 |
|
"""Test pressure-weighted mean wind function with vertical interpolation.""" |
| 40 |
|
with UseSampleData(): |
| 41 |
|
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming') |
| 42 |
|
mean6 = mean_wind_pressure_weighted(data.variables['u_wind'][:], |
| 43 |
|
data.variables['v_wind'][:], |
| 44 |
|
data.variables['pressure'][:], |
| 45 |
|
data.variables['height'][:], |
| 46 |
|
depth=6000 * units('meter')) |
| 47 |
|
truth = [6.0208700094534775, 7.966031839967931] * units('m/s') |
| 48 |
|
assert_array_equal(mean6[0], truth[0]) |
| 49 |
|
assert_array_equal(mean6[1], truth[1]) |
| 50 |
|
|
| 51 |
|
|
| 52 |
|
def test_mean_wind_pressure_weighted_elevated(): |
|
@@ 24-35 (lines=12) @@
|
| 21 |
|
assert_array_equal(pw, truth) |
| 22 |
|
|
| 23 |
|
|
| 24 |
|
def test_mean_wind_pressure_weighted(): |
| 25 |
|
"""Test pressure-weighted mean wind function with only obs.""" |
| 26 |
|
with UseSampleData(): |
| 27 |
|
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming') |
| 28 |
|
mean6 = mean_wind_pressure_weighted(data.variables['u_wind'][:], |
| 29 |
|
data.variables['v_wind'][:], |
| 30 |
|
data.variables['pressure'][:], |
| 31 |
|
data.variables['height'][:], |
| 32 |
|
depth=6000 * units('meter'), obs_only=True) |
| 33 |
|
truth = [6.312839043118274, 7.97164506356538] * units('m/s') |
| 34 |
|
assert_array_equal(mean6[0], truth[0]) |
| 35 |
|
assert_array_equal(mean6[1], truth[1]) |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
def test_mean_wind_pressure_weighted_interp(): |