Skip to content

Interface to open NEMO global circulation model output dataset with xarray and create a xgcm grid.

License

Notifications You must be signed in to change notification settings

rcaneill/xnemogcm

Repository files navigation

xnemogcm

DOI python versions ci documentation status pypi anaconda badge Project Status: Active – The project has reached a stable, usable state and is being actively developed. pyOpenSci

Interface to open NEMO ocean global circulation model output as an Xarray Dataset and create a xgcm grid. NEMO 3.6, 4.0, and 4.2.0 are tested and supported. Any version between 3.6 and 4.2.0 should work, but in case of trouble, please open an issue.

If you wish to contribute but don't have a github account, send me an email with your questions or comments: romain [dot] caneill [at] ens-lyon [.] org

Installation

For conda

conda install --channel conda-forge xnemogcm

for pip

pip install xnemogcm

Usage

from pathlib import Path
from xnemogcm import open_nemo_and_domain_cfg

ds = open_nemo_and_domain_cfg(
    nemo_files='/path/to/output/files',
    domcfg_files='/path/to/domain_cfg/mesh_mask/files'
)

# Interface with xgcm
from xnemogcm import get_metrics
import xgcm
grid = xgcm.Grid(ds, metrics=get_metrics(ds), periodic=False)

The full documentation is hosted online: https://xnemogcm.readthedocs.io/

Differences with existing tools

There exist tools in Fortran that ship with NEMO that are used to create domain files, input fields, etc. They are however more used to produce configurations with the necessary input files, than to analyse the outputs. So there is only one overlap with xnemogcm, which is recombining the mesh_mask / domaincfg files, when they have been outputted by different processors.

NEMO output files are outputted as netcdf so they can directly be opened by xarray. However, what is missing is all grid information in the shape needed by xgcm (COMODO convention). To solve this problem, another python package exists: xorca. However, xorca is not developed any more and is less flexible than xnemogcm. xnemogcm is meant to replace xorca, in addition to extending its functionality.

About

Interface to open NEMO global circulation model output dataset with xarray and create a xgcm grid.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages