Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/metpy/calc/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ def bunkers_storm_motion(pressure, u, v, height):
Renamed ``heights`` parameter to ``height``

"""
# remove nans from input data
pressure, u, v, height = _remove_nans(pressure, u, v, height)

# mean wind from sfc-6km
wind_mean = weighted_continuous_average(pressure, u, v, height=height,
depth=units.Quantity(6000, 'meter'))
Expand Down
15 changes: 15 additions & 0 deletions tests/calc/test_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,21 @@ def test_bunkers_motion():
assert_almost_equal(motion.flatten(), truth, 8)


def test_bunkers_motion_with_nans():
"""Test Bunkers storm motion with observed sounding."""
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC')
u_with_nan = data['u_wind']
u_with_nan[24:26] = np.nan
v_with_nan = data['v_wind']
v_with_nan[24:26] = np.nan
motion = concatenate(bunkers_storm_motion(data['pressure'],
u_with_nan, v_with_nan,
data['height']))
truth = [2.09232447, 0.97612357, 11.25513401, 12.85227283, 6.67372924,
6.9141982] * units('m/s')
assert_almost_equal(motion.flatten(), truth, 8)


def test_bulk_shear():
"""Test bulk shear with observed sounding."""
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC')
Expand Down