NCL Home > Documentation > Functions > WRF


Calculates dewpoint temperature in [C] from ARW WRF model output.


	function wrf_td (
		P   : numeric,  
		qv  : numeric   

	return_val [dimsizes(P)] :  float or double



Full pressure (perturbation + base state pressure). The rightmost dimensions are bottom_top x south_north x west_east. Units must be [Pa].


Water vapor mixing ratio in [kg/kg]. An array with the same dimensionality as P.

Return value

Dewpoint temperature in [C]. The multi-dimensional array has the same size as P. The type will be double if P or qv are double, and float otherwise.


This function returns dewpoint temperature in [C]. It also makes sure there are no negative values in qv by setting them all to 0.

The return variable will contain two attributes:

return_val@description = "Dewpoint Temperature"
return_val@units = "C"

As of version 5.1.0, the return variable will contain the same named dimensions (if any) of qv. Otherwise, the rightmost two dimensions will be named "south_north" and "west_east".

See Also

See the full list of WRF functions.


Note: for WRF variable names and their definitions, you can easily check them by using "ncl_filedump":


Example 1

    QVAPOR = nc_file->QVAPOR(time,:,:,:)

    P      = nc_file->P(time,:,:,:)
    PB     = nc_file->PB(time,:,:,:)
    p      = P + PB

    td    = wrf_td( p , QVAPOR )
Example 2

The function wrf_user_getvar (available in the $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl script) can also be used to calculate many diagnostics in one step.

  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

  a = addfile("","r")

  time = 1
  td = wrf_user_getvar(a,"td",time)  ; calculate td
You can see some other example scripts and their resultant images at: