问题:
使用xarray库open_dataset函数读取tif图片的时候,报如下错误:
Traceback (most recent call last):
File "d:\test\分离波段.py", line 4, in <module>
datas = xr.open_dataset('D:/test/456.tif')
File "C:\Anaconda3\lib\site-packages\xarray\backends\api.py", line 525, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "C:\Anaconda3\lib\site-packages\xarray\backends\plugins.py", line 177, in guess_engine
raise ValueError(error_msg)
ValueError: did not find a match in any of xarray's currently installed IO backends ['scipy']. Consider explicitly selecting one of the installed engines via the ``engine`` parameter, or installing additional IO dependencies, see:
https://docs.xarray.dev/en/stable/getting-started-guide/installing.html
https://docs.xarray.dev/en/stable/user-guide/io.html
分析:
根据报错我们是缺少相关匹配的包
问题解决:
根据报错的提示,我们访问报错信息中的第一个网址:
https://docs.xarray.dev/en/stable/getting-started-guide/installing.html
找到IO需要的scipy,并点进去
点击红框中的get started
点击pip
按照红框中的命令进行安装