cf.Data.ndindex

Data.ndindex()[source]

Return an iterator over the N-dimensional indices of the data array.

At each iteration a tuple of indices is returned, the last dimension is iterated over first.

Returns
itertools.product

An iterator over tuples of indices of the data array.

Examples:

>>> d.shape
(2, 1, 3)
>>> for i in d.ndindex():
...     print(i)
...
(0, 0, 0)
(0, 0, 1)
(0, 0, 2)
(1, 0, 0)
(1, 0, 1)
(1, 0, 2)

> d.shape () >>> for i in d.ndindex(): … print(i) … ()