
wrf_user_vert_cross
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.
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, loc_param : numeric, opt [1] : logical ) return_val : numeric
Arguments
var3dA WRF-ARW unstaggered 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, 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.
loc_paramThis input parameter can have two types of values:
- 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)
- A single point when opt@use_pivot is True representing the pivot point.
A logical scalar that can optionally contain attributes. See description below.
Description
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 replaces 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
Examples
Example 1: Calculate a vertical cross section using a pivot point and a plane angle.
a = addfile("wrfout_d03_2012-04-22_23_00_00","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) printVarSummary(qv) ; [bottom_top | 31] x [south_north | 546] x [west_east | 480] printVarSummary(qv_plane) ; [vertical | 100] x [cross_line_idx | 480]
Output:
Variable: qv 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 FieldType : 104 MemoryOrder : XYZ description : Water vapor mixing ratio units : kg kg-1 stagger : coordinates : XLONG XLAT Variable: qv_plane Type: float Total Size: 192000 bytes 48000 values Number of Dimensions: 2 Dimensions and sizes: [vertical | 100] x [cross_line_idx | 480] Coordinates: vertical: [ 0..19464.3] Number Of Attributes: 4 _FillValue : 9.96921e+36 units : kg kg-1 description : Water vapor mixing ratio Orientation : Cross-Section: (0,0) to (479,0) ; center=(20,0) ; angle=90Example 2: Calculate a vertical cross section using a lat/lon plane.
a = addfile("wrfout_d03_2012-04-22_23_00_00","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 latlon = (/-118,38,-115,40/) opt = True opt@latlon = True opt@linecoords = True ; returns lat/lon coordinates on line as attributes "lats","lons" opt@file_handle = a qv_latlon = wrf_user_vert_cross(qv,z,latlon,opt) printVarSummary(qv) ; [bottom_top | 31] x [south_north | 546] x [west_east | 480] printVarSummary(qv_latlon) ; [vertical | 100] x [cross_line_idx | 171]Output:
Variable: qv 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 FieldType : 104 MemoryOrder : XYZ description : Water vapor mixing ratio units : kg kg-1 stagger : coordinates : XLONG XLAT Variable: qv_latlon Type: float Total Size: 68400 bytes 17100 values Number of Dimensions: 2 Dimensions and sizes: [vertical | 100] x [cross_line_idx | 171] Coordinates: vertical: [ 0..19464.3] Number Of Attributes: 6 _FillValue : 9.96921e+36 units : kg kg-1 description : Water vapor mixing ratio Orientation : Cross-Section: (288,309) to (412,426) lats : <ARRAY of 171 elements> lons : <ARRAY of 171 elements>