Wave roses of a buoy

Wave roses of a buoy#

In this tutorial, we show how to:

  • plot a rose of the significant wave height and the wave direction of a buoy,

  • mask the bad quality data,

  • compare the seasons and the peak period.

The concepts are explained in the Plotting fields, grids and sections guide.

Initialisations#

import matplotlib.pyplot as plt

import xoa
from xoa.plot import plot_rose

plt.rcParams.update({"font.size": 9, "axes.titlesize": 10, "axes.titleweight": "bold"})

The hourly wave parameters of the Pierres Noires buoy, in the Iroise Sea, from 2013 to 2024. The quality flag is 1 for the good values.

ds = xoa.open_data_sample("OBS/WAVES/wave_buoy_6200069_2013-2024.nc")
ds = ds.where(ds.hs_qc == 1)
ds
<xarray.Dataset> Size: 5MB
Dimensions:       (time: 96432)
Coordinates:
  * time          (time) datetime64[ns] 771kB 2013-07-01 ... 2024-06-30T23:00:00
Data variables:
    hs            (time) float64 771kB 1.3 1.3 1.1 0.9 0.8 ... 0.9 1.0 1.0 1.1
    hs_qc         (time) float32 386kB 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0
    tp            (time) float64 771kB 9.1 9.1 10.0 9.1 10.5 ... 7.7 7.1 8.3 7.7
    tp_qc         (time) float32 386kB 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0
    tm02          (time) float64 771kB 6.5 6.9 7.0 6.7 6.6 ... 5.3 5.0 5.3 4.9
    tm02_qc       (time) float32 386kB 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0
    direction     (time) float64 771kB 294.0 294.0 291.0 ... 277.0 278.0 278.0
    direction_qc  (time) float32 386kB 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0
Attributes:
    title:          Hourly wave parameters of the buoy 6200069 (Pierres Noires)
    platform_code:  6200069
    longitude:      -4.97
    latitude:       48.29
    source:         Copernicus Marine Service In Situ, product INSITU_GLO_WAV...
    institution:    Cerema (French centre for studies and expertise on risks,...


The waves come mostly from the west. The direction is the one they come from. plot_rose() draws the rose, which is also available as the rose() method of the plot accessor.

rose = plot_rose(ds.hs, ds.direction)
rose.ax.set_title("Significant wave height")
Significant wave height
Text(0.5, 1.117602784833945, 'Significant wave height')

Winter and summer#

Waves are higher and more regular in winter. The same bins are used for both roses.

edges = [0, 1, 2, 3, 4, 6, 8]
fig = plt.figure(figsize=(9, 4.5))
fig.subplots_adjust(right=0.72)  # room for the legend
for i, (name, months) in enumerate({"Winter": [12, 1, 2], "Summer": [6, 7, 8]}.items()):
    sub = ds.isel(time=ds.time.dt.month.isin(months))
    rose = plot_rose(
        sub.hs, sub.direction, edges=edges, rmax=40, fig=fig, subplot=121 + i, legend=i == 1
    )
    rose.ax.set_title(name)
Winter, Summer

Peak period#

Long periods are swell and short ones are wind sea, which has wider directions.

rose = plot_rose(ds.tp, ds.direction, edges=[0, 6, 8, 10, 12, 14, 16], cmap="YlOrBr")
rose.ax.set_title("Peak period")
Peak period
Text(0.5, 1.160452075892098, 'Peak period')

Total running time of the script: (0 minutes 2.115 seconds)

Gallery generated by Sphinx-Gallery