# xarray.zeros_like

`xarray.``zeros_like`(other, dtype: Union[numpy.dtype, str] = None)

  Return a new object of zeros with the same shape and type as a given dataarray or dataset.

  Parameters:

  - other (DataArray, Dataset, or Variable) – The reference object. The output will have the same dimensions and coordinates as this object.
  - dtype (dtype, optional) – dtype of the new array. If omitted, it defaults to other.dtype.

  Returns: | out – New object of zeros with the same shape and type as other.
  Return type: | same as object

  Examples

      >>> import numpy as np
      >>> import xarray as xr
      >>> x = xr.DataArray(np.arange(6).reshape(2, 3),
      ...                  dims=['lat', 'lon'],
      ...                  coords={'lat': [1, 2], 'lon': [0, 1, 2]})
      >>> x
      <xarray.DataArray (lat: 2, lon: 3)>
      array([[0, 1, 2],
             [3, 4, 5]])
      Coordinates:
      * lat      (lat) int64 1 2
      * lon      (lon) int64 0 1 2

      >>> xr.zeros_like(x)
      <xarray.DataArray (lat: 2, lon: 3)>
      array([[0, 0, 0],
             [0, 0, 0]])
      Coordinates:
      * lat      (lat) int64 1 2
      * lon      (lon) int64 0 1 2

      >>> xr.zeros_like(x, dtype=np.float)
      <xarray.DataArray (lat: 2, lon: 3)>
      array([[0., 0., 0.],
             [0., 0., 0.]])
      Coordinates:
      * lat      (lat) int64 1 2
      * lon      (lon) int64 0 1 2

  See also

  `ones_like()`, `full_like()`