首页 > 解决方案 > 使用 eccodes/grib 时如何解决此 AttributeError?

问题描述

我在 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 ccrs
d7 = xr.open_dataset('2007_BLH.grib', engine='cfgrib')

我已经下载了所有似乎需要的东西,包括 eccodes、pyeccodes、cfgrib。我该如何解决这个问题?

标签: pythongribcfgribeccodes

解决方案


使用包管理器安装 ecCodes 二进制文件,请参阅:https ://github.com/ecmwf/cfgrib#binary-dependencies 。


推荐阅读