Note
Go to the end to download the full example code.
Wind Rose: Variable by Wind Direction¶
Radial plot that aggregates a variable into wind-direction sectors. Each compass sector is drawn as a polar bar whose length is the sector’s aggregated value (mean, median, min, max, sum, std or count), with North at the top and angles increasing clockwise — the standard meteorological wind-rose layout.
Here we look at the directional response of the CO2 flux: which wind sectors the station sees net uptake (negative flux) from, and which it sees release from.
Load data¶
The EddyPro full-output example carries wind_dir (degrees) alongside the
fluxes and meteo variables in a single dataframe, so no merging is needed.
> Reading file
exampledata_EDDYPRO-FULL-OUTPUT-CSV-30MIN_eddypro_CH-FRU_FR-20240408-101506_full
_output_2024-04-08T101558_adv.csv ...
Data: 468 records, wind_dir 3-360 deg
Aggregate and plot¶
Data + aggregation parameters go to __init__ (Phase 1); all styling lives in
plot() (Phase 2). agg='mean' reduces the CO2 flux to a per-sector mean;
bars are coloured by value with a diverging colormap, so blue sectors (net
uptake) and red sectors (net release) read at a glance. The per-sector table is
always available on .results and is printed as a Rich table with
verbose=True.
rose = dv.plotting.WindRosePlot(
series=df['co2_flux'], # Data: variable to aggregate
wind_dir=df['wind_dir'], # Data: wind direction in degrees
agg='mean', # Data: per-sector aggregation
n_sectors=64, # Data: 16 compass sectors (N, NNE, NE, ...)
verbose=True, # prints the Rich per-sector report
)
style = dv.plotting.FormatStyle(title='Mean CO2 flux by wind direction (CH-CHA)')
rose.plot(
format_style=style,
cmap='RdBu_r', # Styling: blue = uptake, red = release
cb_label='Mean CO2 flux',
# cb_digits_after_comma defaults to None -> integer colorbar labels here,
# since the flux ticks (-25, -20, ... 5) need no decimals.
)
plt.show(block=False)

