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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With