-
Notifications
You must be signed in to change notification settings - Fork 2
Description
If we add time as a center coordinate and time_bounds as an outer coordinate to an xgcm.Grid call, we will be able to use difference to calculate monthly Eulerian time derivatives from snapshot diagnostics.
difference relies on grid.diff, and grid.diff can fail when the spatiotemporal axis being differenced is not contained in a single dask chunk. In practice, that means users may need to set chunks=-1 along the differencing axis (e.g. chunks={dim: -1} when calling grid.diff(..., axis=dim)).
Once time is added as a coordinate, MODEL.yaml graphs will be able to call difference along multiple spatiotemporal axes. This could unintentionally require the user to set chunks=-1 across many dimensions, which can accidentally pull the entire dataset into memory.
For these reasons, I propose the following features to be added to xbudget:
- (A) Add an optional
allow_rechunkargument tocollect_budgetsthat (if needed) will rechunk only the correct axis insidedifference. This would avoid having to load the entire dataset into memory. Ifallow_rechunk=False, we can add a warning explaining thatgrid.diffneeds the differencing axis to havechunks={dim: -1}along that axis. - (B) Allow difference to be composed with other
xbudgetoperations (I.e.,difference(product(x, y))). - (C) Add
xgcmtime coords to the setup of the MOM6xgcm.Gridsetup.
Currently typing this out on the flight to Glasgow lol, any thoughts/questions/concerns @hdrake ?