NCL Home > Documentation > Functions > WRF, Interpolation


Interpolates a vertical cross-section from a three-dimensional WRF-ARW field at the given vertical level(s).

Available in version 6.6.0 and later.


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,  
		loc_param  : numeric,  
		opt    [1] : logical   

	return_val  :  numeric



A WRF-ARW unstaggered field to be interpolated; it must have at least three dimensions, with the rightmost dimensions being level x latitude x longitude.


An array of vertical coordinates for var3d, either 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.


This input parameter can have two types of values:

  1. An array of up to 4 values representing the start point and end point for the cross section (start_x, start_y, end_x, end_y)
  2. A single point when opt@use_pivot is True representing the pivot point.
The values can be in grid coordinates or lat/lon coordinates (start_x = start_lon, start_y = start_lat, ...). If using lat/lon coordinates, then opt@latlon must be True.


A logical scalar that can optionally contain attributes. See description below.


This function interpolates vertical cross section of a WRF-ARW variable at the specified vertical level, which can be in height or pressure coordinates. This function combined with wrf_user_interp_level is meant to replace wrf_user_intrp3d, which will be deprecated in NCL V6.6.0.

There are several optional attributes available via opt:

  • use_pivot - set to True to indicate that loc_param and angle are used, otherwise loc_param is set to 4 values to indicate a start and end point
  • angle - an angle for vertical plots - 90 represent a WE cross section, ignored if use_pivot is False.
  • levels - the vertical levels to use in the same units as z_in. Set to False to automatically generate the number of levels specified by autolevels.
  • latlon - set to True if the values in loc_param are latitude and longitude values rather than grid values
  • file_handle - must be set to a file handle when latlon is True or linecoords is True, otherwise this is ignored.
  • timeidx - the time index to use for moving nests when latlon is True. Set to 0 if the nest is not moving.
  • linecoords - set to True to include the latitude and longitude coordinates for the cross section line in the output attributes.
  • autolevels - set to the desired number of levels when levels are selected automatically (default 100).

See Also

wrf_user_interp_level, wrf_user_interp_line


  a = addfile("","r")

  time = 0    ; first time step
  z    = wrf_user_getvar(a, "z",time)          ; grid point height
  qv   = wrf_user_getvar(a, "QVAPOR",time)     ; cloud field

  plane         = (/ 20., 0./)        ; (x,y) point for vertical plane
  opt           = True
  opt@angle     = 90.
  opt@use_pivot = True
  qv_plane  = wrf_user_vert_cross(qv,z,plane,opt)