wradlib.util.cross_section_ppi

wradlib.util.cross_section_ppi(obj, azimuth, method=None, tolerance=None, real_beams=False, bw=1, proj=None, npl=1000)

Cut a cross section from PPI volume scans

New in version 1.18.

This function extracts cross sections from a PPI volume scan along one or more azimuth angles, or along a line connecting two given points. Similar to PyArt’s cross_section_ppi function.

Parameters:
  • obj (wradlib:wradlib.io.xarray.RadarVolume - Radar volume containing PPI sweeps) – from which azimuthal cross sections will be extracted.

  • azimuths (int, float, slice, tuple or list) – Value of azimuth to extract the cross section. It can be multiple values in the form of a slice, or a tuple or list of values. Alternatively, it can be given a tuple or list containing coordinates of two arbitrary points in the x,y space of the georeferenced object: [ (x1, y1), (x2,y2) ]. In case two points are given, a cross section along the line connecting the points will be generated by selecting the nearest-neighbor values of data. No interpolation of data is performed. If more than two points are given, only the first two are used. The resulting dataset has dimensions xyi (which is just an index along the line connecting the points) and elevation, and coordinates xy (distance along the line from p1) and z. The xy and z coordinates should be used for plotting.

Keyword Arguments:
  • method ({None, "nearest", "pad", "ffill", "backfill", "bfill"}, optional) – Method for inexact matches from xarray:xarray.Dataset.sel.

  • tolerance ({None, "nearest", "pad", "ffill", "backfill", "bfill"}, optional) – Maximum distance between original and new labels for inexact matches from xarray:xarray.Dataset.sel.

  • real_beams (bool) – Option meant for plotting beams with their true beamwidth instead of filling the empty space by stretching the beams (because of how matplotlib pcolormesh works). Defaults to False, which returns a Dataset of cross sections in the specified azimuth(s). If set to True, it will return the same Dataset with additional “fake” beams (extra elevations) so that when plotting with matplotlib pcolormesh the beamwidths are correctly represented according to their width.

  • bw (float, optional) – beam width in degrees (defaults to 1 degree). This is only used if “real_beams=True”.

  • proj (osgeo.osr.SpatialReference, cartopy.crs.CRS or None) – Projection to use with wradlib.georef.xarray.georeference_dataset. If GDAL OSR SRS, output is in this projection, else AEQD.

  • npl (int) – Number of points to make up the line between p1 and p2, in case the user gives two arbitrary points instead of an azimuth value. npl should be high enough to accomodate more points along the line that points of data available (i.e., higher that the resolution of the data). The default value should be enough for most cases, but in case the result looks low resolution try increasing npl.

Returns:

obj (xarray.Dataset or xarray.DataArray) – Dataset of cross section(s) in the specified azimuth(s) or along the line connecting the given points.