def empty_like(array, dtype=None, keepmeta=True):
"""Create an array of empty with the same shape and type as the input array.
Args:
array (xarray.DataArray): The shape and data-type of it define
these same attributes of the output array.
dtype (data-type, optional): If spacified, this function overrides
the data-type of the output array.
keepmeta (bool, optional): Whether *coords, attrs, and name of the input
array are kept in the output one. Default is True.
Returns:
array (decode.array): Decode array without initializing entries.
"""
if keepmeta:
return dc.empty(array.shape, dtype,
tcoords=array.dca.tcoords, chcoords=array.dca.chcoords,
scalarcoords=array.dca.scalarcoords, attrs=array.attrs, name=array.name
)
else:
return dc.empty(array.shape, dtype)
评论列表
文章目录