environmentaltools.graphics.plot_db

environmentaltools.graphics.plot_db(xarr, var_, coords=['lon', 'lat'], ind_=0, levels=[0, 1, 2, 5, 10, 40], title=None, ax=None, fname=None)[source]

Plot spatial database field with optional depth contours.

Visualizes a variable from an xarray dataset with filled contours and optional depth contour lines overlaid.

Parameters:
  • xarr (xarray.Dataset) – Dataset containing coordinates and variables.

  • var (str) – Variable name to plot.

  • coords (list, optional) – List of coordinate names [x_coord, y_coord]. Defaults to [‘lon’, ‘lat’].

  • ind (int, optional) – Index for third dimension (e.g., time or vertical level). Defaults to 0.

  • levels (list, optional) – Depth contour levels to display. Defaults to [0, 1, 2, 5, 10, 40].

  • title (str, optional) – Plot title. Defaults to None.

  • ax (matplotlib.axes.Axes, optional) – Axes object to plot on. Defaults to None.

  • fname (str, optional) – Filename to save the figure. Defaults to None.

Returns:

The axes object with the plot.

Return type:

matplotlib.axes.Axes