xoa.plot.plot_rose

Contents

xoa.plot.plot_rose#

xoa.plot.plot_rose(value, direction=None, cartesian=None, from_=False, **kwargs)[source]#

Plot a wind, wave or current rose

The frequencies of the directions are stacked by bins of value. The samples that are missing in the value or in the direction are ignored: mask the bad quality ones before, for instance with xarray.DataArray.where().

Parameters:
  • value (xarray.DataArray, xarray.Dataset) – Wind speed or wave height, for instance, or the eastward component when cartesian is true. With a dataset, the first of the "wspd" and "hs" generic meta names that is found is used, and the direction is searched with xoa.meta when not provided. When none is found, the components of the currents are searched with xoa.dyn.get_u() and xoa.dyn.get_v(), then those of the wind.

  • direction (None, xarray.DataArray) – Direction in degrees, clockwise from the north, with the same shape as the value. It is the direction that the wind or the waves come from or go to: this does not change the plot. The "wfdir", "wtdir", "wdir", "th1p" and "dp" generic names are searched in a dataset. It is the northward component when cartesian is true.

  • cartesian (None, bool) – Are the arguments the eastward and northward components (u, v) instead of (value, direction)? The rose is then made of the speed and of its direction. If None, direction is taken as a northward component when it is identified as such with xoa.meta and has no angle units.

  • from (bool) – With components, use the direction the flow comes from, like the wind and the waves, instead of the direction it goes to, like the currents.

  • kwargs – Extra parameters, like nsector, edges, cmap or rmax, are passed to xoa.core.plot.plot_rose().

Returns:

xoa.core.plot.Rose

Example

plot_rose(ds.hs, ds.direction, nsector=12)
plot_rose(ds)  # variables are searched
plot_rose(ds.u, ds.v, from_=True)
plot_rose(ds.uo, ds.vo_alias, cartesian=True)  # when the components are not identified