-
Notifications
You must be signed in to change notification settings - Fork 168
Closed
Description
In essene, ravelling and unravelling needs to know two things:
- Which axes are part of the grid
- How to get the dimensionality of an axis (i.e., how many observations/cell edges are there along a dimension)
Once that is known (and now that #2048 unifies the API for ravel/unravel across grids) the algorithm for ravelling and unravelling grids is the same regardless of grid.
I propose we make the following changes to BaseGrid:
- add a
grid.axescached property that needs to be defined on the subclasses that returns atuple[GridAxis](whereGridAxisis a string) listing the axes names for the grid. Implementation lies on the subclasses. - add a
get_axis_dim(axis: GridAxes) -> intfunction that gives the dimensionality along a dimension (returningNonefor values not ingrid.axes). Implementation lies on the subclasses. An lru_cache can be added to this method. - move the ravel/unravel logic from the subclasses to the Base class
- remove xdim/ydim/zdim/tdim from the XGrid class (and from
Field), as they can be replaced withgrid.get_axis_dim("X")etc.- these attributes were at first only for backwards compatibility with v3
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
Status
Done