csiro-coasts / emsarray

xarray extension that supports EMS model formats
BSD 3-Clause "New" or "Revised" License
13 stars 1 forks source link

Dimension convention #100

Closed mx-moth closed 10 months ago

mx-moth commented 10 months ago

Most conventions define grids on non-overlapping sets of dimensions. For example, Arakawa C datasets have four different grids, where each grid uses two dimensions, but no two grids share any dimensions. An index is a combination of a grid kind and a set of indices that match the grid dimensions. All current conventions follow this pattern.

A new DimensionConvention subclass has been added that encapsulates this. By formalising this relationship default implementations for .ravel_index, .wind_index, .ravel, .selector_for_index, and .get_grid_kind can be provided

As part of this, the antonyms 'ravel' and 'wind' replaced 'ravel' and 'unravel'. Numpy uses 'ravel' and 'unravel' to mean the inverse operation, but in English 'ravel' and 'unravel' mean the same thing. 'Wind' was chosen instead, leaving 'ravel' to match numpy.ravel.