Skip to content

Commit

Permalink
fix climate
Browse files Browse the repository at this point in the history
  • Loading branch information
wx4stg committed Oct 30, 2023
1 parent d0d86ae commit 76a5da3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/metpy/calc/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def corfidi_storm_motion(pressure, u, v, *, u_llj=None, v_llj=None):
# If LLJ specified, use that
if u_llj is not None and v_llj is not None:
# find inverse of low-level jet
llj_inverse = units.Quantity.from_list((-1*u_llj, -1*v_llj))
llj_inverse = units.Quantity.from_list((-1 * u_llj, -1 * v_llj))
# If pressure values contain values below 850 hPa, find low-level jet
elif np.max(pressure) >= units.Quantity(850, 'hectopascal'):
# convert u/v wind to wind speed and direction
Expand Down
16 changes: 8 additions & 8 deletions tests/calc/test_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,22 @@ def test_corfidi_motion():
assert_almost_equal(motion_full.flatten(), truth_full, 8)

motion_override = concatenate(corfidi_storm_motion(data['pressure'],
data['u_wind'], data['v_wind'],
u_llj=0*units('kt'),
v_llj=0*units('kt')))
data['u_wind'], data['v_wind'],
u_llj=0 * units('kt'),
v_llj=0 * units('kt')))
truth_override = [17.72560506, 10.48701063,
35.45121012, 20.97402126] * units('kt')
assert_almost_equal(motion_override.flatten(), truth_override, 8)

with pytest.raises(ValueError):
corfidi_storm_motion(data['pressure'][6:], data['u_wind'][6:], data['v_wind'][6:])

motion_no_top = concatenate(corfidi_storm_motion(data['pressure'][:37],
data['u_wind'][:37], data['v_wind'][:37]))
truth_no_top = [20.40419260, -21.43467629,
37.93224569, -9.99492754] * units('kt')
assert_almost_equal(motion_no_top.flatten(), truth_no_top, 8)

u_with_nans = data['u_wind']
u_with_nans[6:10] = np.nan
v_with_nans = data['v_wind']
Expand All @@ -211,11 +211,11 @@ def test_corfidi_motion():
truth_with_nans = [20.01078763, -22.65208606,
37.14543575, -12.42974709] * units('kt')
assert_almost_equal(motion_with_nans.flatten(), truth_with_nans, 8)

with pytest.raises(ValueError):
corfidi_storm_motion(data['pressure'], data['u_wind'],
data['v_wind'], u_llj=10 * units('kt'))

with pytest.raises(ValueError):
corfidi_storm_motion(data['pressure'], data['u_wind'],
data['v_wind'], v_llj=10 * units('kt'))
Expand Down

0 comments on commit 76a5da3

Please sign in to comment.