I know how to replace values based on a condition like here using .where
but I would like to know how to replace all values in an xarray with a number.
Thanks in advance
I know how to replace values based on a condition like here using .where
but I would like to know how to replace all values in an xarray with a number.
Thanks in advance
It might be more straight forward to use the following code:
a = xr.DataArray(np.arange(16).reshape(4, 4), dims=['x', 'y'])
c = a.where(a == 5, other=5)