# xarray.Dataset.broadcast_equals

#### Dataset.broadcast_equals(other)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L1653-L1719)

Check whether two Datasets are broadcast equal.

Two Datasets are broadcast equal if they are equal after
broadcasting all variables against each other.

For example, variables that are scalar in one dataset but non-scalar in
the other dataset can still be broadcast equal if the the non-scalar
variable is a constant.

#### SEE ALSO
[`Dataset.equals`](xarray.Dataset.equals.html.md#xarray.Dataset.equals), [`Dataset.identical`](xarray.Dataset.identical.html.md#xarray.Dataset.identical), `Dataset.broadcast`

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('59ac8145-d22e-4cc2-96d8-5afaed606a55','bcf3c523-012b-4e7a-a697-7b7547f0bcd0','c8896dda-f6ba-44a9-81a8-d0ce7ae70580','../lite/tree/../notebooks/index.html?path=199e2778_33d6_4f84_b9cd_874b8d3186ed.ipynb','None')">Try it in your browser!</button></div>

# 2D array with shape (1, 3)

```pycon
>>> data = np.array([[1, 2, 3]])
>>> a = xr.Dataset(
...     {"variable_name": (("space", "time"), data)},
...     coords={"space": [0], "time": [0, 1, 2]},
... )
>>> a
<xarray.Dataset> Size: 56B
Dimensions:        (space: 1, time: 3)
Coordinates:
  * space          (space) int64 8B 0
  * time           (time) int64 24B 0 1 2
Data variables:
    variable_name  (space, time) int64 24B 1 2 3
```

# 2D array with shape (3, 1)

```pycon
>>> data = np.array([[1], [2], [3]])
>>> b = xr.Dataset(
...     {"variable_name": (("time", "space"), data)},
...     coords={"time": [0, 1, 2], "space": [0]},
... )
>>> b
<xarray.Dataset> Size: 56B
Dimensions:        (time: 3, space: 1)
Coordinates:
  * time           (time) int64 24B 0 1 2
  * space          (space) int64 8B 0
Data variables:
    variable_name  (time, space) int64 24B 1 2 3
```

.equals returns True if two Datasets have the same values, dimensions, and coordinates. .broadcast_equals returns True if the
results of broadcasting two Datasets against each other have the same values, dimensions, and coordinates.

```pycon
>>> a.equals(b)
False
```

```pycon
>>> a.broadcast_equals(b)
True
```

```pycon
>>> a2, b2 = xr.broadcast(a, b)
>>> a2.equals(b2)
True
```

<div id="c8896dda-f6ba-44a9-81a8-d0ce7ae70580" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('59ac8145-d22e-4cc2-96d8-5afaed606a55','c8896dda-f6ba-44a9-81a8-d0ce7ae70580')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('59ac8145-d22e-4cc2-96d8-5afaed606a55','c8896dda-f6ba-44a9-81a8-d0ce7ae70580')">Open In Tab</button></div><div id="bcf3c523-012b-4e7a-a697-7b7547f0bcd0" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
