(self, other, f)
| 7750 | return ds |
| 7751 | |
| 7752 | def _inplace_binary_op(self, other, f) -> Self: |
| 7753 | from xarray.core.dataarray import DataArray |
| 7754 | from xarray.core.groupby import GroupBy |
| 7755 | |
| 7756 | if isinstance(other, GroupBy): |
| 7757 | raise TypeError( |
| 7758 | "in-place operations between a Dataset and " |
| 7759 | "a grouped object are not permitted" |
| 7760 | ) |
| 7761 | # we don't actually modify arrays in-place with in-place Dataset |
| 7762 | # arithmetic -- this lets us automatically align things |
| 7763 | if isinstance(other, DataArray | Dataset): |
| 7764 | other = other.reindex_like(self, copy=False) |
| 7765 | g = ops.inplace_to_noninplace_op(f) |
| 7766 | ds = self._calculate_binary_op(g, other, inplace=True) |
| 7767 | self._replace_with_new_dims( |
| 7768 | ds._variables, |
| 7769 | ds._coord_names, |
| 7770 | attrs=ds._attrs, |
| 7771 | indexes=ds._indexes, |
| 7772 | inplace=True, |
| 7773 | ) |
| 7774 | return self |
| 7775 | |
| 7776 | def _calculate_binary_op( |
| 7777 | self, f, other, join="inner", inplace: bool = False |
nothing calls this directly
no test coverage detected