import mikeio
import modelskill as ms
= mikeio.read("../data/wave_dir.dfs0")
ds = ds[[0, 2, 1, 3]].to_dataframe()
df ms.plotting.wind_rose(df)
plotting.wind_rose
plotting.wind_rose(
data,*,
=('Measurement', 'Model'),
labels=None,
mag_step=16,
n_sectors=None,
calm_threshold=None,
calm_size='Calm',
calm_text=0.1,
r_step=None,
r_max=True,
legend='viridis',
cmap1='Greys',
cmap2=None,
mag_bins=None,
max_bin=None,
n_dir_labels=2.0,
secondary_dir_step_factor=(8, 8),
figsize=None,
ax=None,
title )
Plots a (dual) wind (wave or current) roses with calms.
The size of the calm is determined by the primary (measurement) data.
Parameters
Name | Type | Description | Default |
---|---|---|---|
data | array with 2 or 4 columns (magnitude, direction, magnitude2, direction2) | required | |
labels | tuple[str, str] | labels for the legend(s) | ('Measurement', 'Model') |
mag_step | float | None | discretization for magnitude (delta_r, in radial direction ) | None |
n_sectors | int | number of directional sectors | 16 |
calm_threshold | float | None | minimum value for data being counted as valid (i.e. below this is calm) | None |
calm_text | str | text to display in calm. | 'Calm' |
r_step | float | radial axis discretization. By default 0.1 i.e. every 10%. | 0.1 |
r_max | float | None | maximum radius (%) of plot, e.g. if 50% wanted then r_max=0.5 | None |
max_bin | float | None | max value to truncate the data, e.g., max_bin=1.0 if hm0=1m is the desired final bin. | None |
mag_bins | array of floats (optional) Default = None | force bins to array of values, e.g. when specifying non-equidistant bins. | None |
legend | bool | show legend | True |
cmap1 | string. Default= 'viridis' | colormap for main axis | 'viridis' |
cmap2 | string. Default= 'Greys' | colormap for secondary axis | 'Greys' |
n_dir_labels | int. Default= 4 | number of labels in the polar plot, choose between 4, 8 or 16, default is to use the same as n_sectors | None |
secondary_dir_step_factor | float. Default= 2.0 | reduce width of secondary axis by this factor | 2.0 |
figsize | tuple[float, float] | figure size | (8, 8) |
ax | Matplotlib axis to plot on defined as polar, it can be done using “subplot_kw = dict(projection = ‘polar’)”. Default = None, new axis created. | None |
|
title | title of the plot | None |
Returns
Name | Type | Description |
---|---|---|
matplotlib.axes.Axes | Matplotlib axis with the plot |