pysteps.visualization.precipfields.plot_precip_field

pysteps.visualization.precipfields.plot_precip_field(R, type='intensity', map=None, geodata=None, units='mm/h', colorscale='pysteps', probthr=None, title=None, colorbar=True, drawlonlatlines=False, basemap_resolution='l', basemap_scale_args=None, cartopy_scale='50m', lw=0.5, cartopy_subplot=(1, 1, 1), axis='on', cax=None, **kwargs)

Function to plot a precipitation intensity or probability field with a colorbar.

Parameters:
R : array-like

Two-dimensional array containing the input precipitation field or an exceedance probability map.

type : {‘intensity’, ‘depth’, ‘prob’}, optional

Type of the map to plot: ‘intensity’ = precipitation intensity field, ‘depth’ = precipitation depth (accumulation) field, ‘prob’ = exceedance probability field.

map : {‘basemap’, ‘cartopy’}, optional

Optional method for plotting a map: ‘basemap’ or ‘cartopy’. The former uses mpl_toolkits.basemap, while the latter uses cartopy.

geodata : dictionary, optional

Optional dictionary containing geographical information about the field. If geodata is not None, it must contain the following key-value pairs:

Key Value
projection PROJ.4-compatible projection definition
x1 x-coordinate of the lower-left corner of the data raster (meters)
y1 y-coordinate of the lower-left corner of the data raster (meters)
x2 x-coordinate of the upper-right corner of the data raster (meters)
y2 y-coordinate of the upper-right corner of the data raster (meters)
yorigin a string specifying the location of the first element in the data raster w.r.t. y-axis: ‘upper’ = upper border, ‘lower’ = lower border
units : {‘mm/h’, ‘mm’, ‘dBZ’}, optional

Units of the input array. If type is ‘prob’, this specifies the unit of the intensity threshold.

colorscale : {‘pysteps’, ‘STEPS-BE’, ‘BOM-RF3’}, optional

Which colorscale to use. Applicable if units is ‘mm/h’, ‘mm’ or ‘dBZ’.

probthr : float, optional

Intensity threshold to show in the color bar of the exceedance probability map. Required if type is “prob” and colorbar is True.

title : str, optional

If not None, print the title on top of the plot.

colorbar : bool, optional

If set to True, add a colorbar on the right side of the plot.

drawlonlatlines : bool, optional

If set to True, draw longitude and latitude lines. Applicable if map is ‘basemap’ or ‘cartopy’.

basemap_resolution : str, optional

The resolution of the basemap, see the documentation of mpl_toolkits.basemap. Applicable if map is ‘basemap’.

basemap_scale_args : list, optional

If not None, a map scale bar is drawn with basemap_scale_args supplied to mpl_toolkits.basemap.Basemap.drawmapscale.

cartopy_scale : {‘10m’, ‘50m’, ‘110m’}, optional

The scale (resolution) of the map. The available options are ‘10m’, ‘50m’, and ‘110m’. Applicable if map is ‘cartopy’.

lw: float, optional

Linewidth of the map (administrative boundaries and coastlines).

cartopy_subplot : tuple or SubplotSpec instance, optional

Cartopy subplot. Applicable if map is ‘cartopy’.

axis : {‘off’,’on’}, optional

Whether to turn off or on the x and y axis.

cax : Axes object, optional

Axes into which the colorbar will be drawn. If no axes is provided the colorbar axes are created next to the plot.

Returns:
ax : fig Axes

Figure axes. Needed if one wants to add e.g. text inside the plot.