NCL Home > Documentation > Functions > Meteorology

# pot_temp_equiv_tlcl

Compute equivalent potential temperature using the lifting condensation temperature.

Available in version 6.5.0 and later.

## Prototype

```load "\$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
; from NCL V6.2.0 onward.
; No need for user to explicitly load.

function pot_temp_equiv_tlcl (
p           : numeric,
t           : numeric,
tlcl        : numeric,
w           : numeric,
iounits [4] : integer
)

return_val [dimsizes(t)] :  float or double
```

## Arguments

p

Scalar or array containing pressure levels (hPa, Pa, kPa).

t

Scalar or array containing temperatures (degC, degK, degF).

tlcl

Scalar or array containing the lifting condensation level temperatures (Same units as t).

w

Scalar or array containing the mixing ratio (kg/kg, g/kg).

iounits

An integer array of length 3 which specifies the units of the input t and w and returned enthalpy units.

• iounits(0)=0 input p is hPa
• iounits(0)=1 input p is Pa
• iounits(0)=2 input p is kPa

• iounits(1)=0 input t is degrees Celcius (degC)
• iounits(1)=1 input t is degrees Kelvin (degK)
• iounits(1)=2 input t is degrees Farenheit (degF)

• iounits(2)=0 input w are kg/kg
• iounits(2)=1 input w are g/kg

• iounits(3)=0 output theta_e is degrees Celcius (degC)
• iounits(3)=1 output theta_e is degrees Kelvin (degK)
• iounits(3)=2 output theta_e is degrees Farenheit (degF)

## Return value

A multi-dimensional array of the same size and shape as t. The output will be double if t, p or w is of type double. All appropriate meta data is returned.

## Description

Calculate the equivalent potential temperature (theta_e) as derived by Bolton (1980): specifically, equation 39. The results are essentially the same as those returned by the WRF function wrf_eth.

```References:

Bolton, D. (1980): The Computation of Equivalent Potential Temperature
Monthly Weather Review, vol. 108, no. 7 (july),  p. 1047

Wikipedia: Lifted Condensation Level
```

## Examples

Example 1: Use NCL's (6.5.0) pot_temp_equiv_tlcl to calculate theta_e at constant pressure and relative humidity while varying both temperatures and mixing ratios. Compare with the NCL 6.4.0 pot_temp_equiv and WRF wrf_eth results.

```      tc      = (/ 27, 28, 29, 30, 31 /)            ; degC
N       = dimsizes (tc)

w       = (/ 0.0168645, 0.0178942, 0.0189793\
, 0.0201224, 0.0213262 /)          ; kg/kg
p       = conform_dims ( N, 1000, -1 )       ; hPa; replicate
rh      = conform_dims ( N,   75, -1 )       ; %  ; replicate

t0      = 273.15
tk      = tc + t0

; Calculate 'theta_e' using the 6.4.0 pot_temp_equiv function.
; The source for the formulation used was Wikipedia.
; As noted in the documentation, this systematically underestimates the correct value(s).

; requires Pa, degK, kg/kg
te_640  = pot_temp_equiv ((p*100), tk, w, -1, "r")   ; degk

; Calculate the temperature at the lifting condensation level. For 'fun' return degC.

tlcl    = tlcl_rh_bolton (tc, rh, (/0,0/))           ; degC, degC

; Calculate 'theta_e' using the 6.5.0 pot_temp_equiv_tlcl function

te_tlcl = pot_temp_equiv_tlcl (p, tc, tlcl, w, (/0,0,1,0/)) ; iounits ==>  hPa, degC, kg/kg, degC

; Calculate 'theta_e' using the WRF 'wrf_eth' function.
; The WRF function requires a 3-or-4 dimensional array with variable units Pa, degK, kg/kg
; Use conform_dims  to replicate the 1D-arrays to 3D arrays

p3      = conform_dims ((/N,1,1/), p*100, 0)  ; Pa     (N,1,1)
t3      = conform_dims ((/N,1,1/), tk   , 0)  ; degK   (N,1,1)
w3      = conform_dims ((/N,1,1/),  w   , 0)  ; kg/kg  (N,1,1)

te_wrf  = wrf_eth( w3, t3, p3)                 ; degK;  [N] x [1] x [1]
te_wrf := te_wrf(:,0,0)-t0                      ; degC and redefine shape (convenience)

diff    = te_wrf - te_tlcl                      ; WRF - NCL_650

print (sprintf ("%5.2f",(te_640-t0))+sprintf("%9.2f",te_tlcl) \
+sprintf("%9.2f",te_wrf ) \
+sprintf("%9.2f",diff) )
```
The slightly edited output:
```
te_640   te_tlcl  te_wrf     diff
69.13    76.56    76.60     0.04
72.71    80.83    80.87     0.04
76.42    85.30    85.35     0.05
80.27    89.99    90.06     0.07
84.28    94.92    95.00     0.08
```

Example 2: Compare with the WRF function, wrf_eth. Differences may be due to different algorithms and/or constants. Note that extra coding is necessary to replicate the one-dimensional (1D) arrays to 3D for use by the WRF function.

