# xarray.Dataset.broadcast_equals

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

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.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('c415be47-ffb4-49ff-9e2a-c36d0ed5ee17','509c9d4b-5ced-4895-baae-a3c847097629','236a26d7-baf6-4e32-a5f0-1b1a11a68d55','../lite/tree/../notebooks/index.html?path=ef9b7ed9_a677_4bdb_bd9d_cb951486b5f7.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="236a26d7-baf6-4e32-a5f0-1b1a11a68d55" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('c415be47-ffb4-49ff-9e2a-c36d0ed5ee17','236a26d7-baf6-4e32-a5f0-1b1a11a68d55')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('c415be47-ffb4-49ff-9e2a-c36d0ed5ee17','236a26d7-baf6-4e32-a5f0-1b1a11a68d55')">Open In Tab</button></div><div id="509c9d4b-5ced-4895-baae-a3c847097629" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>

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