rip_cape_2d
** Computes convective available potential energy (CAPE), convective inhibition (CIN), lifted condensation level (LCL), and level of free convection (LFC).
Prototype
function rip_cape_2d ( p : numeric, t : numeric, q : numeric, z : numeric, zsfc : numeric, psfc : numeric, opt [1] : logical ) return_val [4,...] : float or double
Arguments
pAn array containing pressure values (hPa); must be ordered top to bottom. This array must be the same dimensionality as t, q, and z. See the description section for more information on dimension requirements.
tAn array containing temperature values (K); must be ordered top to bottom. This array must be the same dimensionality as p, q, and z. See the description section for more information on dimension requirements.
qAn array containing specific humidities (kg/kg); must be ordered top to bottom. This array must be the same dimensionality as p, t, and z. See the description section for more information on dimension requirements.
zAn array containing geopotential heights (m); must be ordered top to bottom. This array must be the same dimensionality as p, t, and q. See the description section for more information on dimension requirements.
zsfcA scalar or array containing surface geopotential (terrain) height (m). Must be the same dimensionality as psfc. See the description section for more information on dimension requirements.
psfcA scalar or array containing surface pressures (hPa). Must be the same dimensionality as zsfc. See the description section for more information on dimension requirements.
optSet to False for pressure level data. Set to True for terrain-following data.
Return value
A multi-dimensional array whose leftmost dimension is 4 (0=CAPE, 1=CIN, 2=LCL, 3=LFC). The rightmost dimension sizes depend on the input dimension sizes. The type will be double if any of the input is double, and float otherwise.
See the description section below for more information.
Description
** Note: There may be some problems with the underlying Fortran code and using this routine requires full understanding of how the RIP CAPE code works. Please refrain from using this routine unless you understand exactly what it does
Note: there is currently very limited consulting support for this routine. Please read the RIP document carefully before sending any questions on this or the rip_cape_3d routines. Any questions on these routines should be sent to ncl-talk@ucar.edu (you must subscribe first).
This function uses the RIP [Read/Interpolate/plot] code to calculate potential energy (CAPE) and convective inhibition (CIN) (in m**2/s**2 or J/kg) 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.
There are two possible cases for the input and output dimension sizes:
- p, t, q, z (time,lev,lat,lon)
and psfc, zsfc (time,lat,lon)
--> return_val(4,time,lat,lon)
- p, t, q, z (lev,lat,lon) and
psfc, zsfc (lat,lon)
--> return_val(4,lat,lon)
return_val(0,...) will contain CAPELCL is the lifted condensation level in (m), and is the LCL for the parcel in each column with maximum qe below 3000 m AGL.
return_val(1,...) will contain CIN
return_val(2,...) will contain LCL
return_val(3,...) will contain LFC
LFC is the level of free convection (LFC), m (AGL). This is the LFC for the parcel in each column with maximum qe below 3000 m AGL.
This routine does not do anything special with missing values. If you pass in missing values, they will get used as if they were valid values in the calculations. So, make sure your data contains no missing values before you call this routine.
See Also
Examples
Note that if your netCDF file doesn't have a ".nc" suffix, you must include it in the call to addfile so it knows what kind of file to open. The addfile call below will cause NCL to look for both a file called "wrfout_d01_2005-12-14_13:00:00.nc" and "wrfout_d01_2005-12-14_13:00:00".
Example 1
begin a = addfile("wrfout_d01_2005-12-14_13:00:00.nc","r") ;------------------------------------------------------------------- ; Read in the data ;------------------------------------------------------------------- pertP = a->P(0,:,:,:) ; (lev,lat,lon) p = a->PB(0,:,:,:) ; Doing this to retain named dimensions p = p + pertP theta = a->T(0,:,:,:) ; This is potential temperature theta = theta + 300. ; Compute temperature from theta p1000mb = 100000. r_d = 287. cp = 7.*r_d/2. pi = (p/p1000mb)^(r_d/cp) tk = pi*theta p = p/100. ; Convert pressure to mb qv = a->QVAPOR(0,:,:,:) pertZ = a->PH(0,:,:,:) baseZ = a->PHB(0,:,:,:) vartmp = (baseZ + pertZ)/9.81 dimv = dimsizes(vartmp) z = 0.5*(vartmp(0:dimv(0)-2,:,:)+vartmp(1:dimv(0)-1,:,:)) ter = a->HGT(0,:,:) ; (lat,lon) psfc = a->PSFC(0,:,:)/100. ; (lat,lon) ;------------------------------------------------------------------- ; Re-order vertical variables in RIP's top-bottom order. ;------------------------------------------------------------------- p = p(::-1,:,:) tk = tk(::-1,:,:) qv = qv(::-1,:,:) z = z(::-1,:,:) ;------------------------------------------------------------------- ; Compute CAPE and CIN for parcels with maximum ThetaE ;------------------------------------------------------------------- cinfo = rip_cape_2d(p, tk, qv, z, ter, psfc, True) cape = cinfo(0,:,:) cin = cinfo(1,:,:) lcl = cinfo(2,:,:) lfc = cinfo(3,:,:) . . . end