'Use transform_first keyword in Barbs

I am trying to plot wind barbs from the HRRR model and Barbs takes about 50-55 seconds of the 58-63 second plot. I noticed that barbs doesnt have the "transform_first" keyword, so is there an alternative way to speed up barbs?

ax1.barbs(x,y,uwind,vwind,length=5,regrid_shape=15,color='black',alpha=0.6,transform=ccrs.PlateCarree())

regrid_shape = 12 is only mildly faster.
Im looking specifically for speed.



Solution 1:[1]

Turns out that regrid_shape is very expensive; so i just removed regrid_shape keyword. I manually thinned the arrays for better performance.

ax1.barbs(x[::60,::60],y[::60,::60],uwind[::60,::60],vwind[::60,::60],length=5,color='black',alpha=0.6,transform=ccrs.PlateCarree())

regrid_shape also maps to the "extent" of the cartopy map, not to the model grid space. It makes total sense to do that, so be careful for regional models that may not quite match your map extent.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jimmyc