Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Most unstable CAPE and surface-based CAPE comparison in NCL and Python


New member

I am testing NCL functions (wrf_cape_2d, wrf_cape_3d; wrf_user_getvar) for the CAPE calculation. What I did is to take a WRF output file provided by NCL website and use these functions to calculate the most unstable CAPE (wrf_cape_2d or wrf_user_getvar) and surface based CAPE (wrf_cape_3d or wrf_user_getvar). It came to my attention that the value of most unstable CAPE is smaller than surface-based CAPE (see my attached figures). Also surprising is that the value of most unstable CAPE using wrf_cape_2d function is a little larger than the most unstable cape using wrf_user_getvar(a,"cape_2d"). [By contrast, the CAPE calculated by wrf_cape_3d is identical to the CAPE calculated by wrf_user_getva(a,"cape_3d")]. I wonder if any one can help share some insight why this happens. In particular, shouldn't we expect the most unstable CAPE to be equal or larger than surface-based CAPE?

Note that I also tested this using WRF_Python package and found that wrf.cape_2d (identical to NCL wrf_cape_2d) is also smaller than wrf.cape_3d surface-layer value ( identical to NCL wrf_cape_3d). Thus, I suspect that this might be a common issue for both NCL and Python.

Any comments and/or suggestions will be appreciated!

Lantao sun
Research Scientist
Department of Atmospheric Science
Colorado State University
Fort Collins, Colorado, USA

P.S.: Some details below regarding how I did the test:
1. Most unstable CAPE based on wrf_cape_2d: I simply follow the code for example 1 at NCL website:
a = addfile("wrfout_d01_2005-08-28_00:00:00","r")

T = a->T
P = a->P
PB = a->PB
PH = a->PH
PHB = a->PHB
HGT = a->HGT

T = T + 300.
P = P + PB
tk = wrf_tk( P , T )
z = wrf_user_unstagger(PH,PH@stagger)
z = z/9.81

cinfo = wrf_cape_2d( P, tk, QV, z, HGT, PSFC, True )

mcape = cinfo(0,:,:)

; ....................plot scripts follow ....................

2. Most unstable CAPE based on wrf_user_getvar: I follow the code for example 2 at NCL website:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
a = addfile("wrfout_d01_2005-08-28_00:00:00","r")
cape2d = wrf_user_getvar(a,"cape_2d",-1)
mcape = cape2d(0,:,:)

3. Surface-based CAPE based on wrf_cape_3d: similar to 1, but change wrf_cape_2d to wrf_cape_3d, and only keep the bottom layer for surface-based CAPE.
4. Surface-based CAPE based on wrf_user_getvar: similar to 2, but use "wrf_user_getvar("cape3d",-1)" and only keep the bottom layer for surface-based CAPE.


  • mucape_vs_sbcape.pdf
    1.2 MB · Views: 32