4.45455

4.5 | 22 ratings Rate this file 294 downloads (last 30 days) File Size: 5.06 KB File ID: #17748

Wind_rose

by M MA

 

26 Nov 2007 (Updated 10 Jun 2009)

Code covered by BSD License  

Wind rose of direction and intensity

Download Now | Watch this File

File Information
Description

    Syntax:
       HANDLES = WIND_ROSE(D,I,VARARGIN)
 
    Inputs:
       D Directions
       I Intensities
       VARARGIN:
        -dtype, type of input directions D, standard or meteo,
             if meteo, the conversion dnew=mod(-90-D,360) is done;
             if not meteo, standard is used (default)
        -n, number of D subdivisons
        -di, intensities subdivisons, default is automatic
        -ci, percentage circles to draw, default is automatic
        -labtitle, main title
        -lablegend, legend title
        -cmap, colormap [jet]
        -colors, to use instead of colormap, for each di
        -quad, Quadrant to show percentages [1]
        -ri, empty internal radius, relative to size of higher
             percentage [1/30]
        -legtype, legend type: 1, continuous, 2, separated boxes [2]
        -bcolor, full rectangle border color ['none']
        -lcolor, line colors for axes and circles ['k']
        -percbg, percentage labels bg ['w']
        -ax, to place wind rose on pervious axes, the input for ax
             must be [theax x y width], where theax is the previous
             axes, x and y are the location and width is the wind
             rose width relative to theax width (default=1/5)
        -parent, by default a new axes is created unless parent is
                 given, ex, parent may be a subplot
        -iflip, flip the intensities as they go outward radially, ie,
                 highest values are placed nearest the origin [{0} 1]
        -inorm, normalize intensities, means all angles will have 100%
        -incout, if 0, data outside di limits will not be used [0 {1}]

MATLAB release MATLAB 6.5 (R13)
Zip File Content  
Other Files license.txt,
wind_rose.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (44)
28 Nov 2007 olas herees  
07 Jan 2008 Stefano de' Rossi

Really good work

23 Jan 2008 C Dillard

I was thrilled when I found this plot, it is exactly what I needed until.....

Beware: This plot does not place wind directions (in degrees) into a normal compass heading where north (0) is facing up, east (90) is facing right, south (180) is facing down, and west (270) is facing left.

I admit that I may be using the script wrong (I am not a matlab expert) but a simple test of one compass heading at a time proved that I am correct.

07 Feb 2008 Jacopo Chiggiato  
20 Feb 2008 Sebastian D.

Same comment than C Dillard,

Exact routine that I needed and very nice graphic output.

But the plot is given using polar -or math- system (that is the Matlab default output) while most of the wind data are generally given with the Meteorologic system. Not a huge deal 'per se' (I quickly wrote a 'met2polar' routine to convert my data; basically: D = 360-(metangle-90) & D(D>360) = D(D>360)-360) but it would have been nice if it has been incorporated into the routine directly (or commented in the header).

If not really, it's a good work and this routine is perfect for my day2day work.

22 Feb 2008 M MA

the meteo2polar is simpler than that:
dnew=mod(-90-d,360)

Many people have been asking for this, so I added a new varargin option in wind_rose: 'dtype' as 'meteo' or 'standard' (polar).
thanks for the comments

26 Feb 2008 JUAN R.A

THNKS

05 Mar 2008 LJM MJ  
13 Mar 2008 Isabella Osetinsky

Meteo to math angle is
math_angle=90-meteo_angle,
not -90-meteo_angle as in your .m code

26 Mar 2008 Isabella Osetinsky

Sorry,
you were right,
math angle = -90 - meteo angle.

31 Mar 2008 worachat wannawong

help me plz.

22 Apr 2008 idris mandang

wind rose

25 Apr 2008 G H

The plots look great.

I originally had trouble getting the wind angles to turn out correctly - my inputs have 0 = wind from North, 90 = wind from East, etc.

I did some testing and found that if I did new_dir = mod(90-test_dir,360) (NOT -90!) and then did the standard wind rose, it came out right.

