import earthkit.data
import earthkit.maps
import numpy as np
data = earthkit.data.from_source(
"cds",
'reanalysis-era5-single-levels',
{
'product_type': 'reanalysis',
'variable': 'mean_wave_direction',
'year': '1985',
'month': '12',
'day': '25',
'time': '12:00',
},
)
style = earthkit.maps.Style(
colors="twilight",
levels=np.arange(-22.5, 390, 45),
legend_style="disjoint",
bin_labels=["N", "NE", "E", "SE", "S", "SW", "W", "NW"],
)
chart = earthkit.maps.Chart()
chart.plot(data, style=style)
chart.coastlines()
chart.gridlines()
chart.legend(location="top", ncols=8)
chart.show()