wrf.cape_2d¶
-
wrf.cape_2d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, missingval=9.969209968386869e+36, meta=True)¶ Return the two-dimensional CAPE, CIN, LCL, and LFC.
This function calculates the maximum convective available potential energy (CAPE), maximum convective inhibition (CIN), 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 word ‘parcel’ here refers to a 500 meter deep parcel, with actual temperature and moisture averaged over that depth.
The leftmost dimension of the returned array represents four different quantities:
- return_val[0,...] will contain CAPE [J kg-1]
- return_val[1,...] will contain CIN [J kg-1]
- return_val[2,...] will contain LCL [m]
- return_val[3,...] will contain LFC [m]
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.DataArrayornumpy.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.
Note
The units for pres_hpa are [hPa].
Note
This variable must be supplied as a
xarray.DataArrayin order to copy the dimension names to the output. Otherwise, default names will be used. - tkel (
xarray.DataArrayornumpy.ndarray) – Temperature in [K] with same dimensionality as pres_hpa. - qv (
xarray.DataArrayornumpy.ndarray) – Water vapor mixing ratio in [kg/kg] with the same dimensionality as pres_hpa. - height (
xarray.DataArrayornumpy.ndarray) – Geopotential height in [m] with the same dimensionality as pres_hpa. - terrain (
xarray.DataArrayornumpy.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. - psfc_hpa (
xarray.DataArrayornumpy.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.
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. - missingval (
float, optional) – The fill value to use for the output. Default iswrf.Constants.DEFAULT_FILL. - meta (
bool) – Set to False to disable metadata and returnnumpy.ndarrayinstead ofxarray.DataArray. Default is True.
Warning
The input arrays must not contain any missing/fill values or
numpy.nanvalues.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.DataArrayobject. Otherwise, the result will be anumpy.ndarrayobject with no metadata.Return type: xarray.DataArrayornumpy.ndarraySee also