wrf_tk
Calculates temperature in [K] from ARW WRF model output.
Prototype
function wrf_tk ( P : numeric, theta : numeric ) return_val [dimsizes(P)] : float or double
Arguments
PAn array of full pressure (perturbation + base state pressure). The rightmost three dimensions must be level (bottom_top) x lat (south_north) x lon (west_east). Units are [Pa].
thetaAn array of potential temperature (perturbation + reference temperature) or (theta+t0) with the same dimension structure as P. Units are [K].
Return value
A multi-dimensional array of the same size as P containing temperature in [K]. The type will be double if P or T are double, and float otherwise.
Description
This function returns temperature in [K]. The return variable will contain two attributes:
return_val@description = "Temperature"
return_val@units = "K"
See Also
Examples
Note: for WRF variable names and their definitions, you can easily check them by using "ncl_filedump":
ncl_filedump wrfout_d01_2000-01-24_12:00:00.nc
Example 1
Read and process a 4d array. The arguments are variables from WRF data.
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_2000-01-24_12:00:00.nc" and "wrfout_d01_2000-01-24_12:00:00".
a = addfile("wrfout_d01_2000-01-24_12:00:00.nc","r") P = a->P ; perturbation Pb = a->PB ; base state pressure P = P + Pb ; total pressure T = a->T ; perturbation potential temperature (theta+t0) T = T + 300. TK = wrf_tk (P, T) printVarSummary(TK)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("wrfout_d01_2000-01-24_12:00:00.nc","r") time = 1 tk = wrf_user_getvar(a,"tk",time) ; calculate tk