返回

python-Xarray映射位置错误

发布时间:2022-06-04 23:39:11 316
# node.js

我尝试绘制一个 xarray DataArray 但图像的位置不寻常。我试图对坐标进行排序,但仍然无法正常工作。这里是审判。

# Here is sample dataset https://github.com/tuyenhavan/Course_Data/blob/main/MainlandSEA_sand.tif
import rioxarray 
import xarray as xr
# Read dataset
ds=rioxarray.open_rasterio(r"C:\Users\hava_tu\Downloads\MainlandSEA_sand.tif")
# Plot the first band
# ds[0].plot() # Throw errors indicating AttributeError: 'tuple' object has no attribute 'startswith'
# Test with sort y and x values 
ds["x"]=sorted(ds.x)
ds["y"]=sorted(ds.y)
# Plot it again
ds[0].plot()  # Throw errors again AttributeError: 'tuple' object has no attribute 'startswith'

 

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(1)
按点赞数排序
用户头像