xarray.ufuncs.nextafter

xarray.ufuncs.nextafter = <xarray.ufuncs._UFuncDispatcher object>

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

Documentation from numpy:

nextafter(x1, x2[, out])

Return the next floating-point value after x1 towards x2, element-wise.

Parameters:

x1 : array_like

Values to find the next representable value of.

x2 : array_like

The direction where to look for the next representable value of x1.

out : ndarray, optional

Array into which the output is placed. Its type is preserved and it must be of the right shape to hold the output. See doc.ufuncs.

Returns:

out : array_like

The next representable values of x1 in the direction of x2.

Examples

>>> eps = np.finfo(np.float64).eps
>>> np.nextafter(1, 2) == eps + 1
True
>>> np.nextafter([1, 2], [2, 1]) == [eps + 1, 2 - eps]
array([ True,  True], dtype=bool)