NCL Website header
NCL Home > Documentation > Functions > WRF, Interpolation


Interpolates ARW WRF 2D model data along a given line.


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_intrp2d (
		var2d   : numeric,  
		loc [*] : numeric,  ; up to four values
		angle   : numeric,  
		res [1] : logical   

	return_val  :  numeric



Data that will be interpolated. The rightmost dimensions of this array are ny x nx.


Interpolation information. Can contain up to four scalar values.

Use 2 values if extracting a line through a given point on the model domain. The two values represent the x/y location through which the line will pass. Must also specify angle in this case.

Use 4 values if extracting data from point A to point B. The 4 values represent the x/y locations of points A and B.


Only valid if a line will be extracted through a given point on the model domain. 0.0 represents S-N and 90.0 W-E.


Set to True if extracting a line from point A to point B; otherwise set to False.

Return value

Data interpolated to a specified line on the model domain.


This function interpolates 2D model data onto a specified line.

Note: in NCL V6.5.0 a bug was fixed in this routine and in wrf_user_intrp3d in which the 0th grid point was not being included when setting up the output domain, causing the output array to be missing a grid point in the rightmost dimension.

wrf_user_intrp2d is part of a library of functions and procedures in WRFUserARW.ncl written to help users plot ARW WRF model data.

Questions on this function should be sent to

See Also

See the full list of WRF functions.


Example 1

  a = addfile("","r")

  wks = gsn_open_wks("x11","test")

  t2 = wrf_user_getvar(a,"T2",-1)        ; get T2 data for all time periods

  dims = dimsizes(t2)

  plane = (/ dims(2)/2, dims(1)/2 /)       ; pivot point (x,y) through center of domain   
  angle = 90.                              ; plot from west to east
  opts = False                             ; start and end point not supplied

  X_plane = wrf_user_intrp2d(t2,plane,angle,opts)

You can see some other example scripts and their resultant images at: