wradlib.vis.plot_ppi#
- wradlib.vis.plot_ppi(data, r=None, az=None, elev=0.0, site=None, proj=None, fig=None, ax=111, func='pcolormesh', rf=1.0, **kwargs)[source]#
Plots a Plan Position Indicator (PPI).
This is a small wrapper around xarray dataarray. The radar data, coordinates and metadata is transformed into an xarray dataarray. Using the wradlib dataarray accessor the dataarray is enabled to plot polar data.
Using
proj=cg
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 thematplotlib.pyplot.pcolormesh
,matplotlib.pyplot.contour
,matplotlib.pyplot.contourf
andwradlib.georef.polar.spherical_to_proj
routines under the hood.Concerning the values of
r
,az
,elev
,r
should give the location of the center of each range bin,az
andelev
should give the angle at the center of the beam.- Parameters:
data (
numpy.ndarray
) – 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 binsr (
numpy.ndarray
) – 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 ofdata
.rf (
float
) – If present, factor for scaling range axes, defaults to 1.az (
numpy.ndarray
) – The azimuth angles in degrees in increasing order. If None, a default is calculated from the dimensions ofdata
.elev (
float
ornumpy.ndarray
) – float or array of same shape asaz
Elevation angle of the scan or individual azimuths. May improve georeferencing coordinates for larger elevation angles.site (
tuple
orNone
) – Tuple of coordinates of the radar site. Ifproj
is not used, this simply becomes the offset for the origin of the coordinate system. Ifproj
is used, values must be given as (longitude, latitude, altitude) tuple of geographical coordinates. Defaults to None.proj (
osgeo.osr.SpatialReference
,cartopy.crs.CRS
,dict
orNone
) – 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.fig (
matplotlib.figure.Figure
) – If given, the PPI 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 onax
.ax (
matplotlib.axes.Axes
ormatplotlib.gridspec.SubplotSpec
) – 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.
- Returns:
ax (
matplotlib.axes.Axes
) – The axes object into which the PPI was plottedpm (
matplotlib.collections.QuadMesh
ormatplotlib.contour.QuadContourSet
) – The result of the plotting function. Necessary, if you want to add a colorbar to the plot.
Note
If proj=``cg``, the
cgax
- curvelinear Axes (r-theta-grid) is returned.caax
- Cartesian Axes (x-y-grid) andpaax
- 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.Here are some limitations to normal Matplotlib Axes (see AXES_GRID1).
Examples
See Quick-view a sweep in polar or cartesian reference systems, and Plot on curvelinear grid.