polaris.viz.plot_horiz_field

polaris.viz.plot_horiz_field(ds, ds_mesh, field_name, out_file_name=None, ax=None, title=None, t_index=None, z_index=None, vmin=None, vmax=None, show_patch_edges=False, cmap=None, cmap_set_under=None, cmap_set_over=None, cmap_scale='linear', cmap_title=None, figsize=None, vert_dim='nVertLevels', cell_mask=None, patches=None, patch_mask=None, transect_x=None, transect_y=None, transect_color='black', transect_start='red', transect_end='green', transect_linewidth=2.0, transect_markersize=12.0)[source]

Plot a horizontal field from a planar domain using x,y coordinates at a single time and depth slice.

Parameters
  • ds (xarray.Dataset) – A data set containing fieldName

  • ds_mesh (xarray.Dataset) – A data set containing horizontal mesh variables

  • field_name (str) – The name of the variable to plot, which must be present in ds

  • out_file_name (str, optional) – The path to which the plot image should be written

  • ax (matplotlib.axes.Axes) – Axes to plot to if making a multi-panel figure

  • title (str, optional) – The title of the plot

  • vmin (float, optional) – The minimum values for the colorbar

  • vmax (float, optional) – The maximum values for the colorbar

  • show_patch_edges (boolean, optional) – If true, patches will be plotted with visible edges

  • t_index (int, optional) – The indices of Time axes to select for plotting. The default is 0 (initial time)

  • z_index (int, optional) – The indices of nVertLevels axes to select for plotting. The default is 0 (top level)

  • cmap (Colormap or str, optional) – A color map to plot

  • cmap_set_under (str or None, optional) – A color for low out-of-range values

  • cmap_set_over (str or None, optional) – A color for upper out-of-range values

  • cmap_scale ({'log', 'linear'}, optional) – Whether the colormap is logarithmic or linear

  • cmap_title (str, optional) – Title for color bar

  • figsize (tuple, optional) – The width and height of the figure in inches. Default is determined based on the aspect ratio of the domain.

  • vert_dim (str, optional) – Name of the vertical dimension

  • cell_mask (numpy.ndarray, optional) – A bool mask indicating where cells are valid, used to mask fields on both cells and edges. Not used if patches and patch_mask are supplied

  • patches (list of numpy.ndarray, optional) – Patches from a previous call to plot_horiz_field()

  • patch_mask (numpy.ndarray, optional) – A mask of where the field has patches from a previous call to plot_horiz_field()

  • transect_x (numpy.ndarray or xarray.DataArray, optional) – The x coordinates of a transect to plot on the

  • transect_y (numpy.ndarray or xarray.DataArray, optional) – The y coordinates of a transect

  • transect_color (str, optional) – The color of the transect line

  • transect_start (str or None, optional) – The color of a dot marking the start of the transect

  • transect_end (str or None, optional) – The color of a dot marking the end of the transect

  • transect_linewidth (float, optional) – The width of the transect line

  • transect_markersize (float, optional) – The size of the transect start and end markers

Returns

  • patches (list of numpy.ndarray) – Patches to reuse for future plots. Patches for cells can only be reused for other plots on cells and similarly for edges.

  • patch_mask (numpy.ndarray) – A mask used to select entries in the field that have patches