# 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('9a728e58-d015-4553-ace3-8bf7c2251f4a','571324bd-3bab-4cb4-b76e-c30ebac789cf','4babd07f-54d1-4460-b2aa-4a20b053681e','../lite/tree/../notebooks/index.html?path=880b570a_1df6_4a37_9fe1_1779eb013dab.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="4babd07f-54d1-4460-b2aa-4a20b053681e" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('9a728e58-d015-4553-ace3-8bf7c2251f4a','4babd07f-54d1-4460-b2aa-4a20b053681e')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('9a728e58-d015-4553-ace3-8bf7c2251f4a','4babd07f-54d1-4460-b2aa-4a20b053681e')">Open In Tab</button></div><div id="571324bd-3bab-4cb4-b76e-c30ebac789cf" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
