xarray.full_like

xarray.full_like(other, fill_value, dtype=None)

Return a new object with the same shape and type as a given object.

Parameters:

other : DataArray, Dataset, or Variable

The reference object in input

fill_value : scalar

Value to fill the new object with before returning it.

dtype : dtype, optional

dtype of the new array. If omitted, it defaults to other.dtype.

Returns:

out : same as object

New object with the same shape and type as other, with the data filled with fill_value. Coords will be copied from other. If other is based on dask, the new one will be as well, and will be split in the same chunks.