diff --git a/src/metpy/calc/kinematics.py b/src/metpy/calc/kinematics.py index 73f8d7a64c..64dc6848f8 100644 --- a/src/metpy/calc/kinematics.py +++ b/src/metpy/calc/kinematics.py @@ -1266,7 +1266,8 @@ def inertial_advective_wind( broadcast=('u', 'v', 'temperature', 'pressure', 'static_stability', 'parallel_scale', 'meridional_scale') ) -@check_units('[speed]', '[speed]', '[temperature]', '[pressure]', '[length]', '[length]') +@check_units('[speed]', '[speed]', '[temperature]', '[pressure]', '[length]', '[length]', + '[energy] / [mass] / [pressure]**2') def q_vector( u, v, @@ -1274,7 +1275,7 @@ def q_vector( pressure, dx=None, dy=None, - static_stability=1, + static_stability=units.Quantity(1, 'J kg^-1 Pa^-2'), x_dim=-1, y_dim=-2, *, diff --git a/tests/calc/test_kinematics.py b/tests/calc/test_kinematics.py index f71a75bc53..08366ecae6 100644 --- a/tests/calc/test_kinematics.py +++ b/tests/calc/test_kinematics.py @@ -1262,12 +1262,12 @@ def test_q_vector_without_static_stability(q_vector_data): [-1.8952185e-13, -2.2269905e-14, -2.2269905e-14, -1.8952185e-13], [-1.9918390e-13, -2.3370829e-14, -2.3370829e-14, -1.9918390e-13], [-5.6160772e-14, -3.5145951e-13, -3.5145951e-13, -5.6160772e-14]]) - * units('m^2 kg^-1 s^-1')) + * units('kg m^-2 s^-3')) q2_truth = (np.array([[-4.4976059e-14, -4.3582378e-13, 4.3582378e-13, 4.4976059e-14], [-3.0124244e-13, -3.5724617e-14, 3.5724617e-14, 3.0124244e-13], [3.1216232e-13, 3.6662900e-14, -3.6662900e-14, -3.1216232e-13], [8.6038280e-14, 4.6968342e-13, -4.6968342e-13, -8.6038280e-14]]) - * units('m^2 kg^-1 s^-1')) + * units('kg m^-2 s^-3')) assert_almost_equal(q1, q1_truth, 16) assert_almost_equal(q2, q2_truth, 16) @@ -1840,7 +1840,7 @@ def test_q_vector_4d(data_4d): [2.50227841e-13, 2.70855069e-13, 4.03362348e-13, 5.22065702e-13], [3.37119836e-13, 3.17667714e-13, 2.25387106e-13, 6.46265259e-13], [2.05548507e-13, 3.55426850e-13, -1.74728156e-14, - 5.04028133e-13]]]]) * units('m^2 kg^-1 s^-1') + 5.04028133e-13]]]]) * units('kg m^-2 s^-3') q2_truth = np.array([[[[3.34318820e-12, -1.32561232e-13, 1.01510711e-12, 6.03331800e-12], [2.51737448e-13, -1.71044158e-13, -8.25290924e-13, 1.68843717e-13], [-3.50533924e-12, -1.68864979e-12, 7.74026063e-13, 1.53811977e-12], @@ -1884,7 +1884,7 @@ def test_q_vector_4d(data_4d): [-1.39578146e-13, -1.36744814e-13, 3.12352497e-14, 4.55339789e-13], [-1.06614836e-13, -2.19878930e-13, -8.37992151e-14, 1.87868902e-13], [-2.27057581e-13, -2.74474045e-13, -1.10759455e-13, - -3.90242255e-13]]]]) * units('m^2 kg^-1 s^-1') + -3.90242255e-13]]]]) * units('kg m^-2 s^-3') assert_array_almost_equal(q1.data, q1_truth, 15) assert_array_almost_equal(q2.data, q2_truth, 15)