使用Xarray掩盖。在哪里引发“ dimension”; y y'是不相等的
我正在尝试使用另一个栅格掩盖栅格。两个栅格都有相同的尺寸,但是当我施加掩码时,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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于在网上缺乏有用的答案,我在相同的问题上挣扎了几个小时。
此行:
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!