'plotting moisture flux transport vector using quiver in python

I want to plot moisture flux transport at surface level in a spatial plot. Since it is a vector I used quiver to plot it. I calculated moisture flux using specific humidity, u wind and v wind at surface. Moisture flux values are calculated as the vector sum of prod­ucts of specific humidity and horizontal wind components (qu + qv). But I don't know how to plot it using quiver.

When I gave qu,qv as the quiver arguments I am encountering the error as quiver object is not subscriptable. I am showing the script and the error below.

fig=plt.figure(figsize=(28,24),facecolor="w")
for mon in range(12):

    ax=fig.add_subplot(3,4,mon+1,projection=ccrs.PlateCarree())
    ax.set_extent([60,120,-10,40])
    ax.set_ylim([-10,40])
    
    ax.gridlines(linewidth=1.25,color='gray',linestyle=':')
    gl=ax.gridlines(draw_labels=True)
    gl.top_labels=False
    gl.right_labels=False
    sh=plt.contourf(lon,lat,mag[mon,:,:],cmap=plt.cm.Spectral_r, extend='both')
    a=ax.quiver(lon[::10],lat[::10],a[mon,::10,::10],b[mon,::10,::10],width=0.003)

error:Quiver' object is not subscriptable

In the above code a and b are qu,qv respectively. Is that any problem ? Does quiver doesn't take products of 2 variables into consideration?



Sources

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

Source: Stack Overflow

Solution Source