Skip to content

Virtual temperature being incorrectly used in lfc and el functions #3857

@robwarrenwx

Description

@robwarrenwx

I believe that MetPy was recently updated to include the virtual temperature correction in its calculation of CAPE and CIN. From what I can see, this has been done by simply overwriting the parcel and environmental temperature profiles with the corresponding virtual temperature profiles in the cape_cin function (L2840-2841 of thermo.py). The problem comes when these virtual temperatures are passed to the lfc and el functions, where the virtual temperature is then used to calculate the LCL pressure as though it were still just temperature (L955 and L1166 of thermo.py). This will inevitably lead to an overestimation of the LCL height (an underestimation of LCL pressure and temperature), which in turn could lead to an overestimation of the heights of the LFC and EL (since these levels cannot be below the LCL). The effect is more likely to be seen for the LFC, since the EL will typically reside much higher up in the profile.

To rectify this issue, I would recommend defining the parcel and environmental temperatures as new arrays, rather than overwriting the corresponding temperature profiles. These could either be passed as additional arguments to the lfc and el functions or could simply be recalculated within these functions. This should help to ensure that virtual temperature is not inadvertently being treated as standard air temperature in any downstream functions.

Operating System

Linux

Version

Latest

Python Version

N/A

Code to Reproduce

N/A

Errors, Traceback, and Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: CalcPertains to calculationsSubarea: ThermoPertains to thermodynamic calculations and their physical correctnessType: BugSomething is not working like it should

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions