cf.Data.__iter__

Data.__iter__()[source]

Called when an iterator is required.

x.__iter__() <==> iter(x)

Performance

If the shape of the data is unknown then it is calculated immediately by executing all delayed operations.

Examples

>>> d = cf.Data([1, 2, 3], 'metres')
>>> for e in d:
...     print(repr(e))
...
<CF Data(1): [1] metres>
<CF Data(1): [2] metres>
<CF Data(1): [3] metres>
>>> d = cf.Data([[1, 2], [3, 4]], 'metres')
>>> for e in d:
...     print(repr(e))
...
<CF Data: [1, 2] metres>
<CF Data: [3, 4] metres>
>>> d = cf.Data(99, 'metres')
>>> for e in d:
...     print(repr(e))
...
Traceback (most recent call last):
    ...
TypeError: iteration over a 0-d Data