Example of plotting vectors over magnitude

HI,
I was looking for an example using pygmt plotting ocean current vectors over the speed which is filled in the background from a NetCDF file. For example the HYCOM current vectors available from the below location which can be loaded to python memory using the below commands. And normal quiver plot can be made . But I wanted to use pygmt for this purpose, please direct me to an implemented example if possible.

from netCDF4 import Dataset as nc
nf=nc(“https://tds.hycom.org/thredds/dodsC/GLBv0.08/expt_56.3”)
lat=nf.variables[‘lat’][:]
lon=nf.variables[‘lon’][:]
#nf.variables[‘water_u’].shape
idx1 = (np.abs(lat - 0)).argmin()
idx2 = (np.abs(lat - 25)).argmin()
idx3=(np.abs(lon-65)).argmin()
idx4=(np.abs(lon-90)).argmin()
[lat[idx1],lat[idx2],lon[idx3],lon[idx4]]
uvel=nf.variables[‘water_u’][1,0,idx1:idx2,idx3:idx4]
vvel=nf.variables[‘water_v’][1,0,idx1:idx2,idx3:idx4]
lat1=nf.variables[‘lat’][idx1:idx2]
lon1=nf.variables[‘lon’][idx3:idx4]
spd=np.sqrt(np.square(uvel)+np.square(vvel))
x,y=np.meshgrid(lon1,lat1)
plt.contourf(x,y,spd,50)
plt.quiver(x,y,uvel,vvel,scale=20)

Hi @sjo, try having a look at Plot wind vectors from a XArray DataArray or https://www.pygmt.org/v0.5.0/gallery/seismology/velo_arrow_ellipse.html. You may also want to look at https://www.pygmt.org/v0.5.0/gallery/images/contours.html for the contour part. Give those a try first and we can help out with any details later.

Thank you weiji14,
With the tips, I could make the plots, but only after making the data as x,y,z triplets not in the original grid format which I thought is possible.
Sincerely,
Sudheer