# coyote: WINDBARB

- coyote/Graphics
- [Source code]

NAME

      WINDBARB

PURPOSE

      This is routine for drawing wind barbs on a map.

AUTHOR

      FANNING SOFTWARE CONSULTING
      David Fanning, Ph.D.
      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

CATEGORY

      Graphics.

CALLING SEQUENCE

      Windbarb, x, y, speed, direction

REQUIRED INPUTS

      x:            The X location of the wind barb, expressed in data coordinates.
                    Positive X is pointing in EAST direction.
      y:            The Y location of the wind barb, expressed in data coordinates.
                    Positive Y is pointing in NORTH direction.
      speed:        The wind speed, expressed in knots.
      direction:    The wind direction in degrees clockwise from north. Winds from
                    the NE come at 45 degrees, and the wind "arrow" points in the
                    direction from which the window is blowing. (The wind arrow
                    points in the direction of the station circle, with the "barbs"
                    of the arrow at the end of the arrow from which the wind is coming.)

KEYWORDS

      ASPECT:        The aspect ratio of the map or plot in the display window.
      CLIP:          A four-element array in normalized coordinates [x0,y0,x1,y1] giving
                     the lower-left and upper-right corner of a cliping rectangle. This
                     is normally the extent of your plot. See the example below.
      COLOR:         The name of the color to draw the wind barbs in. May be a vector
                     the same length as X.
      LENGTH:        The approximate length of the wind barb in normalized coordinates.
                     Will be set to 0.066 of the plot distance in the X direction by default.
      MAP_ROTATION:  The clockwise rotation in degrees of the map North from the
                     top of the plot. Will be set to 0.0 by default.
      SOUTHERN_HEMISPHERE: Windbarb "feathers" are traditionally drawn in the clockwise
                     direction in the northern hemispere and countercolockwise in the
                     southern hemisphere. Default is "northern" type feathers. Set this
                     keyword to select "southern" type feathers.
      STATION:       Set this keyword if you want to draw the wind barbs with station symbols.
                     (Requires STATIONPLOT from the Coyote Library.)

RESTRICTIONS

      Requires cgColor and STATIONPLOT from the Coyote Library:
          http://www.idlcoyote.com/programs/cgColor.pro
          http://www.idlcoyote.com/programs/stationplot.pro

EXAMPLE

      cgDisplay, Title='Wind Barbs', /Free
      seed = -3L
      lon = Randomu(seed, 60) * 360 - 180
      lat = Randomu(seed, 60) * 180 - 90
      speed = Randomu(seed, 60) * 50 + 5.0
      direction = Indgen(60)*25
      cgColorfill,[0.1, 0.1, 0.9, 0.9, 0.1], [0.1, 0.9, 0.9, 0.1, 0.1], /Normal, Color='light gray'
      cgMap_Set, /Cylindrical, Position=[0.1, 0.1, 0.9, 0.9], Color='Steel Blue', /NoErase
      cgMap_Grid, Color='Charcoal'
      cgMap_Continents, Color='Sea Green'
      Windbarb, lon, lat, speed, direction, Length=0.025, /Station, Color='Indian Red', /Southern_Hemisphere
      To clip the windbards that fall outside the plot, substitute these two lines
      for the last line in the example above:
      clip = [0.1, 0.1, 0.9, 0.9]
      Windbarb, lon, lat, speed, direction, /Station, Color='Indian Red', Clip=clip

MODIFICATION HISTORY

      Written by:  David W. Fanning, 20 May 2003.
      It has been called to my attention that the wind barbs are pointing
        in *exactly* the wrong direction. Sigh... Rotated by 180 degrees. DWF. 8 June 2004.
      Now someone complains that the *corrected* version is off by 180 degrees! Sheesh!
        Clearly, I'm no meteorologist. Both lines of code are in the file. Please use the one
        you like the best. :-) (Line 177-178) 20 July 2004. DWF.
      Added a CLIP keyword so you can clip the output to the extend of your graphics plot. 12 Nov 2004. DWF.
      Added THICK keyword 23 February 2005. DWF.
      After further research, I've reverted to the direction specified originally.
      And I have changed the "feathers" to point clockwise normally, and counterdlockwise
        if the SOUTHERN_HEMISPHERE keyword is set. Here are my sources (21 July 2005. DWF):
           http://ww2010.atmos.uiuc.edu/(Gh)/guides/maps/sfcobs/wnd.rxml
           http://www.al.noaa.gov/WWWHD/pubdocs/windbarb.html
      ixed a small CLIP problem. 21 July 2005. DWF.
      haft of wind barbs not extending all the way to starting point. Fixed. 27 Mar 2014. DWF.