# xarray.DataArray.integrate

#### DataArray.integrate(coord=None, datetime_unit=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L5666-L5717)

Integrate along the given coordinate using the trapezoidal rule.

#### NOTE
This feature is limited to simple cartesian geometry, i.e. coord
must be one dimensional.

* **Parameters:**
  * **coord** (`Hashable`, or [sequence](https://docs.python.org/3/glossary.html#term-sequence) of `Hashable`) – Coordinate(s) used for the integration.
  * **datetime_unit** (`{'W', 'D', 'h', 'm', 's', 'ms', 'us', 'ns', 'ps', 'fs', 'as', None}`, *optional*) – Specify the unit if a datetime coordinate is used.
* **Returns:**
  **integrated** ([`DataArray`](xarray.DataArray.html.md#xarray.DataArray))

#### SEE ALSO
[`Dataset.integrate`](xarray.Dataset.integrate.html.md#xarray.Dataset.integrate)

`numpy.trapz`
: corresponding numpy function

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('df490f2e-038e-41c1-bc09-e7fe4999a49f','8b7030c3-cf8a-4bd8-b56d-fa2144a00b5f','365fdc1e-3044-4a0c-8e42-642d2b175ab7','../lite/tree/../notebooks/index.html?path=97ddf6ad_32e9_48fa_a42b_87d66c1b83dc.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(
...     np.arange(12).reshape(4, 3),
...     dims=["x", "y"],
...     coords={"x": [0, 0.1, 1.1, 1.2]},
... )
>>> da
<xarray.DataArray (x: 4, y: 3)> Size: 96B
array([[ 0,  1,  2],
       [ 3,  4,  5],
       [ 6,  7,  8],
       [ 9, 10, 11]])
Coordinates:
  * x        (x) float64 32B 0.0 0.1 1.1 1.2
Dimensions without coordinates: y
>>>
>>> da.integrate("x")
<xarray.DataArray (y: 3)> Size: 24B
array([5.4, 6.6, 7.8])
Dimensions without coordinates: y
```

<div id="365fdc1e-3044-4a0c-8e42-642d2b175ab7" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('df490f2e-038e-41c1-bc09-e7fe4999a49f','365fdc1e-3044-4a0c-8e42-642d2b175ab7')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('df490f2e-038e-41c1-bc09-e7fe4999a49f','365fdc1e-3044-4a0c-8e42-642d2b175ab7')">Open In Tab</button></div><div id="8b7030c3-cf8a-4bd8-b56d-fa2144a00b5f" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
