cf.Data.flat

Data.flat(ignore_masked=True)[source]

Return a flat iterator over elements of the data array.

Parameters
ignore_masked: bool, optional

If False then masked and unmasked elements will be returned. By default only unmasked elements are returned

Returns
generator

An iterator over elements of the data array.

Examples:

>>> print(d.array)
[[1 -- 3]]
>>> for x in d.flat():
...     print(x)
...
1
3
>>> for x in d.flat(ignore_masked=False):
...     print(x)
...
1
--
3