wrf.interpline

wrf.interpline(field2d, wrfin=None, timeidx=0, stagger=None, projection=None, ll_point=None, pivot_point=None, angle=None, start_point=None, end_point=None, latlon=False, cache=None, meta=True)

Return the two-dimensional field interpolated along a line.

This 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.

Parameters:
  • field2d (xarray.DataArray or numpy.ndarray) – A two-dimensional field.

  • 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. Should not be used when working with x,y 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 field2d. 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, optional) – The map projection object to use when working with latitude, longitude coordinates, and must be specified if wrfin is None. Should not be used when working with x,y coordinates. 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, field2d 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.

  • 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