From 83436e8a25d4d209bbce2156f92aec1264eb24d0 Mon Sep 17 00:00:00 2001 From: Drew Camron Date: Tue, 26 Dec 2023 12:48:00 -0700 Subject: [PATCH] Return scalar on profile --- src/metpy/calc/thermo.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/metpy/calc/thermo.py b/src/metpy/calc/thermo.py index ede6a26f2f2..4e7382daabf 100644 --- a/src/metpy/calc/thermo.py +++ b/src/metpy/calc/thermo.py @@ -4622,8 +4622,8 @@ def galvez_davison_index(pressure, temperature, mixing_ratio, surface_pressure, # Calculate adjusted equivalent potential temperatures alpha = units.Quantity(-10, 'K') eptp_a = th950 * np.exp(l_0 * r950 / (mpconsts.Cp_d * t850)) - eptp_b = ((th850 + th700) / 2 * - np.exp(l_0 * (r850 + r700) / 2 / (mpconsts.Cp_d * t850)) + alpha) + eptp_b = ((th850 + th700) / 2 + * np.exp(l_0 * (r850 + r700) / 2 / (mpconsts.Cp_d * t850)) + alpha) eptp_c = th500 * np.exp(l_0 * r500 / (mpconsts.Cp_d * t850)) + alpha # Calculate Column Buoyanci Index (CBI) @@ -4661,10 +4661,15 @@ def galvez_davison_index(pressure, temperature, mixing_ratio, surface_pressure, terrain_correction = 18 - 9000 / (surface_pressure.m_as('hPa') - 500) # Calculate G.D.I. - return (column_buoyancy_index - + mid_tropospheric_warming_index - + inversion_index - + terrain_correction) + gdi = (column_buoyancy_index + + mid_tropospheric_warming_index + + inversion_index + + terrain_correction) + + if gdi.size == 1: + return gdi[0] + else: + return gdi @exporter.export