function wrf_user_getvar (nc_file, fld, it)
Usage: ter = wrf_user_getvar (a, “HGT”, 0)
nc_file:wrfout的nc文件名称
fld:变量名
it:时间设置。假如it=-1,则所有时间均输出。
例如:tc=wrf_user_getvar(f,"tc",-1)
======================================================
;*******************************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;*******************************************************************
begin
f= addfile("wrfout_d01_2007-09-02_00_00_00.nc","r")
tc=wrf_user_getvar(f,"tc",-1)
printVarSummary(tc)
system("/bin/rm -f tc_wrfout_d01_2007-09-02.nc")
nf = addfile("tc_wrfout_d01_2007-09-02.nc","c")
nf->tc=tc
wks= gsn_open_wks("x11","t_wrf")
gsn_define_colormap(wks,"BlRe")
res = True
plot = gsn_csm_contour(wks, tc(0,0,:,:), res)
end
======================================================
Get fields from a netCDF file for any given time, or all times in a file, by setting it = -1
Any field available in the nerCDF file can be extracted.
fld is case sensitive. The policy adapted during development was to set all diagnostic variables calculated by NCL to lower-case to distinguish them from fields directly available from the netCDF files.
List of available diagnostics:(可以输出诊断量)
avo: Absolute Vorticity [10-5 s-1]
cape_2d: Returns 2D fields mcape/mcin/lcl/lfc
cape_3d: Returns 3D fields cape/cin
dbz: Reflectivity [dBZ]
mdbz: Maximum Reflectivity [dBZ]
geopt/geopotential: Full Model Geopotential [m2 s-2]
lat: Latitude (will return either XLAT or XLAT_M, depending on which is available)
lon: Longitude (will return either XLONG or XLONG_M, depending on which is available)
p/pres: Full Model Pressure [Pa]
pressure: Full Model Pressure [hPa]
pvo: Potential Vorticity [PVU]
rh2: 2m Relative Humidity [%]
rh: Relative Humidity [%]
slp: Sea Level Pressure [hPa]
ter: Model Terrain Height [m] (will return either HGT or HGT_M, depending on which is available)
td2: 2m Dew Point Temperature [C]
td: Dew Point Temperature [C]
tc: Temperature [C]
th/theta: Potential Temperature [K]
tk: Temperature [K]
ua: U component of wind on mass points
va: V component of wind on mass points
wa: W component of wind on mass points
uvmet10: 10m U and V components of wind rotated to earth coordinates
uvmet: U and V components of wind rotated to earth coordinates
z/height: Full Model Height [m]