我知道如何根据 here 这样的条件替换值使用 .where
但我想知道如何用数字替换 xarray 中的所有值。
提前致谢
最佳答案
使用下面的代码可能更直接:
a = xr.DataArray(np.arange(16).reshape(4, 4), dims=['x', 'y'])
c = a.where(a == 5, other=5)
关于python - 如何在 Python 中用常量(比如 5)替换 xarray 的所有值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58640323/