diff --git a/xarray/namedarray/core.py b/xarray/namedarray/core.py index 48dc3db345c..8b09d4e9e5b 100644 --- a/xarray/namedarray/core.py +++ b/xarray/namedarray/core.py @@ -602,6 +602,38 @@ def __matmul__(self, other, /): return matmul(self, other) + # Bitwise Operators + + def __invert__(self, /): + from xarray.namedarray._array_api import bitwise_invert + + return bitwise_invert(self) + + def __and__(self, other, /): + from xarray.namedarray._array_api import bitwise_and + + return bitwise_and(self) + + def __or__(self, other, /): + from xarray.namedarray._array_api import bitwise_or + + return bitwise_or(self) + + def __xor__(self, other, /): + from xarray.namedarray._array_api import bitwise_xor + + return bitwise_xor(self) + + def __lshift__(self, other, /): + from xarray.namedarray._array_api import bitwise_left_shift + + return bitwise_left_shift(self) + + def __rshift__(self, other, /): + from xarray.namedarray._array_api import bitwise_right_shift + + return bitwise_right_shift(self) + # Comparison Operators def __eq__(self, other, /):