radarx.vis.maxcappi.plot_maxcappi#
- radarx.vis.maxcappi.plot_maxcappi(ds, data_var, cmap=None, vmin=None, vmax=None, title=None, lat_lines=None, lon_lines=None, add_map=True, projection=None, colorbar=True, range_rings=False, dpi=100, savedir=None, show_figure=True, add_slogan=False, **kwargs)[source]#
Plot a Maximum Constant Altitude Plan Position Indicator (Max-CAPPI) using an xarray Dataset.
- Parameters:
ds (
xarray.Dataset
) – Xarray Dataset containing the gridded radar data to be plotted.data_var (
str
) – The radar data_var to be plotted (e.g., “REF”, “VEL”, “WIDTH”).cmap (
str
ormatplotlib colormap
, optional) – Colormap to use for the plot. Default is “NWSRef”.vmin (
float
, optional) – Minimum value for the color scaling. Default is set to the minimum value of the data if not provided.vmax (
float
, optional) – Maximum value for the color scaling. Default is set to the maximum value of the data if not provided.title (
str
, optional) – Title of the plot. If None, the title is set to “Max-{data_var}”.lat_lines (array-like, optional) – Latitude lines to be included in the plot. Default is calculated based on dataset coordinates.
lon_lines (array-like, optional) – Longitude lines to be included in the plot. Default is calculated based on dataset coordinates.
add_map (
bool
, optional) – Whether to include a map background in the plot. Default is True.projection (
cartopy.crs.Projection
, optional) – The map projection for the plot. Default is automatically determined based on dataset coordinates.colorbar (
bool
, optional) – Whether to include a colorbar in the plot. Default is True.range_rings (
bool
, optional) – Whether to include range rings at 50 km intervals. Default is False.dpi (
int
, optional) – DPI (dots per inch) for the plot. Default is 100.savedir (
str
, optional) – Directory where the plot will be saved. If None, the plot is not saved.show_figure (
bool
, optional) – Whether to display the plot. Default is True.add_slogan (
bool
, optional) – Whether to add a slogan like “Powered by Radarx” to the plot. Default is False.**kwargs (
dict
, optional) – Additional keyword arguments to pass to matplotlib’s pcolormesh function.
- Returns:
None
– This function does not return any value. It generates and optionally displays or saves a plot.
Notes
The function extracts the maximum value across the altitude (z) dimension to create the Max-CAPPI.
It supports customizations such as map projections, color scales, and range rings.
If the radar_name attribute in the dataset is a byte string, it will be decoded and limited to 4 characters.
If add_map is True, map features and latitude/longitude lines are included.
The plot can be saved to a specified directory in PNG format.
Author: Syed Hamid Ali (@syedhamidali)