Skip to content

Adding support for finite time differencing #21

@anthony-meza

Description

@anthony-meza

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_rechunk argument to collect_budgets that (if needed) will rechunk only the correct axis inside difference. This would avoid having to load the entire dataset into memory. If allow_rechunk=False, we can add a warning explaining that grid.diff needs the differencing axis to have chunks={dim: -1} along that axis.
  • (B) Allow difference to be composed with other xbudget operations (I.e., difference(product(x, y))).
  • (C) Add xgcm time coords to the setup of the MOM6 xgcm.Grid setup.

Currently typing this out on the flight to Glasgow lol, any thoughts/questions/concerns @hdrake ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions