How to caculate speed WRFOUT in Arakawa C grid

we know that U and V varaibles in WRFOUT files are in diffenent dimesions based on Arakawa C grid dimension,when I use “Python varaibles” with U and V to caculate speed,thers always an error eccured like below:

Failed to read variable "speed" at time step (0), and
refinement level (-1) and level-of-detail (-1)
Failed to read region from variable/timestep/level/lod (speed, 0, -1, -1)
Invalid file descriptor : 0
PyRun_String() : VAPOR_PY: Traceback (most recent call last):
File "<string>", line 1, in <module>
ValueError: operands could not be broadcast together with shapes (34,200,191) (34,201,190)
------------------
Vapor 3.5.0.<debug>
OS: Windows 6.2 (9200)
type or paste code here

Can someone how to desolve this problem ?

Vapor comes with a module called vapor_utils that allows you to unstagger your variables. Something like this should work:

from vapor_utils import *
stagU = StaggeredToUnstaggeredGrid( U, 2 )
stagV= StaggeredToUnstaggeredGrid( V, 1 )
stagW= StaggeredToUnstaggeredGrid( W, 0 )
speed = Mag( stagU, stagV, stagW )

Where speed is defined on the west_eastXsouth_northXbottom_top grid.

Thanks a lot for your reply.
I followed the steps in your reply and still reported the following errors:

Failed to read variable "speed" at time step (0), and
refinement level (-1) and level-of-detail (-1)
Failed to read region from variable/timestep/level/lod (speed, 0, -1, -1)
PyRun_String() : Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'vapor_utils'
------------------
Vapor 3.8.1.<debug>
OS: Windows 6.2 (9200)

below is the screenshot of my setting:


It seems like can not use Tools ->Pyhoon Variables to caculate speed?

Strange. Is there a file named vapor_utils.py in C:\Program Files\VAPOR\share\python? Or have you perhaps installed Vapor in a different location that does not contain the file in \VAPOR\share\python?