python - 使用 MetPy 和 xarray 的 ValueError
问题描述
我正在尝试使用https://unidata.github.io/MetPy/latest/examples/Four_Panel_Map.html#sphx-glr-download-examples-four-panel-map-py中的一些脚本来制作天气图,但我发现运行此脚本的此问题:
Traceback (most recent call last):
File "C:/Users/fedec/PycharmProjects/met2/four-panel.py", line 46, in <module>
ds = xr.open_dataset(get_test_data('gfs_output.nc', False))
File "C:\Users\fedec\PycharmProjects\met2\venv\lib\site-packages\xarray\backends\api.py", line 480, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "C:\Users\fedec\PycharmProjects\met2\venv\lib\site-packages\xarray\backends\plugins.py", line 111, in guess_engine
raise ValueError(
ValueError: did not find a match in any of xarray's currently installed IO backends ['scipy', 'zarr']. Consider explicitly selecting one of the installed backends via the ``engine`` parameter to xarray.open_dataset(), or installing additional IO dependencies:
http://xarray.pydata.org/en/stable/getting-started-guide/installing.html
http://xarray.pydata.org/en/stable/user-guide/io.html
Process finished with exit code 1
我认为我的 xarray 有一些问题,所以我尝试升级我的 xarray 这样做: pip install "xarray[io]" pip install "xarray[complete]" 但我得到相同的 ValueError。Python 3.8 版有什么想法吗?提前致谢!费德
解决方案
该特定数据文件采用 netCDF-4 格式,zarr 或 scipy 都不支持。我很惊讶安装xarray[io]
或xarray[complete]
没有修复它。尝试手动做pip install netcdf4
.
(如果这不起作用,请在此处评论并使用新错误更新上面的回溯。)
推荐阅读
- javascript - Botframework/Botbuilder-js - 发送 HTTP 请求
- php - 从不同列的同一张表中获取 SQL 数据
- java - 在 Spring Boot 中获取 GET API 服务中的重复列表值
- python - 如何自动合并依赖机器人更新(配置版本 2)?
- sql - 由于 ENUM,无法使用脚本创建表
- wcf - 连接到 Web 服务时出现意外的 401 错误(可能与 kerberos \ double hop 错误有关)
- c# - C#,使用布尔值验证用户输入的字母和空格
- php - 显示加密的数据库字段
- assembly - 为什么汇编程序可以在高级语言中工作
- java - 如何使用 FCM 令牌向 Android 中的特定用户发送通知?