wrf.cape_2d

wrf.cape_2d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, missing=<MagicMock name='mock().item()' id='140675643013392'>, meta=True)

Return the two-dimensional MCAPE, MCIN, LCL, and LFC.

This function calculates the maximum convective available potential energy (MCAPE), maximum convective inhibition (MCIN), lifted condensation level (LCL), and level of free convection (LFC). This function uses the RIP [Read/Interpolate/plot] code to calculate potential energy (CAPE) and convective inhibition (CIN) [J kg-1] only for the parcel with max theta-e in the column (i.e. something akin to Colman’s MCAPE). CAPE is defined as the accumulated buoyant energy from the level of free convection (LFC) to the equilibrium level (EL). CIN is defined as the accumulated negative buoyant energy from the parcel starting point to the LFC.

The cape_2d algorithm works by first finding the maximum theta-e height level in the lowest 3000 m. A parcel with a depth of 500 m is then calculated and centered over this maximum theta-e height level. The parcel’s moisture and temperature characteristics are calculated by averaging over the depth of this 500 m parcel. This ‘maximum’ parcel is then used to compute MCAPE, MCIN, LCL and LFC.

The leftmost dimension of the returned array represents four different quantities:

  • return_val[0,…] will contain MCAPE [J kg-1]
  • return_val[1,…] will contain MCIN [J kg-1]
  • return_val[2,…] will contain LCL [m]
  • return_val[3,…] will contain LFC [m]

This function also supports computing MCAPE along a single vertical column. In this mode, the pres_hpa, tkel, qv and height arguments must be one-dimensional vertical columns, and the terrain and psfc_hpa arguments must be scalar values (float, numpy.float32 or numpy.float64).

This is the raw computational algorithm and does not extract any variables from WRF output files. Use wrf.getvar() to both extract and compute diagnostic variables.

Parameters:
  • pres_hpa (xarray.DataArray or numpy.ndarray) –

    Full pressure (perturbation + base state pressure) in [hPa] with at least three dimensions. The rightmost dimensions can be top_bottom x south_north x west_east or bottom_top x south_north x west_east. When operating on only a single column of values, the vertical column can be bottom_top or top_bottom. In this case, terrain and psfc_hpa must be scalars.

    Note

    The units for pres_hpa are [hPa].

    Note

    This variable must be supplied as a xarray.DataArray in order to copy the dimension names to the output. Otherwise, default names will be used.

  • tkel (xarray.DataArray or numpy.ndarray) – Temperature in [K] with same dimensionality as pres_hpa.
  • qv (xarray.DataArray or numpy.ndarray) – Water vapor mixing ratio in [kg/kg] with the same dimensionality as pres_hpa.
  • height (xarray.DataArray or numpy.ndarray) – Geopotential height in [m] with the same dimensionality as pres_hpa.
  • terrain (xarray.DataArray or numpy.ndarray) – Terrain height in [m]. This is at least a two-dimensional array with the same dimensionality as pres_hpa, excluding the vertical (bottom_top/top_bottom) dimension. When operating on a single vertical column, this argument must be a scalar (float, numpy.float32, or numpy.float64).
  • psfc_hpa (xarray.DataArray or numpy.ndarray) –

    The surface pressure in [hPa]. This is at least a two-dimensional array with the same dimensionality as pres_hpa, excluding the vertical (bottom_top/top_bottom) dimension. When operating on a singlevertical column, this argument must be a scalar (float, numpy.float32, or numpy.float64).

    Note

    The units for psfc_hpa are [hPa].

  • ter_follow (bool) – A boolean that should be set to True if the data uses terrain following coordinates (WRF data). Set to False for pressure level data.
  • missing (float, optional) – The fill value to use for the output. Default is wrf.default_fill(numpy.float64).
  • meta (bool) – Set to False to disable metadata and return numpy.ndarray instead of xarray.DataArray. Default is True.

Warning

The input arrays must not contain any missing/fill values or numpy.nan values.

Returns:The cape, cin, lcl, and lfc values as an array whose leftmost dimension is 4 (0=CAPE, 1=CIN, 2=LCL, 3=LFC) . If xarray is enabled and the meta parameter is True, then the result will be an xarray.DataArray object. Otherwise, the result will be a numpy.ndarray object with no metadata.
Return type:xarray.DataArray or numpy.ndarray