True if two DataArrays have the same dimensions, coordinates and values; otherwise False. DataArrays can still be equal (like pandas objects) if they have NaN values in the same locations. This method is necessary because `v1 == v2` for ``DataArray`` does el
(self, other: Self)
| 4754 | return False |
| 4755 | |
| 4756 | def equals(self, other: Self) -> bool: |
| 4757 | """True if two DataArrays have the same dimensions, coordinates and |
| 4758 | values; otherwise False. |
| 4759 | |
| 4760 | DataArrays can still be equal (like pandas objects) if they have NaN |
| 4761 | values in the same locations. |
| 4762 | |
| 4763 | This method is necessary because `v1 == v2` for ``DataArray`` |
| 4764 | does element-wise comparisons (like numpy.ndarrays). |
| 4765 | |
| 4766 | Parameters |
| 4767 | ---------- |
| 4768 | other : DataArray |
| 4769 | DataArray to compare to. |
| 4770 | |
| 4771 | Returns |
| 4772 | ------- |
| 4773 | equal : bool |
| 4774 | True if the two DataArrays are equal. |
| 4775 | |
| 4776 | See Also |
| 4777 | -------- |
| 4778 | DataArray.broadcast_equals |
| 4779 | DataArray.identical |
| 4780 | |
| 4781 | Examples |
| 4782 | -------- |
| 4783 | >>> a = xr.DataArray([1, 2, 3], dims="X") |
| 4784 | >>> b = xr.DataArray([1, 2, 3], dims="X", attrs=dict(units="m")) |
| 4785 | >>> c = xr.DataArray([1, 2, 3], dims="Y") |
| 4786 | >>> d = xr.DataArray([3, 2, 1], dims="X") |
| 4787 | >>> a |
| 4788 | <xarray.DataArray (X: 3)> Size: 24B |
| 4789 | array([1, 2, 3]) |
| 4790 | Dimensions without coordinates: X |
| 4791 | >>> b |
| 4792 | <xarray.DataArray (X: 3)> Size: 24B |
| 4793 | array([1, 2, 3]) |
| 4794 | Dimensions without coordinates: X |
| 4795 | Attributes: |
| 4796 | units: m |
| 4797 | >>> c |
| 4798 | <xarray.DataArray (Y: 3)> Size: 24B |
| 4799 | array([1, 2, 3]) |
| 4800 | Dimensions without coordinates: Y |
| 4801 | >>> d |
| 4802 | <xarray.DataArray (X: 3)> Size: 24B |
| 4803 | array([3, 2, 1]) |
| 4804 | Dimensions without coordinates: X |
| 4805 | |
| 4806 | >>> a.equals(b) |
| 4807 | True |
| 4808 | >>> a.equals(c) |
| 4809 | False |
| 4810 | >>> a.equals(d) |
| 4811 | False |
| 4812 | """ |
| 4813 | try: |