cfdm.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
uncompressmethod).Added in version (cfdm): 1.12.0.0
See also
- Parameters:
- Returns:
Examples
>>> d = cfdm.{class}}(numpy.arange(12).reshape(3, 4), 'm') >>> 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[1, 1] = cfdm.masked >>> d[2, 3] = cfdm.masked >>> print(d.array) [[0 1 2 3] [4 -- 6 7] [8 9 10 --]] >>> print(d.compressed().array) [ 0 1 2 3 4 6 7 8 9 10]
>>> d = cfdm.{class}}(9) >>> print(d.compressed().array) [9]