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

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

Documentation from numpy:

Return the real 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.real
array([ 1.,  3.,  5.])
>>> a.real = 9
>>> a
array([ 9.+2.j,  9.+4.j,  9.+6.j])
>>> a.real = np.array([9, 8, 7])
>>> a
array([ 9.+2.j,  8.+4.j,  7.+6.j])