I am wondering to calculate the moist adiabatic lapse rate using metpy function moist_lapse. But this function results a lapse value at each pressure level instead a single lapse rate value across pressure column. As an example :
from metpy.calc import dry_lapse, lcl, moist_lapse
from metpy.units import units
pressure = np.linspace(1000, 700, 301) * units.hPa
Surface_temperature = 25 * units.degC
Dew_point_temperature = 10 * units.degC
## Here "lcl" stands:- lifting condensation level
lcl_pressure, lcl_temperature = lcl(pressure[0], Surface_temperature, Dew_point_temperature)
moist_ascent_pressure = pressure[pressure <= lcl_pressure]
moist_ascent_temperature = moist_lapse(moist_ascent_pressure, lcl_temperature)
Above moist_ascent_temperature
and moist_ascent_pressure
are required array to compute the lapse rate in (°C/km
).
So that the final compute should be like a single rate value e.g., 3°C/km
. I don't know how to compute the rate change directly in python (dt/dz in °C/km) or is there any way to compute using metpy.
Thanks for your help!
The problem is that the decrease in temperature with pressure (or height) assuming moist pseudo-adiabatic processes is not constant. If you have a target pressure where you'd like to use, you can do that. In my code below, I pick a pressure level above the LCL. You also need height values, which I get by assuming a standard atmosphere:
import metpy.calc as mpcalc
from metpy.units import concatenate, units
Surface_temperature = 25 * units.degC
Dew_point_temperature = 10 * units.degC
lcl_pressure, lcl_temperature = mpcalc.lcl(1000 * units.hPa, Surface_temperature, Dew_point_temperature)
# Get the lapse rate 100 hPa above the lcl
press = concatenate([lcl_pressure - 100 * units.hPa, lcl_pressure - 101 * units.hPa])
moist_ascent_temp = mpcalc.moist_lapse(press, lcl_temperature,
reference_pressure=lcl_pressure)
# Calculate finite differences and divide. Need to convert pressure to heights; here we
# assume a standard atmosphere
dt = np.diff(moist_ascent_temp)
dz = np.diff(mpcalc.pressure_to_height_std(press))
print(dt/dz)
This example gave me [-5.769665565854604] delta_degree_Celsius / kilometer
.