environmentaltools.graphics.plot_quiver

environmentaltools.graphics.plot_quiver(db, is_db=True, vars_=['U', 'DirU'], cadency=1, title=None, scale=1, label_='U', ax=None, fname=None)[source]

Plot vector field using quiver arrows (e.g., currents, wind).

Visualizes directional data such as ocean currents or wind fields using arrow plots with magnitude-based coloring. Handles both xarray datasets and regular arrays.

Parameters:
  • db (xarray.Dataset or dict) – Dataset containing velocity magnitude and direction.

  • is_db (bool, optional) – If True, treats input as xarray Dataset. If False, treats as regular numpy arrays. Defaults to True.

  • vars (list, optional) – List of variable names [magnitude, direction]. Direction should be in degrees (oceanographic convention: direction TO). Defaults to [“U”, “DirU”].

  • cadency (int, optional) – Sampling interval for arrows (plots every nth point). Higher values = fewer arrows. Defaults to 1.

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

  • scale (float, optional) – Arrow scale factor. Smaller values = longer arrows. Defaults to 1.

  • label (str, optional) – Label for the colorbar. Defaults to “U”.

  • 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