使用Xarray掩盖。在哪里引发“ dimension”; y y'是不相等的

发布于 2025-01-27 01:20:19 字数 305 浏览 3 评论 0原文

我正在尝试使用另一个栅格掩盖栅格。两个栅格都有相同的尺寸,但是当我施加掩码时,xarraydata。抛出误差

f[0].where(mask,other=np.nan)

值:沿尺寸'y'''索引'''

'href = href =“ https://i.sstatic.net/ufbvs.png” “ nofollow noreferrer”> “

I am trying to mask a raster using another raster. Both rasters have same dimensions, but when i apply the mask the xarraydata.where throws error

f[0].where(mask,other=np.nan)

ValueError: indexes along dimension 'y' are not equal

mask

2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

メ斷腸人バ 2025-02-03 01:20:19

由于在网上缺乏有用的答案,我在相同的问题上挣扎了几个小时。

此行:

self.file [var] = self.file [var] .where(self.not_rectangle,shots = val)

给出了与您的错误相似的错误:

沿dimension'lsmlat' '不是等于

我通过在我的self.retectangle的定义中添加扩展名.data 解决了它:

self.Rectangle = self.__landmask_file.landmask_file.landmask_diff.data

我希望这会有所帮助!

I struggled with the same problem for a few hours due to a lack of helpful answers online.

This line:

self.file[var] = self.file[var].where(self.not_rectangle, other=val)

was giving an error similar to yours:

indexes along dimension 'lsmlat' are not equal

I solved it by adding the extension .data in my definition of self.rectangle:

self.rectangle = self._landmask_file.landmask_diff.data

I hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文