towerpy.datavis.rad_interactive#

Towerpy: an open-source toolbox for processing polarimetric radar data.

Classes#

PPI_Int

A class to create an interactive PPI plot.

HTI_Int

A class to create an interactive HTI plot.

Functions#

format_coord(x, y)

Format the coordinates used in plots.

ppi_base(rad_georef, rad_params, rad_vars[, var2plot, ...])

Create the base display for the interactive PPI explorer.

hti_base(pol_profs[, mlyrs, stats, var2plot, ptype, ...])

Create the base display for the HTI.

ml_detectionvis(hbeam, profzh_norm, profrhv_norm, ...)

Create an interactive plot for the ml_detection function.

Module Contents#

towerpy.datavis.rad_interactive.format_coord(x, y)[source]#

Format the coordinates used in plots.

Parameters#

xfloat

x-coordinates.

yfloat

y-coordinates.

Returns#

z: str

Value of a given pixel.

[q, r]list

angle and range of a given pixel.

class towerpy.datavis.rad_interactive.PPI_Int[source]#

A class to create an interactive PPI plot.

lastind = [0, 0][source]#
keycoords = [][source]#
current_line = [None][source]#
text[source]#
on_pick(event)[source]#

Get the click locations.

Parameters#

eventMouse click

Right or left click from the mouse.

on_press(event)[source]#

Browse through the next and previous azimuth.

Parameters#

eventkey-press, ‘n’ or ‘m’

Keyboard event.

on_key(event)[source]#

Record keyboard presses.

Parameters#

eventkey-press, 0-9

Record the coordinates when user press any number from 0 to 9.

update()[source]#

Update the interactive plot.

savearray2binfile(file_name, dir2save, min_snr=None, rsite=None)[source]#

Save the coordinates and pixel values of key-mouse events in a binfile.

Parameters#

file_namestr

Name of the file to be saved.

dir2savestr

Directory of the file to be saved.

towerpy.datavis.rad_interactive.ppi_base(rad_georef, rad_params, rad_vars, var2plot=None, coord_sys='polar', mlyr=None, vars_bounds=None, ucmap=None, unorm=None, cbticks=None, cb_ext=None, ppi_xlims=None, ppi_ylims=None, radial_xlims=None, radial_ylims=None, fig_size=None)[source]#

Create the base display for the interactive PPI explorer.

Parameters#

rad_georefdict

Georeferenced data containing descriptors of the azimuth, gates and beam height, amongst others.

rad_paramsdict

Radar technical details.

rad_varsdict

Dict containing radar variables to plot.

var2plotstr, optional

Key of the radar variable to plot. The default is None. This option will plot ZH or the ‘first’ element in the rad_vars dict.

coord_sys‘rect’ or ‘polar’, optional

Coordinates system (polar or rectangular). The default is ‘polar’.

mlyrMeltingLayer Class, optional

Plot the melting layer height. ml_top (float, int, list or np.array) and ml_bottom (float, int, list or np.array) must be explicitly defined. The default is None.

vars_boundsdict containing key and 3-element tuple or list, optional

Boundaries [min, max, nvals] between which radar variables are to be mapped.

ucmapcolormap, optional

User-defined colormap, either a matplotlib.colors.ListedColormap, or string from matplotlib.colormaps.

unormdict containing matplotlib.colors normalisation objects, optional

User-defined normalisation methods to map colormaps onto radar data. The default is None.

cbticksdict, optional

Modifies the default ticks’ location (dict values) and labels (dict keys) in the colour bar.

cb_extdict containing key and str, optional

The str modifies the end(s) for out-of-range values for a given key (radar variable). The str has to be one of ‘neither’, ‘both’, ‘min’ or ‘max’.

ppi_xlims2-element tuple or list, optional

Set the x-axis view limits [min, max] in the PPI. The default is None.

ppi_ylims2-element tuple or list, optional

Set the y-axis view limits [min, max] in the PPI. The default is None.

radial_xlims2-element tuple or list, optional

Set the x-axis view limits [min, max] in the PPI. The default is None.

radial_ylimsdict containing key and 2-element tuple or list, optional

Set the y-axis view limits [min, max] in the radial variables. Key must be in rad_vars dict. The default is None.

fig_size2-element tuple or list, optional

Modify the default plot size.

class towerpy.datavis.rad_interactive.HTI_Int[source]#

A class to create an interactive HTI plot.

lastind = 0[source]#
hzfunc(label)[source]#

Update the right panel of the interactive HTI plot.

Parameters#

labelstr

Name of the radar variable.

on_pick(event)[source]#

Get the click locations.

Parameters#

eventMouse click

Right click from the mouse.

update()[source]#

Update the HTI plot.

towerpy.datavis.rad_interactive.hti_base(pol_profs, mlyrs=None, stats=None, var2plot=None, ptype='pseudo', vars_bounds=None, contourl=None, ucmap=None, unorm=None, htixlim=None, htiylim=None, cbticks=None, cb_ext=None, fig_size=None, tz='Europe/London')[source]#

Create the base display for the HTI.

Parameters#

pol_profslist

List of PolarimetricProfiles objects.

mlyrslist, optional

List of MeltingLayer objects. The default is None.

statsstr, optional

Profiles statistic to plot in the right panel of the HTI plot. The default is None.

var2plotstr, optional

Key of the radar variable to plot. The default is None. This option will plot ZH or the ‘first’ element in the rad_vars dict.

ptypestr, ‘pseudo’ or ‘fcontour’

Create a pseudocolor or filled contours plot. The default is ‘pseudo’.

vars_boundsdict containing key and 3-element tuple or list, optional

Boundaries [min, max, nvals] between which radar variables are to be mapped.

contourlstr, optional

Draw contour lines of the specified radar variable. The default is None.

ucmapcolormap, optional

User-defined colormap, either a matplotlib.colors.ListedColormap, or string from matplotlib.colormaps.

unormdict containing matplotlib.colors normalisation objects, optional

User-defined normalisation methods to map colormaps onto radar data. The default is None.

htixlim2-element tuple or list of datetime objects, optional

Set the x-axis view limits [min, max]. The default is None.

htiylim2-element tuple or list, optional

Set the y-axis view limits [min, max]. The default is None.

cbticksdict, optional

Modifies the default ticks’ location (dict values) and labels (dict keys) in the colour bar.

cb_extdict containing key and str, optional

The str modifies the end(s) for out-of-range values for a given key (radar variable). The str has to be one of ‘neither’, ‘both’, ‘min’ or ‘max’.

fig_size2-element tuple or list, optional

Modify the default plot size.

tzstr

Key/name of the radar data timezone. The given tz string is then retrieved from the ZoneInfo module. Default is ‘Europe/London’

Returns#

radiowidget

A MPL radio button.

towerpy.datavis.rad_interactive.ml_detectionvis(hbeam, profzh_norm, profrhv_norm, profcombzh_rhv, pkscombzh_rhv, comb_mult, comb_mult_w, comb_idpy, mlrand, min_hidx, max_hidx, param_k, idxml_btm_it1, idxml_top_it1)[source]#

Create an interactive plot for the ml_detection function.