Python tools to open / process NEMO outputs

Hello everyone,

I am sure that many of you that use python as programming language are aware of the xgcm package. However NEMO outputs are not directly understandable by xgcm, so some preprocessing is needed. To solve this issue, I am aware of 2 packages:

(developed by Willi Rath from GEOMAR) and

(developed by me).

I open this post to hopefully summarize the existing python tools used to analyze NEMO outputs, so one does not need to re-implemented things, and so we can share our data analyze process chain.

I also think that the community would gain having a somehow standardize way to open the NEMO output files and make them compatible with xgcm and cf convention (and add some doc on this?). For this I would be happy to merge xnemogcm with another existing project if possible and/or needed.

So no real question or problem here, more a discussion with other python user.

Romain

9 Likes

Hi, I don’t use python yet but I want to use it more for my NEMO analysis. Your package and xgcm could be very useful. But do the packages include simple average operation? Like a depth-averaged map, plot series inside a polygon or values along a track? I know that you can write scripts that does exactly that, but having it in a package would be greate.
Thanks

Hi Nicolas,
these packages do not integrate directly all of these operations. However in xarray, in 1 line you can e.g. compute average along any dimension(s) (depth, time, X, Y), even weighted averages. With xgcm you can easily remap to other coordinates to e.g. compute averages in density coordinate.
You may want to look at the oceanspy package, that aims to facilitate analyzes of model outputs.
Otherwise, you will probably need to write your own script (or package even)
Romain

Hello,

I advertise here that I released a new version of xnemogcm, that has been tested for nemo 3.6, 4.0 and 4.2.0.

It is now available on pypi, and will also be soon updated on conda-forge

Best,
Romain

1 Like

I personnally use (a modified version of) the following bash commands :

f=coordinates.nc
f=mesh_mask.nc
eval ncatted \
  `for g in t u v f;do
    echo "-a standard_name,glam$g,o,char,longitude_at_${g}_location"
    echo "-a standard_name,gphi$g,o,char,latitude_at_${g}_location"
    echo "-a coordinates,e1$g,o,char,\"glam$g gphi$g\""
    echo "-a coordinates,e2$g,o,char,\"glam$g gphi$g\""
    done` \
  -O $f ${f/%.nc/-CFed.nc}