empty_ref#

xarray_einstats.empty_ref(*args, dims, dtype=None)[source]#

Create an empty DataArray from reference object(s).

Creates an empty DataArray from reference DataArrays or Datasets and a list with the desired dimensions.

Parameters:
*argsiterable of xarray.DataArray or xarray.Dataset

Reference objects from which the lengths and coordinate values (if any) of the given dims will be taken.

dimslist of hashable

List of dimensions of the output DataArray. Passed as is to the {class}`~xarray.DataArray` constructor.

dtypedtype, optional

The dtype of the output array. If it is not provided it will be inferred from the reference DataArrays in args with numpy.result_type.

Returns:
xarray.DataArray

See also

ones_ref, zeros_ref