# xarray.ufuncs.sqrt

### xarray.ufuncs.sqrt *= <xarray.ufuncs._unary_ufunc object>*

xarray specific variant of `numpy.sqrt()`. Handles xarray objects by dispatching to the appropriate function for the underlying array type.

Documentation from numpy:

Return the non-negative square-root of an array, element-wise.

* **Parameters:**
  * **x** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like)) – The values whose square-roots are required.
  * **out** ([`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray), [`None`](https://docs.python.org/3/builtins/constants.html#None), or [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) of [`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray) and [`None`](https://docs.python.org/3/builtins/constants.html#None), *optional*) – A location into which the result is stored. If provided, it must have
    a shape that the inputs broadcast to. If not provided or None,
    a freshly-allocated array is returned. A tuple (possible only as a
    keyword argument) must have length equal to the number of outputs.
  * **where** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like), *optional*) – This condition is broadcast over the input. At locations where the
    condition is True, the out array will be set to the ufunc result.
    Elsewhere, the out array will retain its original value.
    Note that if an uninitialized out array is created via the default
    `out=None`, locations within it where the condition is False will
    remain uninitialized.
  * **\*\*kwargs** – For other keyword-only arguments, see the
    [ufunc docs](https://numpy.org/doc/stable/reference/ufuncs.html#ufuncs-kwargs).
* **Returns:**
  **y** ([`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)) – An array of the same shape as x, containing the positive
  square-root of each element in x.  If any element in x is
  complex, a complex array is returned (and the square-roots of
  negative reals are calculated).  If all of the elements in x
  are real, so is y, with negative elements returning `nan`.
  If out was provided, y is a reference to it.
  This is a scalar if x is a scalar.

#### SEE ALSO
`emath.sqrt`
: A version which returns complex numbers when given negative reals. Note that 0.0 and -0.0 are handled differently for complex inputs.

### Notes

*sqrt* has–consistent with common convention–as its branch cut the
real “interval” [-inf, 0), and is continuous from above on it.
A branch cut is a curve in the complex plane across which a given
complex function fails to be continuous.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('91d3a2ee-145c-41ca-9aa6-4f8444d4391f','7b9c8af4-f8bf-48e1-a69f-ede2795dc345','f0474f2a-0d7a-4b0a-b83c-3f58a1933d79','../lite/tree/../notebooks/index.html?path=7df21e57_2e1a_4041_9dd6_58bb4c007530.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> import numpy as np
>>> np.sqrt([1,4,9])
array([ 1.,  2.,  3.])
```

```pycon
>>> np.sqrt([4, -1, -3+4J])
array([ 2.+0.j,  0.+1.j,  1.+2.j])
```

```pycon
>>> np.sqrt([4, -1, np.inf])
array([ 2., nan, inf])
```

<div id="f0474f2a-0d7a-4b0a-b83c-3f58a1933d79" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('91d3a2ee-145c-41ca-9aa6-4f8444d4391f','f0474f2a-0d7a-4b0a-b83c-3f58a1933d79')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('91d3a2ee-145c-41ca-9aa6-4f8444d4391f','f0474f2a-0d7a-4b0a-b83c-3f58a1933d79')">Open In Tab</button></div><div id="7b9c8af4-f8bf-48e1-a69f-ede2795dc345" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
