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

Method _unary_op

xarray/core/variable.py:2434–2442  ·  view source on GitHub ↗
(self, f, *args, **kwargs)

Source from the content-addressed store, hash-verified

2432 return Variable(self.dims, obj)
2433
2434 def _unary_op(self, f, *args, **kwargs):
2435 keep_attrs = kwargs.pop("keep_attrs", None)
2436 if keep_attrs is None:
2437 keep_attrs = _get_keep_attrs(default=True)
2438 with np.errstate(all="ignore"):
2439 result = self.__array_wrap__(f(self.data, *args, **kwargs))
2440 if keep_attrs:
2441 result.attrs = self.attrs
2442 return result
2443
2444 def _binary_op(self, other, f, reflexive=False):
2445 if isinstance(other, xr.DataTree | xr.DataArray | xr.Dataset):

Callers

nothing calls this directly

Calls 3

__array_wrap__Method · 0.95
_get_keep_attrsFunction · 0.90
fFunction · 0.70

Tested by

no test coverage detected