cfdm.Data.unique

Data.unique(inplace=False)[source]

The unique elements of the data.

Returns the sorted unique elements of the array.

Returns
Data or None

The unique values in a 1-d array, or None if the operation was in-place.

Examples

>>>
>>> d = cfdm.Data([[4, 2, 1], [1, 2, 3]], 'm')
>>> print(d.array)
[[4 2 1]
 [1 2 3]]
>>> e = d.unique()
>>> print(e.array)
[1 2 3 4]
>>> d[0, 0] = cfdm.masked
>>> print(d.array)
[[-- 2 1]
 [1 2 3]]
>>> e = d.unique()
>>> print(e.array)
[1 2 3 --]