使用xr.open_mfdataset时报错Process finished with exit code -1073741571 (0xC00000FD)

问题报错

当想要使用xr.open_mfdataset读取多个nc文件时,输入

files = '...\\201901-201906\\*.nc'
dataset_AVISO = xr.open_mfdataset(files,parallel=True)

运行后出现报错:

Process finished with exit code -1073741571 (0xC00000FD)

问题分析

debug后,出现报错:

D:\app\python\python310\lib\site-packages\xarray\backends\plugins.py:110: RuntimeWarning: 'netcdf4' fails while guessing
  warnings.warn(f"{engine!r} fails while guessing", RuntimeWarning)
D:\app\python\python310\lib\site-packages\xarray\backends\plugins.py:110: RuntimeWarning: 'scipy' fails while guessing
  warnings.warn(f"{engine!r} fails while guessing", RuntimeWarning)
D:\app\python\python310\lib\site-packages\xarray\backends\plugins.py:119: RuntimeWarning: 'netcdf4' fails while guessing
  warnings.warn(f"{engine!r} fails while guessing", RuntimeWarning)
D:\app\python\python310\lib\site-packages\xarray\backends\plugins.py:119: RuntimeWarning: 'h5netcdf' fails while guessing
  warnings.warn(f"{engine!r} fails while guessing", RuntimeWarning)
D:\app\python\python310\lib\site-packages\xarray\backends\plugins.py:119: RuntimeWarning: 'scipy' fails while guessing
  warnings.warn(f"{engine!r} fails while guessing", RuntimeWarning)
Traceback (most recent call last):
  File "D:\app\python\python310\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "D:\app\python\python310\lib\site-packages\xarray\backends\api.py", line 479, in open_dataset
    engine = plugins.guess_engine(filename_or_obj)
  File "D:\app\python\python310\lib\site-packages\xarray\backends\plugins.py", line 148, in guess_engine
    raise ValueError(error_msg)
ValueError: did not find a match in any of xarray's currently installed IO backends ['netcdf4', '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

Process finished with exit code -1073741819 (0xC0000005)

从报错可知出错原因在于: did not find a match in any of xarray’s currently installed IO backends [‘netcdf4’, ‘scipy’]. Consider explicitly selecting one of the installed engines via the engine parameter, or installing additional IO dependencies
但是博主已经安装了netcdf4和scipy两个库,在看到网友分享的方案后,改成

dataset_AVISO = xr.open_mfdataset(files,engine='netcdf4')

仍然不成功。

解决方法

在一番尝试后,最后发现只要修改成这样,代码即可运行成功:

dataset_AVISO = xr.open_mfdataset(files)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值