# How to caculate speed WRFOUT in Arakawa C grid

**URL:** <https://vapor.discourse.group/t/how-to-caculate-speed-wrfout-in-arakawa-c-grid/315>\
**Category:** Uncategorized\
**Created:** [July 13, 2023, 12:33am UTC](https://vapor.discourse.group/t/how-to-caculate-speed-wrfout-in-arakawa-c-grid/315 "2023-07-13T00:33:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![liurui](https://avatars.discourse-cdn.com/v4/letter/l/8c91f0/32.png) [@liurui](https://vapor.discourse.group/u/liurui)\
**Post date:** [July 13, 2023, 12:33am UTC](https://vapor.discourse.group/t/how-to-caculate-speed-wrfout-in-arakawa-c-grid/315/1 "2023-07-13T00:33:45Z")

</div>

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:

```auto
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)

```

```auto
type or paste code here

```

Can someone how to desolve this problem ?

---

<div class="post-metadata">

**Author:** ![pearse](https://yyz2.discourse-cdn.com/free1/user_avatar/vapor.discourse.group/pearse/32/177_2.png) [@pearse](https://vapor.discourse.group/u/pearse)\
**Post date:** [July 14, 2023, 8:21pm UTC](https://vapor.discourse.group/t/how-to-caculate-speed-wrfout-in-arakawa-c-grid/315/2 "2023-07-14T20:21:42Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![liurui](https://avatars.discourse-cdn.com/v4/letter/l/8c91f0/32.png) [@liurui](https://vapor.discourse.group/u/liurui)\
**Post date:** [July 15, 2023, 7:19am UTC](https://vapor.discourse.group/t/how-to-caculate-speed-wrfout-in-arakawa-c-grid/315/3 "2023-07-15T07:19:05Z")

</div>

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

```auto
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:

 ![1689405368625](https://global.discourse-cdn.com/free1/uploads/vapor/original/1X/4c3f4d36e467124d67f888b5fbe54e13e920ca4d.png)  
It seems like can not use Tools -\>Pyhoon Variables to caculate speed?

---

<div class="post-metadata">

**Author:** ![pearse](https://yyz2.discourse-cdn.com/free1/user_avatar/vapor.discourse.group/pearse/32/177_2.png) [@pearse](https://vapor.discourse.group/u/pearse)\
**Post date:** [July 18, 2023, 3:12pm UTC](https://vapor.discourse.group/t/how-to-caculate-speed-wrfout-in-arakawa-c-grid/315/4 "2023-07-18T15:12:28Z")

</div>

> [@liurui](#):
>
> 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?
