.\
cgwindrose.pro
Graphics
This program draws a wind rose diagram. A wind rose diagram shows the frequency, speed, and direction of winds over some defined period of time. It is widely used in meteorological applications (see here:).
Data to test the program (in SAMPSON formatted data files) can be freely downloaded from the Meteorological Resource Center.
Changes made to the program in Oct 2014 allow multiple windrose plots to be placed in
a graphics window, but with a few reservations. Windrose plots normally have an aspect
ratio of 1 (i.e., they are square). Unfortunately, this cannot be guaranteed if you use
!P.Multi to create multiple plots. Therefore, it is recommened that you use cgLayout to
obtain a multi-plot layout for multiple windrose plots, and give each plot a specific
position in the graphics window with the Position
keyword.
Examples
An example of how to use the program can be found in the Coyote Plot Gallery.
To display multiple plots in the window, set the positions with cgLayout
, like this:
pos = cgLayout([2,1], OXMargin=[5,5], OYMargin=[8, 5], XGap=10)
cgDisplay, 900, 550
cgWindRose, SamFile='93058_90.sam', Position=pos[*,0], Title='Plot 1', /NoLegend
cgWindRose, SamFile='94018_90.sam', Position=pos[*,1], Title='Plot 2', LegendPosition=[0.44, 0.325], /NoErase
Author information
- Author
FANNING SOFTWARE CONSULTING:
David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com
- Copyright
Copyright (c) 2013-2014, Fanning Software Consulting, Inc.
- History
Change History:
Written, 7 March 2013 by David W. Fanning. Fixed error in which I was assuming some calm winds. 23 May 2013. DWF. Added LegendPosition, Position, CircleLabelSize, and NoLegend keywords and made changes that allow multiple windrose plots to be place in a graphics window. To better accommodate multiple plots, the cardinal directions are now indicated with a single letter and the default circle label font size is reduced. 22 Oct 2014. DWF.
Routines
result = cgWindRoseArc(xcenter, ycenter, radius [, angle1] [, angle2])
This function returns 100 x and y points as a 2x100 array that forms an arc between two angles when plotted.
result = cgWindRose_PositiveLabel(axis, index, value)
This is a tick labeling function that prevents negative tick values.
cgWindRose_ReadSamFile [, filename] [, SPEED=float] [, DIRECTION=float]
Read a SAMSON format meteorological data file to obtain the wind speed and direction arrays.
cgWindRose, speed, direction [, CALMSFREQ=float] [, CIRCLELABELSIZE=float] [, LEGENDPOSITION=float] [, /NOLEGEND] [, POSITION=float] [, SAMFILE=string] [, SPEEDBINSIZE=float] [, TITLE=string], _EXTRA=_EXTRA
Draw a wind rose diagram from the input wind speed and wind direction parameters.
Routine details
top cgWindRoseArc
result = cgWindRoseArc(xcenter, ycenter, radius [, angle1] [, angle2])
This function returns 100 x and y points as a 2x100 array that forms an arc between two angles when plotted. The arc is created as if the 0 angle was to the North (top on drawings).
Parameters
- xcenter in required
The X center of the arc.
- ycenter in required
The Y center of the arc.
- radius in required
The radius of the desired arc.
- angle1 in optional type=float default=0.0
The first angle. The arc is drawn between the first angle and the second angle.
- angle2 in optional type=float default=360.0
The second angle. The arc is drawn between the first angle and the second angle.
top cgWindRose_PositiveLabel
result = cgWindRose_PositiveLabel(axis, index, value)
This is a tick labeling function that prevents negative tick values. It also labels all tick values as precentages. Set this function as the name of either the XTickFormat or YTickFormat keyword on a Plot or Axis command. This is not called directly by a user.
Parameters
- axis in required type=integer
The type of axis. 0 is X, 1 is Y, etc.
- index in required type=integer
The index of the tick label.
- value in required
The tick value to be transformed by the function.
top cgWindRose_ReadSamFile
cgWindRose_ReadSamFile [, filename] [, SPEED=float] [, DIRECTION=float]
Read a SAMSON format meteorological data file to obtain the wind speed and direction arrays.
Parameters
- filename in optional type=string
The path to a SAMSON (*.sam) format meteorological data file from which wind speed and wind direction can be obtained.
Keywords
- SPEED out optional type=float
The wind speed as obtained from the file.
- DIRECTION out optional type=float
The direction of the wind as obtained from the file.
top cgWindRose
cgWindRose, speed, direction [, CALMSFREQ=float] [, CIRCLELABELSIZE=float] [, LEGENDPOSITION=float] [, /NOLEGEND] [, POSITION=float] [, SAMFILE=string] [, SPEEDBINSIZE=float] [, TITLE=string], _EXTRA=_EXTRA
Draw a wind rose diagram from the input wind speed and wind direction parameters. The wind rose diagram treats a 0 angle as pointing to the North, or toward the top of the diagram. Note this is different from normal IDL coordinate systems, which treat the 0 angle as pointing to the right of the diagram or plot.
Parameters
- speed in required type=float
The wind speed array. Note that missing values should be removed prior to passing the speed array to the program. This vector should have the same number of elements as the
direction
array. It is assumed there are no negative speed values in the array. Winds assumed to be measured in meters/second.- direction in required type=float
The direction of the wind. This should have the same number of elements as the
speed
array. The wind directions are assumed to be in the range 0 to 360.
Keywords
- CALMSFREQ out optional type=float
The frequency of calms measurements in the data. (Winds less than 1 meter/second.)
- CIRCLELABELSIZE in optional type=float default=0.6
A multiplier of the default character size, used for labelling the circle percents.
- LEGENDPOSITION in optional type=float
A two-element array giving the X and Y position of the top-left corner of the legend box in normalized coordinates. By default, to the southwest of the windrose plot. Depending on window size, etc., the legend may not be visible or may be only partially visible. Adjust either the size of the window or the location of the legend for improved visibility.
- NOLEGEND in optional type=boolean default=0
Set this keyword to prevent the windrose legend from being drawn with the windrose plot.;
- POSITION in optional type=float
The usual four-element POSITION keyword giving the plot position of the windrose plot in normalized coordinates.
- SAMFILE in optional type=string
The path to a SAMSON (*.sam) format meteorological data file from which wind speed and wind direction can be obtained.
- SPEEDBINSIZE in optional type=float default=3
The size of the bin when the speed is binned with the Histogram command.
- TITLE in optional type=string
The plot title. Not displayed if a null string.
- _EXTRA
File attributes
Modification date: | Fri Mar 27 11:07:36 2015 |
Lines: | 439 |
Docformat: | rst rst |