如何修复 cfgrib TypeError: open_dataset() got an unexpected keyword argument 'filter_by_keys'
问题:
你想使用类似这样的代码通过 cfgrib 库打开 GRB2 文件
example-3.py
ds = xr.open_dataset('myfile.grb2', engine='cfgrib', filter_by_keys={'typeOfLevel': 'atmosphere'})但你看到类似这样的异常
example-2.txt
解决方案
你不能直接使用 filter_by_keys=… 作为 xr.open_dataset() 的参数。你需要像这样使用 backend_kwargs:
example-1.txt
Check out similar posts by category:
Data Science, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow