xgcm
General Circulation Model Postprocessing with xarray
xgcm is a python packge for working with the datasets produced by numerical General Circulation Models (GCMs) and similar gridded datasets that are amenable to finite volume analysis. In these datasets, different variables are located at different positions with respect to a volume or area element (e.g. cell center, cell face, etc.) xgcm solves the problem of how to interpolate and difference these variables from one position to another.
Official Documents
xgcm: General Circulation Model Postprocessing with xarray — xgcm 0.2.0+44.gcac66af documentation
MITgcm Example
Tutorials
PyVideo.org · Xgcm: Analyzing General Circulation Models in Python | SciPy 2019 | Ryan Abernathey
Examples
ECCOv4
Vector calculus in ECCO: The Transport, divergence, vorticity and the Barotropic Vorticity Budget ECCOv4 budgets
code:python
ds = xr.Dataset({"u":("y_c","x_g",np.ma.masked_array(u,u<-100.)), coords={'x_c': ('x_c',, lonv, {'axis': 'X'}), {'axis': 'X', 'c_grid_axis_shift': -0.5}),
'y_c': ('y_c',, latu, {'axis': 'Y'}), {'axis': 'Y', 'c_grid_axis_shift': -0.5})
},
)
grid=xgcm.Grid(ds,periodic=False)
print(grid)
See also
xmitgcm: python package for reading MITgcm binary MDS files into xarray data structures.