Customizing Quiver

Hi,

Has anyone ever tried to modify quiver to change away from plotting arrows? In my quest to make matplotlib useful the meteorological community at large, I'm trying to be able to plot what we refer to as wind barbs. Basically, instead of an arrow whose size indicates the magnitude of the vector field, a wind barb consists of a line whose alignment indicates the direction of the vector field (like the arrow) and has a number of lines or triangles along this shaft to indicate wind speed. It's a little odd and domain specific, but it's a must for the meteorologist. We like it because, unlike the arrows, you can pick off the actual wind speed at a point. See here for an example:

http://www.rap.ucar.edu/weather/info/about_windbarb.html
http://www.rap.ucar.edu/weather/surface/displaySfc.php?region=abi&endDate=20080627&endTime=-1&duration=0

Has anyone ever tried this (I'm pretty sure I know the answer)? Failing that, can anyone give me an idea of how difficult it might be for me to tweak quiver to do this?

Thanks,

Ryan

···

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Ryan,

Quiver is not quite the right starting point, although parts of it might work--and actually it could be bent into shape. The problem with attempting a direct transformation of arrows into wind barbs is that the arrows are formed with a fixed number of vertices, so everything is done with nice, regular ndarrays. The natural way to make wind barbs would be with the number of vertices depending on the wind speed. One could probably get around this by using the maximum number of vertices, corresponding to the max wind speed, and then letting some of the barbs be zero-length.

Another difference might be that wind barbs would best be drawn with lines, not with patches.

It might be worthwhile to start with the Quiver class and modify it as needed. I certainly would not try to include Windbarb functionality as an option or extension of Quiver. At most, one might be able to pull some common functionality out into a base class for both.

Something I keep wanting to get to is an ellipse variant of quiver; that would be much closer to the present quiver than a windbarb version would.

In any case, if you can come up with a good windbarb class, that would be great. I expect Jeff Whitaker would like to add that to basemap, too.

Eric

Ryan May wrote:

···

Hi,

Has anyone ever tried to modify quiver to change away from plotting arrows? In my quest to make matplotlib useful the meteorological community at large, I'm trying to be able to plot what we refer to as wind barbs. Basically, instead of an arrow whose size indicates the magnitude of the vector field, a wind barb consists of a line whose alignment indicates the direction of the vector field (like the arrow) and has a number of lines or triangles along this shaft to indicate wind speed. It's a little odd and domain specific, but it's a must for the meteorologist. We like it because, unlike the arrows, you can pick off the actual wind speed at a point. See here for an example:

http://www.rap.ucar.edu/weather/info/about_windbarb.html
http://www.rap.ucar.edu/weather/surface/displaySfc.php?region=abi&endDate=20080627&endTime=-1&duration=0

Has anyone ever tried this (I'm pretty sure I know the answer)? Failing that, can anyone give me an idea of how difficult it might be for me to tweak quiver to do this?

Thanks,

Ryan

I kind of figured that was the case, upon looking at the code and realizing that the only commonality was in the broad purpose of both representations. Otherwise, there's really no commonality in the details or implementation. I just wanted to see what the "experts" thought before I embarked.

Between this and getting a working SkewT and the meteorological community will be all set!

Ryan

Eric Firing wrote:

···

Ryan,

Quiver is not quite the right starting point, although parts of it might work--and actually it could be bent into shape. The problem with attempting a direct transformation of arrows into wind barbs is that the arrows are formed with a fixed number of vertices, so everything is done with nice, regular ndarrays. The natural way to make wind barbs would be with the number of vertices depending on the wind speed. One could probably get around this by using the maximum number of vertices, corresponding to the max wind speed, and then letting some of the barbs be zero-length.

Another difference might be that wind barbs would best be drawn with lines, not with patches.

It might be worthwhile to start with the Quiver class and modify it as needed. I certainly would not try to include Windbarb functionality as an option or extension of Quiver. At most, one might be able to pull some common functionality out into a base class for both.

Something I keep wanting to get to is an ellipse variant of quiver; that would be much closer to the present quiver than a windbarb version would.

In any case, if you can come up with a good windbarb class, that would be great. I expect Jeff Whitaker would like to add that to basemap, too.

Eric

Ryan May wrote:

Hi,

Has anyone ever tried to modify quiver to change away from plotting arrows? In my quest to make matplotlib useful the meteorological community at large, I'm trying to be able to plot what we refer to as wind barbs. Basically, instead of an arrow whose size indicates the magnitude of the vector field, a wind barb consists of a line whose alignment indicates the direction of the vector field (like the arrow) and has a number of lines or triangles along this shaft to indicate wind speed. It's a little odd and domain specific, but it's a must for the meteorologist. We like it because, unlike the arrows, you can pick off the actual wind speed at a point. See here for an example:

http://www.rap.ucar.edu/weather/info/about_windbarb.html
http://www.rap.ucar.edu/weather/surface/displaySfc.php?region=abi&endDate=20080627&endTime=-1&duration=0

Has anyone ever tried this (I'm pretty sure I know the answer)? Failing that, can anyone give me an idea of how difficult it might be for me to tweak quiver to do this?

Thanks,

Ryan

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma