# wradlib.vis.plot_ppi¶

wradlib.vis.plot_ppi(data, r=None, az=None, autoext=True, site=(0, 0), proj=None, elev=0.0, fig=None, ax=111, func=’pcolormesh’, cg=False, rf=1.0, refrac=False, **kwargs)

Plots a Plan Position Indicator (PPI).

Changed in version 0.10.0: added contour, contourf plotting, added cg

Changed in version 0.6.0: using osr objects instead of PROJ.4 strings as parameter

The implementation of this plot routine is in cartesian axes and does all coordinate transforms beforehand. This allows zooming into the data as well as making it easier to plot additional data (like gauge locations) without having to convert them to the radar’s polar coordinate system.

Using cg=True the plotting is done in a curvelinear grid axes. Additional data can be plotted in polar coordinates or cartesian coordinates depending which axes object is used.

**kwargs may be used to try to influence the matplotlib.pyplot.pcolormesh, matplotlib.pyplot.contour, matplotlib.pyplot.contourf and wradlib.georef.polar2lonlatalt_n routines under the hood.

There is one major caveat concerning the values of r and az. Due to the way matplotlib.pyplot.pcolormesh works, r should give the location of the start of each range bin, while az should give the angle also at the begin (i.e. ‘leftmost’) of the beam. This might be in contrast to other conventions, which might define ranges and angles at the center of bin and beam. This affects especially the default values set for r and az, but ìt should be possible to accommodate all other conventions by setting r and az properly.

Parameters: data (np.array) – The data to be plotted. It is assumed that the first dimension is over the azimuth angles, while the second dimension is over the range bins r (np.array) – The ranges. Units may be chosen arbitrarily, unless proj is set. In that case the units must be meters. If None, a default is calculated from the dimensions of data. rf (float) – If present, factor for scaling range axes, defaults to 1. az (np.array) – The azimuth angles in degrees. If None, a default is calculated from the dimensions of data. autoext (True | False) – This routine uses matplotlib.pyplot.pcolormesh to draw the bins. As this function needs one set of coordinates more than would usually be provided by r and az, setting ´autoext´ to True automatically extends r and az so that all of data will be plotted. refrac (True | False) – If True, the effect of refractivity of the earth’s atmosphere on the beam propagation will be taken into account. If False, simple trigonometry will be used to calculate beam propagation. Functionality for this will be provided by function wradlib.georef.arc_distance_n. Therefore, if refrac is True, r must be given in meters. site (tuple) – Tuple of coordinates of the radar site. If proj is not used, this simply becomes the offset for the origin of the coordinate system. If proj is used, values must be given as (longitude, latitude) tuple of geographical coordinates. proj (osr spatial reference object) – GDAL OSR Spatial Reference Object describing projection If this parameter is not None, site must be set. Then the function will attempt to georeference the radar bins and display the PPI in the coordinate system defined by the projection string. elev (float or array of same shape as az) – Elevation angle of the scan or individual azimuths. May improve georeferencing coordinates for larger elevation angles. fig (matplotlib Figure object) – If given, the RHI will be plotted into this figure object. Axes are created as needed. If None, a new figure object will be created or current figure will be used, depending on “ax”. ax (matplotlib Axes object | matplotlib grid definition) – If matplotlib Axes object is given, the PPI will be plotted into this axes object. If matplotlib grid definition is given (nrows/ncols/plotnumber), axis are created in the specified place. Defaults to ‘111’, only one subplot/axis. func (str) – Name of plotting function to be used under the hood. Defaults to ‘pcolormesh’. ‘contour’ and ‘contourf’ can be selected too. cg (True | False) – If True, the data will be plotted on curvelinear axes.
Returns: ax (matplotlib Axes object) – The axes object into which the PPI was plotted pm (mmatplotlib QuadMesh object | matplotlib QuadContourSet) – The result of the pcolormesh operation. Necessary, if you want to add a colorbar to the plot.

Note

If cg is True, the cgax - curvelinear Axes (r-theta-grid) is returned. caax - Cartesian Axes (x-y-grid) and paax - parasite axes object for plotting polar data can be derived like this:

caax = cgax.parasites[0]
paax = cgax.parasites[1]
`

The function create_cg uses the Matplotlib AXISARTIST namespace mpl_toolkits.axisartist.

Here are some limitations to normal Matplotlib Axes. While using the Matplotlib AxesGrid Toolkit most of the limitations can be overcome. See Matplotlib AxesGrid Toolkit User’s Guide.

Examples

See A simple function to plot polar data in cartesian coordinate systems, and notebooks/visualisation/wwradlib_plot_curvelinear_grids.ipynb.