-
Notifications
You must be signed in to change notification settings - Fork 45
Description
In @clyne's talk yesterday at the Pangeo Showcase seminar, he mentioned that uxarray aims to copy some aspects of the xgcm API. I thought I would share our current plans around xgcm, since they may be relevant to uxarray.
We (me and @TomNicholas) are currently in the midst of a big refactor of xgcm around the concept of a grid_ufunc. The original proposal is here: xgcm/xgcm#344
Essentially, grid ufunc defines a way to annotate a function in with a "signature" that defines the location of the inputs and outputs with respected to a structured grid. A simple example is
@grid_ufunc(signature="(X:left,Y:center),(X:center,Y:left)->(X:left,Y:left)")
def cgrid_vorticity(u, v):
# do complicated stuff
return vort
xgcm can then apply these ufuncs given a Grid object. We like this because:
- It will allow us to optimize some of our existing functions to be more computationally efficient
- It will enable anyone to define grid_ufuncs and have them work with xgcm
- It is actually language agnostic as a specification (more at the level of SGRID) and could thus be implemented from any language. We could write grid ufuncs in C++ or Julia and run them in python.
You could imagine using a similar approach with unstructured grids, since UGRID gives a clear way to specify the locations of data wrt the unstructured mesh.
I thought I would just open this issue to put this idea on your radar.
Progress on this is being tracked here: https://github.com/xgcm/xgcm/projects/10