plotting windrose using Matlab

조회 수: 36 (최근 30일)
Shital
Shital 2014년 8월 19일
댓글: Abigail Hobbs 2025년 3월 4일
Hi , can someone please help me with windrose plotting . I have directions and windspeed as my first and second column, and using wind_rose.m which I got from Matlab fileexchange Thanks S

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 8월 19일
Shital - there are two options for specifying wind direction using wind_rose from the File Exchange: standard (which is the default) and meteo. Using examples such as
v = 30*rand(10000,1);
d = rand(10000,1);
wind_rose(d,v)
shows the wind at the east, when I expect it to be at the north. Changing the wind directions to
d = 60 + rand(10000,1);
wind_rose(d,v)
shows the wind at roughly 30 degrees from north. This suggests that the author of the code is using a counter-clockwise from east system, where 0 degrees is at east (along the x-axis), ninety degrees is at north, etc.
You are probably expecting a clockwise from north system where 0 degrees is at north, 90 degrees is at east, etc. To get around this you can just subtract your direction vector from ninety degrees like
d = 90 - d;
If you re-use the examples from above, then winds appear correctly relative to north (y-axis).
If you decide to change the direction type from the default of standard to meteo, then this appears more of a meteorological wind direction convention. If the wind direction vector is primarily northern wind directions, then the wind is blowing to the north and so coming from the south. So you using
v = 30*rand(10000,1);
d = rand(10000,1);
wind_rose(d,v,'dtype','meteo')
will show winds in the south of the figure, since they are blowing to the north and so coming from the south. Likewise
d = 60 + rand(10000,1);
wind_rose(d,v,'dtype','meteo')
would show the winds coming from the south-west as they are blowing to 60 degrees from north
  댓글 수: 3
Geoff Hayes
Geoff Hayes 2014년 8월 19일
Shital - glad to have been able to help. But do you really need to do 'dtype','meteo' as well? Are you sure that you get the desired results from that? I think that the 90-D is sufficient.
José Perona
José Perona 2017년 5월 13일
Hi, I have a similar problem. The directions are wrong but if I use d-90 the wind rose is correct. I don't understand it because 0 degrees is north and 90 degrees is east according to the author. ¿Can you explain better please?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Al Mac
Al Mac 2017년 11월 24일
편집: Al Mac 2017년 11월 24일
Hello,
If you use the polarhistgram function you can index on wind speed and overlay to your hearts content -
figure
pax = polaraxes;
polarhistogram(deg2rad(wind_direction(wind_speed<25)),deg2rad(0:10:360),'displayname','20 - 25 m/s')
hold on
polarhistogram(deg2rad(wind_direction(wind_speed<20)),deg2rad(0:10:360),'FaceColor','red','displayname','15 - 20 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<15)),deg2rad(0:10:360),'FaceColor','yellow','displayname','10 - 15 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<10)),deg2rad(0:10:360),'FaceColor','green','displayname','5 - 10 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<5)),deg2rad(0:10:360),'FaceColor','blue','displayname','0 - 5 m/s')
pax.ThetaDir = 'clockwise';
pax.ThetaZeroLocation = 'top';
legend('Show')
title('Wind Rose')
Note, my data was in degrees. Remove deg2rad if yours is in radians.
  댓글 수: 2
Isabella Osetinsky-Tzidaki
Isabella Osetinsky-Tzidaki 2025년 1월 1일
I was happy to find the above code, but needed to modify it for my purposes, because:
1) I was having to define 16 wind direction sectors;
2) I didn't find any quick solution how to update the 12 default WD grid and the corresponding 12 WD ticks into 16 WD ticks. So I needed to merely set the grid and the ticks "off".
3) my biggest problem was to combine the WD just left to and right to the north direction to get a purely northern sector. So I defined the upper WD edge beyond the 0/360 to make it to coincide with the first WD edge: 11.25 deg = 371.25 deg (which is 11.25 deg plus 2*pi).
Finally, I set the 'renderer' to 'painters' to improve the figure quality.
Happily, all these modifications provided me with a good solution and a good figure.
One more point: as was showed by a simple histogram for WS, my max WS is 30.6 m/s while a bulk of the WS is below 10 m/s.
Below is the above code with my modifications:
vecWD=11.25:22.5:371.25;
% max WS = 30.6 m/s
polarhistogram(deg2rad(wind_direction(wind_speed<31)),deg2rad(vecWD),'FaceColor',[158/255 0 0],'displayname','> 10 m/s')
hold on
polarhistogram(deg2rad(wind_direction(wind_speed<10)),deg2rad(vecWD),'FaceColor',[1 102/255 0],'displayname','8 - 10 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<8)),deg2rad(vecWD),'FaceColor','yellow','displayname','6 - 8 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<6)),deg2rad(vecWD),'FaceColor','green','displayname','4 - 6 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<4)),deg2rad(vecWD),'FaceColor','blue','displayname','< 4 m/s')
hold off
pax.ThetaDir = 'clockwise';
pax.ThetaZeroLocation = 'top';
legend('Show')
title('Wind Rose')
set(gca,'thetagrid','off')
set(gca,'thetaticklabels',{' '})
set(gca,'rticklabels',{' '})
set(gcf,'ren','painters')
Abigail Hobbs
Abigail Hobbs 2025년 3월 4일
Hi! I am also working on generating wind roses. I have been struggling to find a way to color by polar coordinate sector - have you come across a way to do this? Trying to color by both wind speed and wind direction. Thank you!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by