cf.Data.compressed¶

Data.compressed(inplace=False)[source]

Return all non-masked values in a one dimensional data array.

Not to be confused with compression by convention (see the uncompress method).

New in version 3.2.0.

Parameters
inplace: bool, optional

If True then do the operation in-place and return None.

Returns
Data or None

The non-masked values, or None if the operation was in-place.

Examples

>>> d = cf.Data(numpy.arange(12).reshape(3, 4))
>>> print(d.array)
[[ 0  1  2  3]
[ 4  5  6  7]
[ 8  9 10 11]]
>>> print(d.compressed().array)
[ 0  1  2  3  4  5  6  7  8  9 10 11]

>>> d = cf.Data(9)