MCPcopy
hub / github.com/pydata/xarray / _values_unique

Method _values_unique

xarray/plot/utils.py:1550–1579  ·  view source on GitHub ↗

Return unique values. Examples -------- >>> a = xr.DataArray(["b", "a", "a", "b", "c"]) >>> _Normalize(a)._values_unique array([1, 3, 5]) >>> _Normalize(a, width=(18, 36, 72))._values_unique array([18., 45., 72.]) >>> a = xr

(self)

Source from the content-addressed store, hash-verified

1548
1549 @property
1550 def _values_unique(self) -> np.ndarray | None:
1551 """
1552 Return unique values.
1553
1554 Examples
1555 --------
1556 >>> a = xr.DataArray(["b", "a", "a", "b", "c"])
1557 >>> _Normalize(a)._values_unique
1558 array([1, 3, 5])
1559
1560 >>> _Normalize(a, width=(18, 36, 72))._values_unique
1561 array([18., 45., 72.])
1562
1563 >>> a = xr.DataArray([0.5, 0, 0, 0.5, 2, 3])
1564 >>> _Normalize(a)._values_unique
1565 array([0. , 0.5, 2. , 3. ])
1566
1567 >>> _Normalize(a, width=(18, 36, 72))._values_unique
1568 array([18., 27., 54., 72.])
1569 """
1570 if self.data is None:
1571 return None
1572
1573 val: np.ndarray
1574 if self.data_is_numeric:
1575 val = self._data_unique
1576 else:
1577 val = self._indexes_centered(self._data_unique_index)
1578
1579 return self._calc_widths(val)
1580
1581 @property
1582 def ticks(self) -> np.ndarray | None:

Callers

nothing calls this directly

Calls 2

_indexes_centeredMethod · 0.95
_calc_widthsMethod · 0.95

Tested by

no test coverage detected