XGCM: Your friend and helper for naughty grids
I am seeing many fantastic science projects emerging for the hackathon (so many I am already dreading to decide in a few days).
I would like to add a project that is technical and likely related to many of the other projects in one way or the other.
Many of the projects propose using a combination of xarray and xgcm. The latter is the focus of this project and a centralized project around xgcm would assure that the functionality of this package would be optimally promoted and used but more crucially, that it evolves with the demand of the science done at the hackathon.
I am proposing to centralize efforts around promoting, improving and testing xgcm here
One of the major challenges of a project like CMIP6 is that the various models provided have different grid architectures, both in the horizontal and vertical. In order to analyze the output between different models we require tools that can calculate properties on the native grid of the model and avoid interpolation and associated errors. The syntax of these tools should be as „agnostic“ as possible so that common operations like a gradient or divergence operator can be applied with a simple syntax akin to an analytical equation. The proposed tools would detect if e.g. the velocities are located on a B or C-grid and then execute the numerical calculations as close to the internal model code as possible.
xgcm currently has the ability to do the fundamental operations like interpolating and differencing on a finite grid, but the user has to remember the appropriate grid architecture and grid metrics (e.g. cell distances, areas, volumes). We need some higher-level functions to make xgcm even more useful.
I would propose the implementation of common vector calculus operators like grad, div, curl into the xgcm module. The recent addition of automatic grid metric handling builds the foundation for these operators and this workshop presents a fantastic opportunity to develop these new function on top while simultaneously testing them with a variety of model outputs.
Functionality for (very related) vertical grid transformation has happened mostly at Plotting ocean variables in density coordinates (using xhistogram), but this could be a fit for this more technical project too.
A note on the scope of xgcm
The goal of xgcm is to provide a generalized tool that is applicable on any logically rectangular grid (sorry no unstructured grids yet…). Functionality in xgcm should be kept to a very small set of essential functions. In that sense, we discourage building many specialized functions, like e.g. Okubo-Weiss Parameters or Shear and Strain fields and functionality that works only on your favorite model. These can be hosted in other packages building on xgcm functionality (here is an example of how I did this with MOM5 specific analysis tools; WARNING: This is not a pretty and/or well documented packaged yet).
Since this project straddles so many others I am unsure what the best way to organize would be. But I would envision something like this:
An introduction to xgcm and what it can currently do at the beginning stage of the hackathon.
Getting feedback from the projects on what is working, and what is not.
Implement new functionality or resolve issues that were brought up.
Start at 2. again and repeat throughout the workshop.
I am very keen to get some feedback on this structure from people who have more experience in these kinds of events.
Anticipated Data Needs
For testing and using xgcm properly, we need the static grid information of each model:
- Grid metrics: distances, areas for each logical cell (e.g. tracer, north, northeast, west or equivalent)
Anticipated Software Tools
This is focused on xgcm as a tool but we might implement other tools like xhistogram if we decide to implement a vertical coordinate transform as part of xgcm.
I wish for as many people as possible to get involved, use the tools and give feedback. This gathering really is a unique opportunity to improve these tools at a fast speed and get broad feedback. So literally anyone is more than welcome!
We should probably include at least @rabernat to approve PRs
A plead: Get involved before the Hackathon!
I think most folks (including myself) want to focus on the science during the hackathon, so I am very determined to bring a good chunk of the functionality to xgcm before next week. Please get involved by trying xgcm out and raise or comment on issues.