Wind rose: co2_flux by wind direction (mean, 64 sectors)
┏━━━━━━━━┳━━━━━━━━┳━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━━┓
┃ Sector ┃ Center ┃ N ┃ Mean ┃ Median ┃ Min ┃ Max ┃ Std ┃ Sum ┃
┡━━━━━━━━╇━━━━━━━━╇━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━━┩
│ 0° │ 0° │ 3 │ -14.6 │ -16.3 │ -19 │ -8.66 │ 5.36 │ -43.9 │
│ 6° │ 6° │ 2 │ -15.9 │ -15.9 │ -19.3 │ -12.5 │ 4.84 │ -31.8 │
│ 11° │ 11° │ 2 │ -1.53 │ -1.53 │ -9.89 │ 6.82 │ 11.8 │ -3.07 │
│ 17° │ 17° │ 0 │ - │ - │ - │ - │ - │ - │
│ 22° │ 22° │ 8 │ -16.2 │ -17.3 │ -24.2 │ 6.61 │ 9.79 │ -129 │
│ 28° │ 28° │ 3 │ 3.46 │ 4.54 │ 1.09 │ 4.74 │ 2.05 │ 10.4 │
│ 34° │ 34° │ 2 │ -10.2 │ -10.2 │ -15 │ -5.38 │ 6.78 │ -20.3 │
│ 39° │ 39° │ 3 │ 2.61 │ 4.79 │ -2.02 │ 5.07 │ 4.01 │ 7.84 │
│ 45° │ 45° │ 0 │ - │ - │ - │ - │ - │ - │
│ 51° │ 51° │ 3 │ -1.87 │ -1.31 │ -6.26 │ 1.97 │ 4.15 │ -5.6 │
│ 56° │ 56° │ 5 │ 2.47 │ 3.36 │ -1.82 │ 4.27 │ 2.51 │ 12.3 │
│ 62° │ 62° │ 5 │ 2.32 │ 3.22 │ -5.16 │ 13.7 │ 7.54 │ 11.6 │
│ 68° │ 68° │ 10 │ 2.01 │ 0.795 │ -20 │ 21.1 │ 11.6 │ 20.1 │
│ 73° │ 73° │ 8 │ -3.54 │ -2.98 │ -20.1 │ 6.86 │ 8.08 │ -28.3 │
│ 79° │ 79° │ 8 │ -0.384 │ 1.61 │ -9.87 │ 7.68 │ 5.94 │ -3.07 │
│ 84° │ 84° │ 11 │ -4.88 │ -2.86 │ -39.4 │ 11 │ 13.2 │ -53.6 │
│ 90° │ 90° │ 3 │ -4.06 │ -9.24 │ -10 │ 7.09 │ 9.67 │ -12.2 │
│ 96° │ 96° │ 5 │ -4.95 │ -3.3 │ -10.3 │ 1.11 │ 4.71 │ -24.7 │
│ 101° │ 101° │ 2 │ -9.87 │ -9.87 │ -10.3 │ -9.45 │ 0.6 │ -19.7 │
│ 107° │ 107° │ 3 │ -16.3 │ -3.59 │ -52.3 │ 6.85 │ 31.6 │ -49 │
│ 112° │ 112° │ 3 │ -2.6 │ -3.39 │ -6.13 │ 1.71 │ 3.98 │ -7.81 │
│ 118° │ 118° │ 5 │ 2.18 │ -1.95 │ -4.92 │ 11.2 │ 7.91 │ 10.9 │
│ 124° │ 124° │ 9 │ -1.6 │ 2.91 │ -17.2 │ 22.3 │ 13.6 │ -14.4 │
│ 129° │ 129° │ 17 │ -7.34 │ -8.14 │ -20.1 │ 9.4 │ 10.5 │ -125 │
│ 135° │ 135° │ 29 │ -2.42 │ 1.98 │ -18.5 │ 8.42 │ 9.56 │ -70.1 │
│ 141° │ 141° │ 25 │ 3.43 │ 6.24 │ -11.8 │ 10.1 │ 6.14 │ 85.8 │
│ 146° │ 146° │ 17 │ -2.51 │ 0.0317 │ -19.3 │ 10.5 │ 11.1 │ -42.7 │
│ 152° │ 152° │ 12 │ 1.68 │ 4.32 │ -22.3 │ 8.02 │ 8.12 │ 20.1 │
│ 158° │ 158° │ 15 │ -4.83 │ 3.74 │ -23 │ 9.58 │ 13.2 │ -72.5 │
│ 163° │ 163° │ 9 │ -3.54 │ 4.68 │ -24.5 │ 6 │ 11.4 │ -31.8 │
│ 169° │ 169° │ 14 │ -2.12 │ 0.822 │ -31.2 │ 29.2 │ 14.2 │ -29.6 │
│ 174° │ 174° │ 4 │ -9.94 │ -11.8 │ -21.1 │ 4.88 │ 11.5 │ -39.8 │
│ 180° │ 180° │ 12 │ -2.91 │ -0.721 │ -17.2 │ 7.53 │ 10 │ -34.9 │
│ 186° │ 186° │ 7 │ -13.6 │ -16.4 │ -20.5 │ 2.69 │ 7.96 │ -95.5 │
│ 191° │ 191° │ 11 │ -8.35 │ -14 │ -26.5 │ 5.13 │ 11.2 │ -91.9 │
│ 197° │ 197° │ 12 │ -1.87 │ -0.292 │ -23 │ 19.5 │ 13.2 │ -22.4 │
│ 202° │ 202° │ 15 │ -2.08 │ 0.594 │ -22 │ 13.2 │ 10.1 │ -31.2 │
│ 208° │ 208° │ 23 │ 5.44 │ 2.4 │ -32.1 │ 82.8 │ 25 │ 125 │
│ 214° │ 214° │ 36 │ 1.54 │ 1.17 │ -32.7 │ 120 │ 26.6 │ 55.3 │
│ 219° │ 219° │ 20 │ -15.2 │ -8.67 │ -126 │ 10.4 │ 31.6 │ -303 │
│ 225° │ 225° │ 7 │ -19.8 │ -16.4 │ -39.5 │ -2.8 │ 12 │ -139 │
│ 231° │ 231° │ 3 │ -14.8 │ -17.8 │ -17.8 │ -8.82 │ 5.19 │ -44.4 │
│ 236° │ 236° │ 8 │ -2.23 │ -6.74 │ -16.4 │ 37 │ 18 │ -17.9 │
│ 242° │ 242° │ 4 │ -7.14 │ -7.73 │ -16.4 │ 3.33 │ 10.7 │ -28.6 │
│ 248° │ 248° │ 2 │ -15.2 │ -15.2 │ -19.7 │ -10.6 │ 6.4 │ -30.3 │
│ 253° │ 253° │ 6 │ -15.3 │ -15.4 │ -19 │ -12.8 │ 2.3 │ -91.7 │
│ 259° │ 259° │ 2 │ -21.7 │ -21.7 │ -27.1 │ -16.3 │ 7.62 │ -43.3 │
│ 264° │ 264° │ 4 │ -10.1 │ -10.7 │ -16.3 │ -2.5 │ 5.69 │ -40.2 │
│ 270° │ 270° │ 4 │ -13.8 │ -14 │ -18.3 │ -8.93 │ 4.46 │ -55.1 │
│ 276° │ 276° │ 2 │ -10.5 │ -10.5 │ -12.7 │ -8.35 │ 3.05 │ -21 │
│ 281° │ 281° │ 2 │ -16.9 │ -16.9 │ -19.8 │ -14 │ 4.1 │ -33.9 │
│ 287° │ 287° │ 1 │ -21 │ -21 │ -21 │ -21 │ - │ -21 │
│ 292° │ 292° │ 2 │ -13.2 │ -13.2 │ -16 │ -10.3 │ 4.01 │ -26.3 │
│ 298° │ 298° │ 1 │ -17.8 │ -17.8 │ -17.8 │ -17.8 │ - │ -17.8 │
│ 304° │ 304° │ 3 │ -9.6 │ -10 │ -15.7 │ -3.09 │ 6.31 │ -28.8 │
│ 309° │ 309° │ 1 │ -5.73 │ -5.73 │ -5.73 │ -5.73 │ - │ -5.73 │
│ 315° │ 315° │ 2 │ -12.3 │ -12.3 │ -15.3 │ -9.29 │ 4.23 │ -24.6 │
│ 321° │ 321° │ 0 │ - │ - │ - │ - │ - │ - │
│ 326° │ 326° │ 4 │ 0.517 │ -1.23 │ -10.3 │ 14.8 │ 10.5 │ 2.07 │
│ 332° │ 332° │ 2 │ -6.76 │ -6.76 │ -16 │ 2.5 │ 13.1 │ -13.5 │
│ 338° │ 338° │ 0 │ - │ - │ - │ - │ - │ - │
│ 343° │ 343° │ 0 │ - │ - │ - │ - │ - │ - │
│ 349° │ 349° │ 2 │ -8.32 │ -8.32 │ -14.2 │ -2.48 │ 8.26 │ -16.6 │
│ 354° │ 354° │ 2 │ -2.93 │ -2.93 │ -7.13 │ 1.26 │ 5.93 │ -5.87 │
└────────┴────────┴────┴────────┴────────┴───────┴───────┴──────┴───────┘
> 445 records aggregated into 64 wind sectors (plotted aggregate: 'mean').
> Largest 'mean' of co2_flux: sector 208° (5.44).
Colour by a second variable¶
Pass z to colour the bars by a different variable than the one driving
the bar lengths. Here the bar length is still the mean CO2 flux, but the colour
now encodes the mean air temperature per sector (aggregated by z_agg). The
bar value goes to .results as usual; the colour aggregate is added as Z.
rose_z = dv.plotting.WindRosePlot(
series=df['co2_flux'], # Data: bar length = mean CO2 flux
wind_dir=df['wind_dir'],
agg='mean',
n_sectors=360,
z=df['air_temperature'], # Data: bar colour = mean air temperature
z_agg='mean',
)
rose_z.plot(
format_style=dv.plotting.FormatStyle(title='CO2 flux (length) coloured by air temperature'),
cmap='plasma',
)
plt.show(block=False)