29 Apr 2008 min liu

great

09 May 2008 Jadran Jur

Comments is same like From: C Dillard(sodillard@gmail.com)

Comments: "I was thrilled when I found this plot, it is exactly what I needed until..... " Beware: This plot does not place wind directions (in degrees) into a normal compass heading where north (0) is facing up, east (90) is facing right, south (180) is facing down, and west (270) is facing left. I admit that I may be using the script wrong (I am not a matlab expert) but a simple test of one compass heading at a time proved that I am correct. "
:just try with
D=[180 350];
V=[2 4];
wind_rose(D,V)...
result is wind_rose that has direction east2west

12 May 2008 M MA

I suggest you to read the help of this function. Notice the dtype varargin option:

"-dtype, type of input directions D, standard or meteo, if meteo, the conversion dnew=mod(-90-D,360) is done; if not meteo, standard is used (default)"

18 May 2008 g l

Many thanks. Nice routine, but I must add my voice to others here. The conversion from meteo to cartesian should be new_dir = mod(90-test_dir,360) as meteo convention is wind direction FROM and cartesian is vector directed TO. I would have thought that the simple test
D=270
V=1
wind_rose(D,V,'dtype','meteo')
should result in a single bar COMING FROM the west. In the present routine it does not. It is a simple fix to correct this behaviour, as previously pointed out.

Thanks again.

19 May 2008 worachat wannawong

How to plot wind rose? Somebody help me plz... Plz give the example code in Matlab and data test case for me.
Thank you Prof.
Worachat

20 May 2008 M MA

G L. You are not right, the convertion is mod(-90-D,360). But anyway this utility has nothing to do about wind!! Or conventions !! The convertions to meteo convention was introduced because some people asked it!. Believe me, there are others conventions on directions of other fields. This is an Intensity/Frequency/Direction Plot! It has NOTHING to do about wind. So anybody can convert any direction to any other direction and and use wind_rose with standard direction.

20 May 2008 g l

MMA

You are correct that the meteo conversion for wind or waves is USUALLY mod(-90-D,360). However the test wind_rose(270,1,'dtype','meteo') also proves that this routine does not work the way it should FOR WIND. I think your comments make it clear that the routine should be renamed just rose.m and drop the "meteo" direction conversion option because the "meteo" convention is different for wind, waves, and currents.

I regret that this ongoing discussion of conventions has obviously caused you trouble, and thank you again for contributing a useful routine to the Matlab community.

28 May 2008 yanqing feng

very good!

06 Aug 2008 junsang cho

very good job!!!

11 Aug 2008 Lee Linda

I do not know the reason. But I tried 90-D for wind direction. It looks it is right. Could MMA explain it more detail? Thanks.

14 Aug 2008 Just Jess

Is there a way to show when there is no wind? Calm times should be included in the percentages, but it looks like there is no way to do this with the current code. Any suggestions?

01 Sep 2008 romain blot

Hello, I would like to know if you have noticed a maximum size for wind and direction data input? I try to plot 1 month data with 10min time scale...and it doesn't work...
Thank you...

27 Oct 2008 FJ Way

Good, however it seems that the northern bin may have a bug. If I want 22.5 degree bins (nAngles=16), then the first bin is -11.25 to +11.25 (which is good). But the Ay breakdown and input data is from 0 to 360 (i.e., nothing from -11.25 to 0). So the northern bin is usually about half the size it should be.

08 Nov 2008 Zheng i

很好用的!角度及方向可以调整。但是我还不知道'di'到底是怎么用的,谁能告诉我?

08 Nov 2008 Zheng i

Very Good! But I don't know how to use 'di', who can help me please? Thanks!

10 Nov 2008 D S

I am a new user to MatLab, so this may be a ridiculously obvious question, but I have got my inputs in the D and I format and ran the following syntax:

HANDLES = wind_rose(D,I,varargin,'meteo');

I then got this error message:

