Return the three-dimensional CAPE and CIN. This function calculates the maximum convective available potential energy (CAPE) and maximum convective inhibition (CIN). This function uses the RIP [Read/Interpolate/plot] code to calculate potential energy (CAPE) and convective inhibiti
(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow,
missing=default_fill(np.float64), meta=True)
| 881 | |
| 882 | @set_cape_alg_metadata(is2d=False, copyarg="pres_hpa") |
| 883 | def cape_3d(pres_hpa, tkel, qv, height, terrain, psfc_hpa, ter_follow, |
| 884 | missing=default_fill(np.float64), meta=True): |
| 885 | """Return the three-dimensional CAPE and CIN. |
| 886 | |
| 887 | This function calculates the maximum convective available potential |
| 888 | energy (CAPE) and maximum convective inhibition (CIN). This |
| 889 | function uses the RIP [Read/Interpolate/plot] code to calculate |
| 890 | potential energy (CAPE) and convective inhibition |
| 891 | (CIN) [J kg-1] for every grid point in the entire 3D domain |
| 892 | (treating each grid point as a parcel). |
| 893 | |
| 894 | The leftmost dimension of the returned array represents two different |
| 895 | quantities: |
| 896 | |
| 897 | - return_val[0,...] will contain CAPE [J kg-1] |
| 898 | - return_val[1,...] will contain CIN [J kg-1] |
| 899 | |
| 900 | This function also supports computing CAPE along a single vertical |
| 901 | column. In this mode, the *pres_hpa*, *tkel*, *qv* and *height* arguments |
| 902 | must be one-dimensional vertical columns, and the *terrain* and |
| 903 | *psfc_hpa* arguments must be scalar values |
| 904 | (:obj:`float`, :class:`numpy.float32` or :class:`numpy.float64`). |
| 905 | |
| 906 | This is the raw computational algorithm and does not extract any variables |
| 907 | from WRF output files. Use :meth:`wrf.getvar` to both extract and compute |
| 908 | diagnostic variables. |
| 909 | |
| 910 | Args: |
| 911 | |
| 912 | pres_hpa (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full |
| 913 | pressure (perturbation + base state pressure) in [hPa] with at |
| 914 | least three dimensions when operating on a grid of values. The |
| 915 | rightmost dimensions can be top_bottom x south_north x west_east |
| 916 | or bottom_top x south_north x west_east. |
| 917 | When operating on only a single column of values, the vertical |
| 918 | column can be bottom_top or top_bottom. In this case, *terrain* |
| 919 | and *psfc_hpa* must be scalars. |
| 920 | |
| 921 | Note: |
| 922 | |
| 923 | The units for *pres_hpa* are [hPa]. |
| 924 | |
| 925 | Note: |
| 926 | |
| 927 | This variable must be |
| 928 | supplied as a :class:`xarray.DataArray` in order to copy the |
| 929 | dimension names to the output. Otherwise, default names will |
| 930 | be used. |
| 931 | |
| 932 | tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature |
| 933 | in [K] with same dimensionality as *pres_hpa*. |
| 934 | |
| 935 | qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor |
| 936 | mixing ratio in [kg/kg] with the same dimensionality as *pres_hpa*. |
| 937 | |
| 938 | height (:class:`xarray.DataArray` or :class:`numpy.ndarray`): |
| 939 | Geopotential height in [m] with the same dimensionality as |
| 940 | *pres_hpa*. |