Skip to content

Commit 1d2cf21

Browse files
committed
[doc] example code for reading the default MD_DIMS
The default value is explained in _metadata.py in English. Explicitly give the equivalent Python version, as it's not obvious to come up with it.
1 parent 6cf607d commit 1d2cf21

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

doc/develop/backend-api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,14 @@ in a different order. It is possible to override the default dimension order by
619619
using the ``MD_DIMS`` metadata. For instance, RGB data is often stored with the
620620
channel as last dimension for display. Such case can be indicated with "YXC".
621621

622+
.. note::
623+
624+
As a DataArray number of dimension can vary, and by default the MD_DIMS is undefined, to
625+
indicate the "default order", it is not directly easy to read this metadata.
626+
It is recommended to access it this way:
627+
628+
``dims = data.metadata.get(model.MD_DIMS, "CTZYX"[-data.ndim::])``
629+
622630
Convention about measurement units
623631
==================================
624632

0 commit comments

Comments
 (0)