parcel_profile_with_lcl#
- metpy.calc.parcel_profile_with_lcl(pressure, temperature, dewpoint)#
Calculate the profile a parcel takes through the atmosphere.
The parcel starts at temperature, and
dewpoint
, lifted up dry adiabatically to the LCL, and then moist adiabatically from there. pressure specifies the pressure levels for the profile. This function returns a profile that includes the LCL.- Parameters:
pressure (
pint.Quantity
) – Atmospheric pressure level(s) of interest. This array must be from high to low pressure.temperature (
pint.Quantity
) – Atmospheric temperature at the levels in pressure. The first entry should be at the same level as the first pressure data point.dewpoint (
pint.Quantity
) – Atmospheric dewpoint at the levels in pressure. The first entry should be at the same level as the first pressure data point.
- Returns:
pressure (
pint.Quantity
) – The parcel profile pressures, which includes the specified levels and the LCLambient_temperature (
pint.Quantity
) – Atmospheric temperature values, including the value interpolated to the LCL levelambient_dew_point (
pint.Quantity
) – Atmospheric dewpoint values, including the value interpolated to the LCL levelprofile_temperature (
pint.Quantity
) – The parcel profile temperatures at all of the levels in the returned pressures array, including the LCL
Examples
>>> from metpy.calc import dewpoint_from_relative_humidity, parcel_profile_with_lcl >>> from metpy.units import units >>> # pressure >>> p = [1008., 1000., 950., 900., 850., 800., 750., 700., 650., 600., ... 550., 500., 450., 400., 350., 300., 250., 200., ... 175., 150., 125., 100., 80., 70., 60., 50., ... 40., 30., 25., 20.] * units.hPa >>> # temperature >>> T = [29.3, 28.1, 23.5, 20.9, 18.4, 15.9, 13.1, 10.1, 6.7, 3.1, ... -0.5, -4.5, -9.0, -14.8, -21.5, -29.7, -40.0, -52.4, ... -59.2, -66.5, -74.1, -78.5, -76.0, -71.6, -66.7, -61.3, ... -56.3, -51.7, -50.7, -47.5] * units.degC >>> # relative humidity >>> rh = [.85, .65, .36, .39, .82, .72, .75, .86, .65, .22, .52, ... .66, .64, .20, .05, .75, .76, .45, .25, .48, .76, .88, ... .56, .88, .39, .67, .15, .04, .94, .35] * units.dimensionless >>> # calculate dewpoint >>> Td = dewpoint_from_relative_humidity(T, rh) >>> # computer parcel temperature >>> Td = dewpoint_from_relative_humidity(T, rh) >>> p_wLCL, T_wLCL, Td_wLCL, prof_wLCL = parcel_profile_with_lcl(p, T, Td) >>> print(f'Shape of original pressure array: {p.shape}') Shape of original pressure array: (30,) >>> print(f'Shape of pressure array from function: {p_wLCL.shape}') Shape of pressure array from function: (31,) >>> print(p == p_wLCL) False
Notes
Only functions on 1D profiles (not higher-dimension vertical cross sections or grids). Duplicate pressure levels return duplicate parcel temperatures. Consider preprocessing low-precision, high frequency profiles with tools like scipy.medfilt, pandas.drop_duplicates, or
numpy.unique
.Will only return Pint Quantities, even when given xarray DataArray profiles. To obtain a xarray Dataset instead, use
parcel_profile_with_lcl_as_dataset
instead.Changed in version 1.0: Renamed
dewpt
parameter todewpoint