wrf.vertcross

wrf.vertcross(field3d, vert, levels=None, missing=<MagicMock name='mock().item()' id='139691447841424'>, wrfin=None, timeidx=0, stagger=None, projection=None, ll_point=None, pivot_point=None, angle=None, start_point=None, end_point=None, latlon=False, autolevels=100, cache=None, meta=True)

Return the vertical cross section for a three-dimensional field.

The cross section is defined by a horizontal line through the domain. This horizontal line is defined by either including the pivot_point and angle parameters, or the start_point and end_point parameters. The pivot_point, start_point, and end_point coordinates can be defined in either x,y or latitude,longitude space. If latitude,longitude coordinates are used, then a WRF input file or map projection must also be specified.

The vertical levels for the cross section are fixed if levels is not specified, and are determined by dividing the vertical coordinate in to grid boxes of roughly 1% of the maximum vertical distance from top to bottom. Otherwise, the levels argument can be used to specify specific vertical levels. If all vertical levels are desired, use the raw wrf.interp2dxy() function.

See also

wrf.interp2dxy()

Parameters:
  • field3d (xarray.DataArray or numpy.ndarray) – A three-dimensional field to interpolate, whose rightmost dimensions are nz x ny x nx.
  • vert (xarray.DataArray or numpy.ndarray) – A three-dimensional variable for the vertical coordinate, typically pressure or height. This array must have the same dimensionality as field3d
  • levels (sequence, optional) – A sequence of float for the desired vertical levels in the output array. Must be in the same units as vert. If None, a fixed set of vertical levels is provided. Default is None.
  • missing (float) – The fill value to use for the output. Default is wrf.default_fill(numpy.float64).
  • wrfin (netCDF4.Dataset, Nio.NioFile, or an iterable, optional) – WRF-ARW NetCDF data as a netCDF4.Dataset, Nio.NioFile or an iterable sequence of the aforementioned types. This is used to obtain the map projection when using latitude,longitude coordinates. Default is None.
  • timeidx (int, optional) – The desired time index when obtaining map boundary information from moving nests. This value can be a positive or negative integer. Only required when wrfin is specified and the nest is moving. Currently, wrf.ALL_TIMES is not supported. Default is 0.
  • stagger (str) –

    If using latitude, longitude coordinate pairs for start_point, end_point, or pivot_point, set the appropriate grid staggering type for field3d. By default, the mass grid is used. The options are:

    • ’m’: Use the mass grid (default).
    • ’u’: Use the same staggered grid as the u wind component, which has a staggered west_east (x) dimension.
    • ’v’: Use the same staggered grid as the v wind component, which has a staggered south_north (y) dimension.
  • projection (wrf.WrfProj subclass, optional) – The map projection object to use when working with latitude, longitude coordinates, and must be specified if wrfin is None. Default is None.
  • ll_point (wrf.CoordPair, sequence of wrf.CoordPair, optional) – The lower left latitude, longitude point for your domain, and must be specified if wrfin is None. If the domain is a moving nest, this should be a sequence of wrf.CoordPair. Default is None.
  • pivot_point (wrf.CoordPair, optional) – A coordinate pair for the pivot point, which indicates the location through which the plane will pass. Must also specify angle. The coordinate pair can be in x,y grid coordinates or latitude, longitude coordinates. If using latitude, longitude coordinates, then either wrfin or projection must be specified to obtain the map projection. Default is None.
  • angle (float, optional) – Only valid for cross sections where a plane will be plotted through a given point on the model domain. 0.0 represents a S-N cross section. 90.0 is a W-E cross section.
  • start_point (wrf.CoordPair, optional) – A coordinate pair which indicates the start location through which the plane will pass. Must also specify end_point. The coordinate pair can be in x,y grid coordinates or latitude, longitude coordinates. If using latitude, longitude coordinates, then either wrfin or projection must be specified to obtain the map projection. Default is None.
  • end_point (wrf.CoordPair, optional) – A coordinate pair which indicates the end location through which the plane will pass. Must also specify end_point. The coordinate pair can be in x,y grid coordinates or latitude, longitude coordinates. If using latitude, longitude coordinates, then either wrfin or projection must be specified to obtain the map projection. Default is None.
  • latlon (bool, optional) –

    Set to True to also interpolate the two-dimensional latitude and longitude coordinates along the same horizontal line and include this information in the metadata (if enabled). This can be helpful for plotting. Default is False.

    Note

    Currently, field3d must be of type xarray.DataArray and contain coordinate information in order to generate the latitude and longitude coordinates along the line if latlon is set to True. Otherwise, a warning will be issued, and the latitude and longitude information will not be present.

  • autolevels (int, optional) – The number of evenly spaced automatically chosen vertical levels to use when levels is None. Default is 100.
  • cache (dict, optional) – A dictionary of (varname, ndarray) that can be used to supply pre-extracted NetCDF variables to the computational routines. It is primarily used for internal purposes, but can also be used to improve performance by eliminating the need to repeatedly extract the same variables used in multiple diagnostics calculations, particularly when using large sequences of files. Default is None.
  • meta (bool, optional) – Set to False to disable metadata and return numpy.ndarray instead of xarray.DataArray. Default is True.
Returns:

The interpolated variable. If xarray is enabled and the meta parameter is True, then the result will be a xarray.DataArray object. Otherwise, the result will be a numpy.ndarray object with no metadata.

Return type:

xarray.DataArray or numpy.ndarray