??? Attempt to execute SCRIPT varargin as a function:
C:\Program Files\MATLAB\R2007b\toolbox\matlab\lang\varargin.m

Can someone help me please?

Thankyou

11 Nov 2008 Carlos Adrian Vargas Aguilera

Dear D S: you should write this kind of quenstions on the Newsreader (where many people will be glad to help you) or write directly to the author. Look at 5 statements here below. Carlos

16 Jan 2009 b vs  
16 Jan 2009 b vs

Hello MMA,
Great m-file. However I am not a matlab expert and cannot get the legend right in my figure. Do you maybe have the example input of the figure that is shown on the top of this file, so that I can make slight changes towards my own case?

25 Apr 2009 Marcos Cesar Ruggeri  
25 Apr 2009 Marcos Cesar Ruggeri

There is a problem when you want to print the graphic. The
background color (facecolor) is set in black and cannot be changed.

In order to fix it, write at the end of the code:

set(gcf,'color','w');
set(gca,'color','w');

Thanks and good job.

M.

25 Apr 2009 Marcos Cesar Ruggeri

Wind directions are inverted.
If the vector D represents all values of wind directions COMING FROM (BLOWING FROM), rewrite line #147 as follows:

D=mod(90-D,360);

Thanks.

M.

30 Apr 2009 M K

The 'ci' option to force the percentage intervals appears to not work. If you change from one interval to another the length of the colored blocks stays the same, while the scale changes.

02 May 2009 malak voinis

please what kind of data is the argument F needed by the function WIND_ROSE(D,F,VARAGIN) ?

13 May 2009 Juan C

Really nice work, but I have a question, How can I plot the wind rose on a subplot?

17 Jun 2009 Victoria

It's beautiful, but I would also like to know how to plot the wind rose on a subplot.

17 Jun 2009 Victoria

To plot in a subplot, find "parent=0" and replace "0" with whichever grid cell you want it in your subplot. eg. to place it in the lower left corner of a 2X2 plot of subplots, type "parent=subplot(2,2,4)"

25 Jun 2009 Victoria

MMA

Everything is working great but when I print the plot (either to paper or to a jpeg file), the background turns black. Do you know how to fix this?

Thanks! Victoria

14 Sep 2009 Marcos Cesar Ruggeri

Victoria:

Please read my comment above. I had the same problem, but finally I could solve it!

Thanks,

Marcos Cesar Ruggeri

08 Oct 2009 Cegeon  
18 Nov 2009 Eleanor

Hi there,
I would like to specify my own colour choices for 'di'. Does anyone know what format 'color' should be specified in.
Many thanks,
Eleanor

Please login to add a comment or rating.
Updates
10 Dec 2007

added user option ci, values of the percentage circles

22 Feb 2008

added option to use meteo convention directions.
added a couple of other options in varargin (place over another plot, choose colors to use in colorbar directly)

12 May 2008

Bug fix (bar at dir=0 could be incorrect in some cases)

14 May 2008

Added varargin iflip:
flip the intensities as they go outward radially, ie, highest values are placed nearest the origin [{0} 1]

04 Jun 2009

-Added varargin option parent, to select the axes/subplot where to place the wind rose
- bug fix: when di, was not provided the auto mode could, in some cases, merge the data of the two smallest subdivisions

10 Jun 2009

Added incout option: if 0, data outside di limits will not be considered. By default is 1.

Tag Activity for this File
Tag Applied By Date/Time
specialized M MA 22 Oct 2008 09:36:47
plotting M MA 22 Oct 2008 09:36:47
wind rose M MA 22 Oct 2008 09:36:47
direction M MA 22 Oct 2008 09:36:47
intensity M MA 22 Oct 2008 09:36:47
specialized plot M MA 22 Oct 2008 09:36:47
graphics M MA 22 Oct 2008 09:36:47
direction Nicco Plamonia 23 Dec 2008 01:24:31
wind rose Nicco Plamonia 23 Dec 2008 01:25:01
graphics Nicco Plamonia 27 Dec 2008 01:14:34
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com