```
; pressure (Pa)
p  = (/ 97067.80, 96040.00, 94825.50, 93331.30, 91371.40, 88947.80, 86064.70, 82495.50 \
, 78140.20, 73035.40, 67383.70, 61327.50, 54994.70, 48897.30, 43034.60, 37495.20 \
, 32555.80, 28124.40, 24201.00, 20693.00, 17600.60, 14877.30, 12477.20, 10400.20 \
,  8553.98,  6984.69,   646.18 /)

; temperature (K)
t  = (/  291.15,    291.60,   292.05,  292.13,    292.06,   291.17,   289.11,  287.49 \
,  286.25,    282.14,   277.42,  272.91,    266.99,   261.64,   254.40,  246.38 \
,  238.10,    229.76,   220.88,  213.65,    212.42,   212.58,   212.91,  213.34 \
,  213.73,    214.55,   216.59 /)

; specific humidity (kg/kg; dimensionless))
q  = (/0.012258,  0.012111, 0.011914, 0.011483, 0.010575, 0.008992, 0.006021,0.002559 \
,0.005169,  0.005746, 0.001608, 0.001645, 0.001382, 0.000235, 0.000094,0.000178 \
,0.000136,  0.000079, 0.000050, 0.000025, 0.000023, 0.000023, 0.000014,0.000010 \
,0.000008,  0.000007, 0.000007 /)

; 6.4.0 version does not use lifting condensation level temperature

ept_640 = pot_temp_equiv(p, t, q, 0, "q")       ; degk

; Convert specific humidity to mixing ratio for use in tlcl_mixr_bolton

w  = mixhum_convert(q, "w", (/0,0/))            ; kg/kg, kg/kg

; Compute temperature of the lifting condensation level

tlcl = tlcl_mixr_bolton(t, w, p, (/1,0,1,1/))    ; (/ degK, kg/kg, Pa, degC /)

; 6.5.0 version; uses 'tlcl'

ept_650 = pot_temp_equiv_tlcl(p, t, tlcl, w, (/1,1,1,1/) )

; Compare with WRF function: wrf_eth which requires 3D or 4D input.
; Use conform_dims

klvl = dimsizes(p)
p3   = conform_dims((/klvl,1,1/), p, 0)   ; Pa
t3   = conform_dims((/klvl,1,1/), t, 0)   ; degK
w3   = conform_dims((/klvl,1,1/), w, 0)   ; kg/kg

ept_wrf = wrf_eth ( w3, t3, p3 )     ; [klvl] x [1] x [1]
ept_dif = ept-ept_wrf(:,0,0)         ; difference

print(sprintf("%8.2f", p)    +"  " \
+sprintf("%11.6f", w)              \
+sprintf("%11.6f", q)              \
+sprintf("%10.2f", t)              \
+sprintf("%10.2f", tlcl)           \
+sprintf("%10.2f", ept_640)        \
+sprintf("%10.2f", ept_650)        \
+sprintf("%10.2f", ept_wrf(:,0,0)) \
+sprintf("%9.2f",  ept_dif) )

```
would yield (slightly edited):
```
P (Pa)    W(kg/kg)   Q(kg/kg)     t(K)      tlcl      ept     ept_tlcl   ept_wrf    diff
(0)	97067.80   0.012110   0.012258    291.15    289.06    324.91    328.34    328.35    -0.00
(1)	96040.00   0.011966   0.012111    291.60    288.53    325.97    329.50    329.50    -0.01
(2)	94825.50   0.011774   0.011914    292.05    287.87    327.10    330.71    330.72    -0.01
(3)	93331.30   0.011353   0.011483    292.13    286.87    327.55    331.15    331.16    -0.01
(4)	91371.40   0.010464   0.010575    292.06    284.99    327.09    330.57    330.59    -0.02
(5)	88947.80   0.008912   0.008992    291.17    281.79    324.52    327.65    327.68    -0.03
(6)	86064.70   0.005985   0.006021    289.11    274.74    317.57    319.93    319.98    -0.06
(7)	82495.50   0.002552   0.002559    287.49    260.89    310.51    311.85    311.93    -0.07
(8)	78140.20   0.005142   0.005169    286.25    271.19    321.08    323.18    323.26    -0.08
(9)	73035.40   0.005713   0.005746    282.14    272.64    324.44    326.47    326.55    -0.08
(10)	67383.70   0.001605   0.001608    277.42    253.14    315.05    315.89    315.99    -0.10
(11)	61327.50   0.001642   0.001645    272.91    252.94    318.56    319.35    319.46    -0.12
(12)	54994.70   0.001380   0.001382    266.99    250.14    320.83    321.44    321.57    -0.13
(13)	48897.30   0.000235   0.000235    261.64    228.50    321.70    321.82    321.94    -0.13
(14)	43034.60   0.000094   0.000094    254.40    219.03    324.00    324.00    324.14    -0.14
(15)	37495.20   0.000178   0.000178    246.38    225.04    326.67    326.69    326.86    -0.17
(16)	32555.80   0.000136   0.000136    238.10    222.13    328.57    328.54    328.73    -0.19
(17)	28124.40   0.000079   0.000079    229.76    216.76    330.41    330.33    330.54    -0.21
(18)	24201.00   0.000050   0.000050    220.88    212.55    331.47    331.35    331.59    -0.24
(19)	20693.00   0.000025   0.000025    213.65    206.39    335.20    335.05    335.32    -0.26
(20)	17600.60   0.000023   0.000023    212.42    204.59    349.04    348.86    349.17    -0.30
(21)	14877.30   0.000023   0.000023    212.58    203.26    366.49    366.29    366.63    -0.35
(22)	12477.20   0.000014   0.000014    212.91    198.19    385.94    385.70    386.10    -0.40
(23)	10400.20   0.000010   0.000010    213.34    194.50    407.35    407.07    407.53    -0.46
(24)	 8553.98   0.000008   0.000008    213.73    191.64    431.52    431.20    431.72    -0.53
(25)	 6984.69   0.000007   0.000007    214.55    189.38    458.99    458.62    459.23    -0.61
(26)	  646.18   0.000007   0.000007    216.59    175.61    914.72    913.30    915.59    -2.2
```