MCPcopy Index your code
hub / github.com/pydata/xarray / __init__

Method __init__

xarray/plot/utils.py:1399–1418  ·  view source on GitHub ↗
(
        self,
        data: DataArray | None,
        width: tuple[float, float, float] | None = None,
        _is_facetgrid: bool = False,
    )

Source from the content-addressed store, hash-verified

1397 )
1398
1399 def __init__(
1400 self,
1401 data: DataArray | None,
1402 width: tuple[float, float, float] | None = None,
1403 _is_facetgrid: bool = False,
1404 ) -> None:
1405 self._data = data
1406 self._width = width if not _is_facetgrid else None
1407
1408 pint_array_type = DuckArrayModule("pint").type
1409 to_unique = (
1410 data.to_numpy() # type: ignore[union-attr]
1411 if isinstance(data if data is None else data.data, pint_array_type)
1412 else data
1413 )
1414 data_unique, data_unique_inverse = np.unique(to_unique, return_inverse=True) # type: ignore[call-overload]
1415 self._data_unique = data_unique
1416 self._data_unique_index = np.arange(0, data_unique.size)
1417 self._data_unique_inverse = data_unique_inverse
1418 self._data_is_numeric = False if data is None else _is_numeric(data)
1419
1420 def __repr__(self) -> str:
1421 with np.printoptions(precision=4, suppress=True, threshold=5):

Callers

nothing calls this directly

Calls 4

DuckArrayModuleClass · 0.90
_is_numericFunction · 0.85
arangeMethod · 0.80
to_numpyMethod · 0.45

Tested by

no test coverage detected