我在macOS上使用cfgrib,当我尝试将一个grib文件隐藏到xarray中时,我得到了以下错误:
AttributeError: module 'pyeccodes.compat' has no attribute 'codes_grib_multi_support_off'以下是我到目前为止拥有的代码:
import xarray as xr
import matplotlib.pyplot as plt
import matplotlib.style as sty
sty.use('classic')
import numpy as np
import cartopy.crs as ccrsd7 = xr.open_dataset('2007_BLH.grib', engine='cfgrib')我已经下载了所有需要的东西,包括eccodes,pyeccodes,cfgrib。如何解决此问题?
发布于 2020-09-06 03:05:17
使用包管理器安装ecCodes二进制文件,请参阅:https://github.com/ecmwf/cfgrib#binary-dependencies。
发布于 2020-07-30 05:20:20
我在使用Anaconda3的Windows10机器上也遇到了同样的错误,但希望我的解决方案能有所帮助。
我认为问题是我在cfgrib之前安装了metpy。似乎metpy设置了一些与cfgrib冲突的包,因为在经过多次试验和错误之后,我创建了一个全新的虚拟python环境,并通过以下方式解决了这个问题:
conda安装-n new_env cfgrib //将软件包安装到我的新虚拟环境中
在环境变量中设置eccodes定义路径...
变量名: ECCODES_DEFINITION_PATH变量值: C:\Users\path\to\eccodes\definitions
我想这看起来会像你MacOS上的ECCODES_DEFINITION_PATH=./path/to/eccodes/definitions。
https://stackoverflow.com/questions/63044813
复制相似问题