From a3f47a96518b0198f9b58b6c70b21d3172dd9c24 Mon Sep 17 00:00:00 2001 From: Illviljan <14371165+Illviljan@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:40:58 +0200 Subject: [PATCH] Update core.py --- xarray/namedarray/core.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xarray/namedarray/core.py b/xarray/namedarray/core.py index 94e3722b48d..2966f6564ba 100644 --- a/xarray/namedarray/core.py +++ b/xarray/namedarray/core.py @@ -779,7 +779,14 @@ def device(self) -> _Device: @property def mT(self): - raise NotImplementedError("Todo: ") + if isinstance(self._data, _arrayapi): + from xarray.namedarray._array_api._utils import _infer_dims + + _data = self._data.mT + _dims = _infer_dims(_data.shape) + return self._new(_dims, _data) + else: + raise NotImplementedError("self._data missing mT") @property def ndim(self) -> int: