Skip to content

Commit

Permalink
Update core.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Aug 19, 2024
1 parent c1163ad commit c32abe5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions xarray/namedarray/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
_AttrsLike,
_AxisLike,
_Chunks,
_Device,
_Dim,
_Dims,
_DimsLike,
Expand Down Expand Up @@ -752,6 +753,20 @@ def __getitem__(self, key: _IndexKeyLike | NamedArray):
else:
raise NotImplementedError("{k=} is not supported")

@property
def device(self) -> _Device:
"""
Device of the array’s elements.
See Also
--------
ndarray.device
"""
if isinstance(self._data, _arrayapi):
return self._data.device
else:
raise NotImplementedError("self._data missing device")

@property
def dtype(self) -> _DType_co:
"""
Expand Down

0 comments on commit c32abe5

Please sign in to comment.