get_layer#

metpy.calc.get_layer(pressure, *args, height=None, bottom=None, depth=None, interpolate=True)[source]#

Return an atmospheric layer from upper air data with the requested bottom and depth.

This function will subset an upper air dataset to contain only the specified layer. The bottom of the layer can be specified with a pressure or height above the surface pressure. The bottom defaults to the surface pressure. The depth of the layer can be specified in terms of pressure or height above the bottom of the layer. If the top and bottom of the layer are not in the data, they are interpolated by default.

Parameters:
  • pressure (array-like) – Atmospheric pressure profile

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

  • height (array-like, optional) – Atmospheric heights corresponding to the given pressures. Defaults to using heights calculated from pressure assuming a standard atmosphere [NOAA1976].

  • bottom (pint.Quantity, optional) – Bottom of the layer as a pressure or height above the surface pressure. Defaults to the highest pressure or lowest height given.

  • depth (pint.Quantity, optional) – Thickness of the layer as a pressure or height above the bottom of the layer. Defaults to 100 hPa.

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

Returns:

pint.Quantity, pint.Quantity – The pressure and data variables of the layer

Notes

Only functions on 1D profiles (not higher-dimension vertical cross sections or grids). Also, this will return Pint Quantities even when given xarray DataArray profiles.

Changed in version 1.0: Renamed heights parameter to height