xray.ufuncs.imag(*args, **kwargs)

xray specific variant of numpy.imag. Handles xray.Dataset, xray.DataArray, xray.Variable, numpy.ndarray and dask.array.Array objects with automatic dispatching.

Documentation from numpy:

Return the imaginary part of the elements of the array.

val : array_like

Input array.


out : ndarray

Output array. If val is real, the type of val is used for the output. If val has complex elements, the returned type is float.


>>> a = np.array([1+2j, 3+4j, 5+6j])
>>> a.imag
array([ 2.,  4.,  6.])
>>> a.imag = np.array([8, 10, 12])
>>> a
array([ 1. +8.j,  3.+10.j,  5.+12.j])