From 6bdf81bae326153a465d3ac1485b0628e29ec456 Mon Sep 17 00:00:00 2001 From: Thomas Rieutord Date: Wed, 31 Jul 2024 13:03:38 +0100 Subject: [PATCH] Update bulk_richardson_number: fix null wind at bottom (comment #2 in PR #3572) --- src/metpy/calc/boundarylayer.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/metpy/calc/boundarylayer.py b/src/metpy/calc/boundarylayer.py index 1d43ea0ebe..673b3f893e 100644 --- a/src/metpy/calc/boundarylayer.py +++ b/src/metpy/calc/boundarylayer.py @@ -93,13 +93,15 @@ def bulk_richardson_number( `pint.Quantity` Bulk Richardson number profile """ - - u[0] = 0 * units.meter_per_second - v[0] = 0 * units.meter_per_second - + if idxfoot == 0: + # Force the ground level to have null wind + Du = u + Dv = v + else: + Du = u - u[idxfoot] + Dv = v - v[idxfoot] + Dtheta = potential_temperature - potential_temperature[idxfoot] - Du = u - u[idxfoot] - Dv = v - v[idxfoot] Dz = height - height[idxfoot] idx0 = Du**2 + Dv**2 + ustar**2 == 0