diff --git a/docs/concepts/indexing.rst b/docs/concepts/indexing.rst index ad910a7..151d5ca 100644 --- a/docs/concepts/indexing.rst +++ b/docs/concepts/indexing.rst @@ -46,13 +46,14 @@ Using indexes A convention native index can be transformed in to a linear index by calling :meth:`Convention.ravel_index(native_index) <.Convention.ravel_index>`. A linear index can be transformed in to a native index by calling -:meth:`Convention.unravel_index(linear_index, kind) <.Convention.unravel_index>`. +:meth:`Convention.wind_index(linear_index, grid_kind=grid_kind) <.Convention.wind_index>`. To find the correct native index kind for a data variable, -call :meth:`.Convention.get_grid_kind_and_size`. -This will return a tuple of ``(kind, size)``. -``kind`` is the native index kind (face, edge, node, etc), -while ``size`` is the length of the linear index space for that grid. +call :meth:`.Convention.get_grid_kind(data_array) <.Convention.get_grid_kind>`. +This will return one of the :attr:`Convention.grid_kinds` members. +:attr:`.Convention.default_grid_kind` indicates which grid kind +represents the cells in this convention. +:attr:`.Convention.grid_size` indicates how large the index space is for each grid kind. :attr:`.Convention.strtree` is a :class:`spatial index ` @@ -64,8 +65,12 @@ are in linear index order. If you have the linear index for a cell, you can find its polygon by indexing directly in to this array. -:meth:`Convention.make_linear` will the surface dimensions of a data variable +:meth:`Convention.ravel` will transform the surface dimensions of a data variable in to a linear one dimensional array. The order of this flattened array matches the linear index order. If you have the linear index for a cell, you can find its value by indexing directly in to this array. +:meth:`Convention.wind` is the inverse operation. +It takes a linear data array and transforms it in to the same shape as the convention. +This can be used to create arbitrary new data arrays for a dataset +in a way completely agnostic of the underlying convention. diff --git a/docs/releases/development.rst b/docs/releases/development.rst index e051133..93772fc 100644 --- a/docs/releases/development.rst +++ b/docs/releases/development.rst @@ -4,7 +4,7 @@ Next release (in development) * Use 'ravel' and 'wind' as antonyms instead of 'ravel' and 'unravel'. English is weird. 'Ravel' and 'unravel' mean the same thing!. - (:pr:`100`) + (:pr:`100`, :pr:`104`). * Added new :class:`emsarray.conventions.DimensionConvention` subclass. For conventions with multiple grids defined on unique subsets of dimensions this base class will provide a number of default method implementations. @@ -12,7 +12,7 @@ Next release (in development) (:pr:`100`) * Remove workaround for `pydata/xarray#6049 `_ (:pr:`101`). * Add :meth:`.Convention.wind()` method as the inverse to :meth:`.Convention.ravel()` - (:pr:`102`). + (:pr:`102`, :pr:`104`). * Add :attr:`.Convention.strtree()` spatial index, deprecate :attr:`.Convention.spatial_index()`. The old attribute was a compatibility shim around Shapely 1.8.x STRtree implementation.