
wrf_user_interp_level
Interpolates a horizontal slice from a three-dimensional WRF-ARW field at the given vertical level(s).
Available in version 6.6.0 and later.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; These two libraries are automatically load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" ; loaded from NCL V6.4.0 onward. ; No need for user to explicitly load. function wrf_user_interp_level ( var3d : numeric, vert : numeric, desired_levels : numeric, opt [1] : logical ) return_val : numeric
Arguments
var3dA WRF-ARW field to be interpolated; it must have at least three dimensions, with the rightmost dimensions being level x latitude x longitude.
vertAn array of vertical coordinates for var3d, typically pressure or height. The dimensionality must be the same as var3d.
If vert is pressure, the units may be either hPa or Pa. If vert is height, then the units of the field must be in m.
desired_levelsThe desired vertical level(s). This can be a single value (e.g. 500), a sequence of values (e.g. (/1000, 850, 700, 500, 250/)), or a multi-dimensional array where the rightmost two dimensions (lat x lon) must match var3d, and any leftmost dimensions match field3d's (e.g. planetary boundary layer). Must be in the same units as the vert parameter.
optA logical scalar that can optionally contain attributes. See description below.
Description
This function interpolates a WRF-ARW variable to a horizontal plane at the specified vertical level, which can be in height or pressure coordinates. This function combined with wrf_user_vert_cross replaces wrf_user_intrp3d, which will be deprecated in NCL V6.6.0.
There's currently only one optional attribute available via opt:
- inc2dlevs - If set to True, then the return value will have an attribute called level that is set to the value of the input parameter desired_levels
See Also
wrf_user_interp_line, wrf_user_vert_cross
Examples
Example 1: Interpolate the given 3D field at pressure = 500 hPa.
a = addfile("wrfout_d03_2012-04-22_23_00_00","r") time = 0 ; first time step ht = wrf_user_getvar(a, "z",time) ; grid point height p = wrf_user_getvar(a, "pressure",time) ; total pressure ht_500 = wrf_user_interp_level(ht,p,500,False) printVarSummary(ht) ; [bottom_top | 31] x [south_north | 546] x [west_east | 480] printVarSummary(ht_500) ; [south_north | 546] x [west_east | 480]
Output:
Variable: ht Type: float Total Size: 32497920 bytes 8124480 values Number of Dimensions: 3 Dimensions and sizes : [bottom_top | 31] x [south_north | 546] x [west_east | 480] Coordinates: Number Of Attributes: 6 coordinates : XLONG XLAT stagger : units : m description : Height MemoryOrder : XYZ FieldType : 104 Variable: ht_500 Type: float Total Size: 1048320 bytes 262080 values Number of Dimensions: 2 Dimensions and sizes: [south_north | 546] x [west_east | 480] Coordinates: Number Of Attributes: 5 description : Height units : m level : 500 _FillValue : 9.96921e+36 level_units : hPa