Skip to contents

The function calculates the Convective Available Potential Energy (CAPE) for surface parcel in the lowest 3 km of the atmosphere. It returns a list containing CAPE, convective inhibition (CIN), pressure at lifted condensation level (LCL), and at level of free convection (LFC).

Usage

CAPE_z(
  ta_s,
  hus_s,
  z_s,
  pa_s,
  ta_pl,
  hus_pl,
  z_pl,
  pa_pl,
  dz = 3000,
  vtc = TRUE,
  nthreads = 1
)

Arguments

ta_s

parcel temperature [lon, lat, time] at 2 meter above the surface (K).

hus_s

parcel specific humidity at 2 meter above the surface (kg/kg).

z_s

surface geopotential [lon, lat] (m^2/s^2).

pa_s

surface pressure [lon, lat, time] (hPa).

ta_pl

air temperature [lon, lat, lev, time] on pressure level (K).

hus_pl

specific humidity [lon, lat, lev, time] on pressure level (kg/kg).

z_pl

geopotential [lon, lat, lev, time] on pressure level (m^2/s^2).

pa_pl

pressure profile [lev] in descending manner (hPa).

dz

height of the layer to consider (m). Default is 3000 km

vtc

logical refers to virtual temperature correction due to Doswell and Rasmussen (1994).

nthreads

an integer specifying the number of threads to use for computation (OpenMP). Default is 1.

Value

A list containing CAPE, CIN, p_LCL, p_LFC each as [lon, lat, time].

References

Doswell III, C. A., & Rasmussen, E. N. (1994). The effect of neglecting the virtual temperature correction on CAPE calculations. Weather and forecasting, 9(4), 625-629 doi:10.1175/1520-0434(1994)009<0625:TEONTV>2.0.CO;2 .

Examples

data("ERA5_pl")
data("ERA5_sfc")
ta_s <- ERA5_sfc$t2m
td_s <- ERA5_sfc$t2d
pa_s <- ERA5_sfc$sp / 100
hus_s <- hus_from_td(td_s, pa_s)
dim(hus_s) <- dim(ta_s)
z_s <- ERA5_sfc$z[, , 1]

ta_pl <- ERA5_pl$ta
hus_pl <- ERA5_pl$hus
pa_pl <- ERA5_pl$plev / 100
z_pl <- ERA5_pl$z
# 3km CAPE
res <- CAPE_z(ta_s, hus_s, z_s, pa_s,
  ta_pl, hus_pl, z_pl, pa_pl,
  dz = 3000,
  vtc = TRUE, nthreads = 1
)

str(res)
#> List of 4
#>  $ CAPE : num [1:9, 1:13, 1:2] 0 0 0 0 0 0 0 0 0 0 ...
#>  $ CIN  : num [1:9, 1:13, 1:2] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ...
#>  $ p_LCL: num [1:9, 1:13, 1:2] 650 650 650 650 650 650 650 650 650 650 ...
#>  $ p_LFC: num [1:9, 1:13, 1:2] 650 650 650 650 650 650 650 650 650 650 ...