Inspect the result table¶
.results is a tidy per-sector DataFrame holding every statistic, not just
the plotted aggregate — handy for further analysis or export.
print(rose.results.round(2).to_string())
CENTER_DEG N_VALS MEAN MEDIAN MIN MAX STD SUM
SECTOR
0° 0.00 3 -14.65 -16.28 -19.00 -8.66 5.36 -43.94
6° 5.62 2 -15.90 -15.90 -19.33 -12.48 4.84 -31.81
11° 11.25 2 -1.53 -1.53 -9.89 6.82 11.82 -3.07
17° 16.88 0 NaN NaN NaN NaN NaN NaN
22° 22.50 8 -16.17 -17.33 -24.24 6.61 9.79 -129.33
28° 28.12 3 3.46 4.54 1.09 4.74 2.05 10.37
34° 33.75 2 -10.17 -10.17 -14.96 -5.38 6.78 -20.34
39° 39.38 3 2.61 4.79 -2.02 5.07 4.01 7.84
45° 45.00 0 NaN NaN NaN NaN NaN NaN
51° 50.62 3 -1.87 -1.31 -6.26 1.97 4.15 -5.60
56° 56.25 5 2.47 3.36 -1.82 4.27 2.51 12.33
62° 61.88 5 2.32 3.22 -5.16 13.71 7.54 11.59
68° 67.50 10 2.01 0.80 -19.97 21.14 11.61 20.09
73° 73.12 8 -3.54 -2.98 -20.08 6.86 8.08 -28.31
79° 78.75 8 -0.38 1.61 -9.87 7.68 5.94 -3.07
84° 84.38 11 -4.88 -2.86 -39.42 11.05 13.19 -53.64
90° 90.00 3 -4.06 -9.24 -10.03 7.09 9.67 -12.18
96° 95.62 5 -4.95 -3.30 -10.35 1.11 4.71 -24.73
101° 101.25 2 -9.87 -9.87 -10.30 -9.45 0.60 -19.75
107° 106.88 3 -16.34 -3.59 -52.29 6.85 31.56 -49.03
112° 112.50 3 -2.60 -3.39 -6.13 1.71 3.98 -7.81
118° 118.12 5 2.18 -1.95 -4.92 11.21 7.91 10.88
124° 123.75 9 -1.60 2.91 -17.22 22.31 13.63 -14.41
129° 129.38 17 -7.34 -8.14 -20.14 9.40 10.55 -124.83
135° 135.00 29 -2.42 1.98 -18.46 8.42 9.56 -70.09
141° 140.62 25 3.43 6.24 -11.76 10.10 6.14 85.82
146° 146.25 17 -2.51 0.03 -19.34 10.54 11.09 -42.74
152° 151.88 12 1.68 4.32 -22.30 8.02 8.12 20.10
158° 157.50 15 -4.83 3.74 -23.02 9.58 13.19 -72.51
163° 163.12 9 -3.54 4.68 -24.54 6.00 11.45 -31.83
169° 168.75 14 -2.12 0.82 -31.18 29.19 14.18 -29.62
174° 174.38 4 -9.94 -11.78 -21.08 4.88 11.48 -39.76
180° 180.00 12 -2.91 -0.72 -17.19 7.53 10.04 -34.94
186° 185.62 7 -13.65 -16.43 -20.49 2.69 7.96 -95.54
191° 191.25 11 -8.35 -14.01 -26.46 5.13 11.19 -91.88
197° 196.88 12 -1.87 -0.29 -23.03 19.47 13.22 -22.44
202° 202.50 15 -2.08 0.59 -22.00 13.22 10.10 -31.23
208° 208.12 23 5.44 2.40 -32.10 82.78 25.00 125.05
214° 213.75 36 1.54 1.17 -32.74 120.40 26.62 55.28
219° 219.38 20 -15.16 -8.67 -126.02 10.36 31.58 -303.22
225° 225.00 7 -19.82 -16.42 -39.53 -2.80 11.96 -138.71
231° 230.62 3 -14.82 -17.81 -17.81 -8.82 5.19 -44.45
236° 236.25 8 -2.23 -6.74 -16.45 36.97 17.97 -17.86
242° 241.88 4 -7.14 -7.73 -16.43 3.33 10.70 -28.56
248° 247.50 2 -15.17 -15.17 -19.70 -10.64 6.40 -30.35
253° 253.12 6 -15.29 -15.40 -19.00 -12.83 2.30 -91.73
259° 258.75 2 -21.66 -21.66 -27.05 -16.27 7.62 -43.33
264° 264.38 4 -10.06 -10.74 -16.26 -2.50 5.69 -40.24
270° 270.00 4 -13.78 -13.96 -18.27 -8.93 4.46 -55.12
276° 275.62 2 -10.50 -10.50 -12.65 -8.35 3.05 -21.00
281° 281.25 2 -16.93 -16.93 -19.83 -14.02 4.10 -33.85
287° 286.88 1 -21.00 -21.00 -21.00 -21.00 NaN -21.00
292° 292.50 2 -13.17 -13.17 -16.00 -10.34 4.01 -26.34
298° 298.12 1 -17.81 -17.81 -17.81 -17.81 NaN -17.81
304° 303.75 3 -9.60 -10.02 -15.68 -3.09 6.31 -28.79
309° 309.38 1 -5.73 -5.73 -5.73 -5.73 NaN -5.73
315° 315.00 2 -12.28 -12.28 -15.28 -9.29 4.23 -24.57
321° 320.62 0 NaN NaN NaN NaN NaN NaN
326° 326.25 4 0.52 -1.23 -10.29 14.82 10.48 2.07
332° 331.88 2 -6.76 -6.76 -16.02 2.50 13.10 -13.52
338° 337.50 0 NaN NaN NaN NaN NaN NaN
343° 343.12 0 NaN NaN NaN NaN NaN NaN
349° 348.75 2 -8.32 -8.32 -14.16 -2.48 8.26 -16.64
354° 354.38 2 -2.93 -2.93 -7.13 1.26 5.93 -5.87
Total running time of the script: (0 minutes 0.835 seconds)