Wind barbs with small arrow heads

Hi matplotlib users

I am developing an application for showing weather forecasts using matplotlib. We use wind barbs for displaying wind forecasts:

http://api.fcoo.dk/ifm-maps/greenland/?zoom=6&lat=62&lon=-45&layer=FCOO%20Standard&overlays=TTFFFFFFFFFFFFFFF

This is fine for our “power users”. We do however also have some users who are not used to wind barbs. I have elsewhere seen people put a small arrow head at the foot of the wind barbs to make it more clear which direction the wind blows toward.

As far as I can see from the matplotlib quiver.py code this is not possible with matplotlib. But the _make_barbs method does not seem that complicated so I wondered if it is something that I can do myself. I have however never used the matplotlib low level drawing primitives. I would therefore appreciate any good advice.

Best regards,

Jesper Baasch-Larsen

Jesper,

For performance reasons, what _make_barbs() does is create a (almost degenerate) polygon for each wind barb in the data set. The barbs are drawn such that y is along the barb, and x is perpendicular to the barb; the barb is then rotated as appropriate. The first point in the polygon is IIRC the tip of the barb, so all that would be needed is to add a few points at the beginning of the polygon to draw an arrow head shapee. Of course, all of this is deep implementation detail, subject to change in the future, but subclassing the Barbs class and overriding the _make_barbs() method should be relatively ok. (I’d start with a copy of _make_barbs() and tweak as necessary)

Ryan

···

On Wed, Sep 17, 2014 at 6:29 AM, Jesper Larsen <jesper.webmail@…878…287…> wrote:

Hi matplotlib users

I am developing an application for showing weather forecasts using matplotlib. We use wind barbs for displaying wind forecasts:

http://api.fcoo.dk/ifm-maps/greenland/?zoom=6&lat=62&lon=-45&layer=FCOO%20Standard&overlays=TTFFFFFFFFFFFFFFF

This is fine for our “power users”. We do however also have some users who are not used to wind barbs. I have elsewhere seen people put a small arrow head at the foot of the wind barbs to make it more clear which direction the wind blows toward.

As far as I can see from the matplotlib quiver.py code this is not possible with matplotlib. But the _make_barbs method does not seem that complicated so I wondered if it is something that I can do myself. I have however never used the matplotlib low level drawing primitives. I would therefore appreciate any good advice.

Best regards,

Jesper Baasch-Larsen


Want excitement?

Manually upgrade your production database.

When you want reliability, choose Perforce

Perforce version control. Predictably reliable.

http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Hi Ryan,

Thanks for the insights. Your subclassing suggestions sounds fine to me.

Best regards,

Jesper

···

On Wed, Sep 17, 2014 at 6:29 AM, Jesper Larsen <jesper.webmail@…287…> wrote:

Hi matplotlib users

I am developing an application for showing weather forecasts using matplotlib. We use wind barbs for displaying wind forecasts:

http://api.fcoo.dk/ifm-maps/greenland/?zoom=6&lat=62&lon=-45&layer=FCOO%20Standard&overlays=TTFFFFFFFFFFFFFFF

This is fine for our “power users”. We do however also have some users who are not used to wind barbs. I have elsewhere seen people put a small arrow head at the foot of the wind barbs to make it more clear which direction the wind blows toward.

As far as I can see from the matplotlib quiver.py code this is not possible with matplotlib. But the _make_barbs method does not seem that complicated so I wondered if it is something that I can do myself. I have however never used the matplotlib low level drawing primitives. I would therefore appreciate any good advice.

Best regards,

Jesper Baasch-Larsen


Want excitement?

Manually upgrade your production database.

When you want reliability, choose Perforce

Perforce version control. Predictably reliable.

http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma