# Rotating velocities in output?

**URL:** <https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607>\
**Category:** Uncategorized\
**Created:** [4 January 2024 13:10 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607 "2024-01-04T13:10:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![knaughten](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/knaughten/32/100_2.png) [@knaughten](https://nemo-ocean.discourse.group/u/knaughten)\
**Post date:** [4 January 2024 13:10 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607/1 "2024-01-04T13:10:55Z")

</div>

I am running on the eORCA1 and eORCA025 grids, so in some places the grid is rotated. I am wondering whether the output velocities (uo, vo) are properly zonal and meridional, or are rotated to the local coordinate space (so not exactly east-west and north-south). If the latter is true, is there a quick way to rotate them to be proper zonal and meridional velocities? For example, when I worked with ROMS there was a grid variable containing the angle between the x-axis and east for every cell; is there something similar for NEMO?

Many thanks,  
Kaitlin

---

<div class="post-metadata">

**Author:** ![robinson](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@robinson](https://nemo-ocean.discourse.group/u/robinson)\
**Post date:** [5 January 2024 14:24 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607/2 "2024-01-05T14:24:12Z")

</div>

Hei Kaitlin,

Why do you need to rotate velocities back to the geographical grid ?

/robinson

---

<div class="post-metadata">

**Author:** ![acc](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@acc](https://nemo-ocean.discourse.group/u/acc)\
**Post date:** [8 January 2024 10:02 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607/3 "2024-01-08T10:02:26Z")

</div>

Hi Kaitlin, If you really need to do this, Laurent’s SOSIE package contains a corr\_vect.x utility that will convert both ways. It computes the angles from the glam? and gphi? coordinate fields in a meshmask file. See:

> **[GitHub - brodeau/sosie: SOSIE is Only a Surface Interpolation Environment](https://github.com/brodeau/sosie)**
>
> SOSIE is Only a Surface Interpolation Environment - GitHub - brodeau/sosie: SOSIE is Only a Surface Interpolation Environment

and

> <https://github.com/brodeau/sosie/issues/17>
>
> The inverse vector correction does not seem to work anymore in the most recent c…ommits... I see, that the \`-x\` and \`-y\` switches have been remove in commit 4de70741b7e7235b32584c16c69391c1441f4be9 aready (I was using an earlier version before), however when eliminating \`-x\` and \`-y\` from my command
> \`\`\`shell
> old:
> corr\_vect.x -I -i gird\_U.nc grid\_V.nc -t time\_counter -x vozocrtx -y vomecrty -m mask.nc
> new:
> corr\_vect.x -I -i gird\_U.nc grid\_V.nc -t time\_counter -m mask.nc
> \`\`\` 
> I just get the "Usage"-message as if I typed \`corr\_vect.x -h\`. Is the inverse correction not supported anymore? Or do I need to give specific names to the variables for this to work?
> Any help would be much appreciated!

for a modern usage example.

---

<div class="post-metadata">

**Author:** ![knaughten](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/knaughten/32/100_2.png) [@knaughten](https://nemo-ocean.discourse.group/u/knaughten)\
**Post date:** [9 January 2024 09:58 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607/4 "2024-01-09T09:58:18Z")

</div>

Thanks for the link, I will go through the code!

I’m calculating zonal transport, barotropic streamfunctions, etc - although perhaps the streamfunction reduces to the same answer as if you use local coordinates.

---

<div class="post-metadata">

**Author:** ![knaughten](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/knaughten/32/100_2.png) [@knaughten](https://nemo-ocean.discourse.group/u/knaughten)\
**Post date:** [31 January 2024 14:47 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607/5 "2024-01-31T14:47:27Z")

</div>

In case of interest, I’ve written a python function to do this online (so no extra storage space required for new NetCDF velocities). It essentially follows src/OCE/SBC/geo2ocean.F90. I’ve tested it but not super extensively, so use with a bit of caution and let me know if you find any issues. The function starts here and is self-contained so you can just copy and paste into your own code (with attribution please): [nemo\_python/utils.py at 22e1d3e4ca7d4ad2cc066e4aa1cadf889c9b13d3 · knaughten/nemo\_python · GitHub](https://github.com/knaughten/nemo_python/blob/22e1d3e4ca7d4ad2cc066e4aa1cadf889c9b13d3/utils.py#L582)

---

<div class="post-metadata">

**Author:** ![robinson](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@robinson](https://nemo-ocean.discourse.group/u/robinson)\
**Post date:** [13 February 2024 09:16 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607/6 "2024-02-13T09:16:47Z")

</div>

Hei Kaitlin,

I’m just wondering whether the fluxes are conserved, after the rotation to geographical coordinates.

/robinson

---

<div class="post-metadata">

**Author:** ![knaughten](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/knaughten/32/100_2.png) [@knaughten](https://nemo-ocean.discourse.group/u/knaughten)\
**Post date:** [13 February 2024 09:46 UTC](https://nemo-ocean.discourse.group/t/rotating-velocities-in-output/607/7 "2024-02-13T09:46:38Z")

</div>

Hmm, I am not sure. It’s possible they are not conserved simply because you have to interpolate the u and v coordinates to a common grid (in practice the t-grid) in order for rotation to make sense. So far I am only using this code for vector plotting purposes.
