MCPcopy Create free account
hub / github.com/NCAR/wrf-python / cape_2d

Function cape_2d

src/wrf/computation.py:736–879  ·  view source on GitHub ↗

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/Inter

(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow,
            missing=default_fill(np.float64), meta=True)

Source from the content-addressed store, hash-verified

734
735@set_cape_alg_metadata(is2d=True, copyarg="pres_hpa")
736def cape_2d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow,
737 missing=default_fill(np.float64), meta=True):
738 """Return the two-dimensional MCAPE, MCIN, LCL, and LFC.
739
740 This function calculates the maximum convective available potential
741 energy (MCAPE), maximum convective inhibition (MCIN),
742 lifted condensation level (LCL), and level of free convection (LFC). This
743 function uses the RIP [Read/Interpolate/plot] code to calculate
744 potential energy (CAPE) and convective inhibition
745 (CIN) [J kg-1] only for the parcel with max theta-e
746 in the column (i.e. something akin to Colman's MCAPE). CAPE is defined as
747 the accumulated buoyant energy from the level of free convection (LFC) to
748 the equilibrium level (EL). CIN is defined as the accumulated negative
749 buoyant energy from the parcel starting point to the LFC.
750
751 The cape_2d algorithm works by first finding the maximum theta-e height
752 level in the lowest 3000 m. A parcel with a depth of 500 m is then
753 calculated and centered over this maximum theta-e height level. The
754 parcel's moisture and temperature characteristics are calculated by
755 averaging over the depth of this 500 m parcel. This 'maximum' parcel
756 is then used to compute MCAPE, MCIN, LCL and LFC.
757
758 The leftmost dimension of the returned array represents four different
759 quantities:
760
761 - return_val[0,...] will contain MCAPE [J kg-1]
762 - return_val[1,...] will contain MCIN [J kg-1]
763 - return_val[2,...] will contain LCL [m]
764 - return_val[3,...] will contain LFC [m]
765
766 This function also supports computing MCAPE along a single vertical
767 column. In this mode, the *pres_hpa*, *tkel*, *qv* and *height* arguments
768 must be one-dimensional vertical columns, and the *terrain* and
769 *psfc_hpa* arguments must be scalar values
770 (:obj:`float`, :class:`numpy.float32` or :class:`numpy.float64`).
771
772 This is the raw computational algorithm and does not extract any variables
773 from WRF output files. Use :meth:`wrf.getvar` to both extract and compute
774 diagnostic variables.
775
776 Args:
777
778 pres_hpa (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full
779 pressure (perturbation + base state pressure) in [hPa] with at
780 least three dimensions. The rightmost dimensions can be
781 top_bottom x south_north x west_east or bottom_top x south_north x
782 west_east.
783 When operating on only a single column of values, the vertical
784 column can be bottom_top or top_bottom. In this case, *terrain*
785 and *psfc_hpa* must be scalars.
786
787 Note:
788
789 The units for *pres_hpa* are [hPa].
790
791 Note:
792
793 This variable must be

Callers 1

funcFunction · 0.85

Calls 2

default_fillFunction · 0.85
_capeFunction · 0.85

Tested by 1

funcFunction · 0.68