metpy.calc.mixed_layer(pressure, *args, height=None, bottom=None, depth=None, interpolate=True)

Mix variable(s) over a layer, yielding a mass-weighted average.

This function will integrate a data variable with respect to pressure and determine the average value using the mean value theorem.

  • pressure (array-like) – Atmospheric pressure profile

  • datavar (array-like) – Atmospheric variable measured at the given pressures

  • height (array-like, optional) – Atmospheric heights corresponding to the given pressures (default None)

  • bottom (pint.Quantity, optional) – The bottom of the layer as a pressure or height above the surface pressure (default None)

  • depth (pint.Quantity, optional) – The thickness of the layer as a pressure or height above the bottom of the layer (default 100 hPa)

  • interpolate (bool, optional) – Interpolate the top and bottom points if they are not in the given data (default True)


pint.Quantity – The mixed value of the data variable


Only functions on 1D profiles (not higher-dimension vertical cross sections or grids). Since this function returns scalar values when given a profile, this will return Pint Quantities even when given xarray DataArray profiles.

Changed in version 1.0: Renamed p, heights parameters to pressure, height