# xarray.ufuncs.angle

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

xarray specific variant of [`numpy.angle()`](https://numpy.org/doc/stable/reference/generated/numpy.angle.html#numpy.angle). Handles xarray objects by dispatching to the appropriate function for the underlying array type.

Documentation from numpy:

Return the angle of the complex argument.

* **Parameters:**
  * **z** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like)) – A complex number or sequence of complex numbers.
  * **deg** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *optional*) – Return angle in degrees if True, radians if False (default).
* **Returns:**
  **angle** ([`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray) or [scalar](../user-guide/terminology.html.md#term-scalar)) – The counterclockwise angle from the positive real axis on the complex
  plane in the range `(-pi, pi]`, with dtype as numpy.float64.

#### SEE ALSO
[`arctan2`](xarray.ufuncs.arctan2.html.md#xarray.ufuncs.arctan2), [`absolute`](xarray.ufuncs.absolute.html.md#xarray.ufuncs.absolute)

### Notes

This function passes the imaginary and real parts of the argument to
arctan2 to compute the result; consequently, it follows the convention
of arctan2 when the magnitude of the argument is zero. See example.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('252e0ef7-65dd-4f40-8a37-cf6500533055','b9355fee-e1a3-4a7b-987b-a116bcd968da','4e2b6b10-e896-44df-8a4f-251fe2f765bc','../lite/tree/../notebooks/index.html?path=f8b90ff4_62ab_493b_9e79_d0973fae10dd.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> import numpy as np
>>> np.angle([1.0, 1.0j, 1+1j])               # in radians
array([ 0.        ,  1.57079633,  0.78539816]) # may vary
>>> np.angle(1+1j, deg=True)                  # in degrees
45.0
>>> np.angle([0., -0., complex(0., -0.), complex(-0., -0.)])  # convention
array([ 0.        ,  3.14159265, -0.        , -3.14159265])
```

<div id="4e2b6b10-e896-44df-8a4f-251fe2f765bc" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('252e0ef7-65dd-4f40-8a37-cf6500533055','4e2b6b10-e896-44df-8a4f-251fe2f765bc')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('252e0ef7-65dd-4f40-8a37-cf6500533055','4e2b6b10-e896-44df-8a4f-251fe2f765bc')">Open In Tab</button></div><div id="b9355fee-e1a3-4a7b-987b-a116bcd968da" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
