python - 从 metpy.plots 导入时 cTables 未定义?

标签 python metpy

资深程序员,但对 python 和 metpy 很陌生。我正在尝试按照 unidata 网站和 youtube 上的示例进行学习(metpy 星期一)

我正在尝试构建一个简单的 skew-t 类(class)并遇到一个问题。当我尝试像这样使用导入时:

from datetime import datetime
from siphon.simplewebservice.wyoming import WyomingUpperAir
from metpy.units import units
import matplotlib.pyplot as plt
import metpy.plots as plots

%matplotlib inline

我收到此错误:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-afb9be7497de> in <module>
      3 from metpy.units import units
      4 import matplotlib.pyplot as plt
----> 5 import metpy.plots as plots
      6 
      7 get_ipython().run_line_magic('matplotlib', 'inline')

C:\Miniconda_Python\envs\unidata\lib\site-packages\metpy\plots\__init__.py in <module>
     17 logger = logging.getLogger(__name__)
     18 
---> 19 __all__ = ctables.__all__[:]  # pylint: disable=undefined-variable
     20 __all__.extend(declarative.__all__)  # pylint: disable=undefined-variable
     21 __all__.extend(skewt.__all__)  # pylint: disable=undefined-variable

NameError: name 'ctables' is not defined

我之前没有遇到过此导入的任何问题,所以想知道这里发生了什么?我的环境中的软件包之间是否存在不一致,或者是否缺少某些内容?我已尝试更新所有内容以确保我没有使用任何旧内容。

作为引用,我使用 conda 版本 4.8.3 和 python 3.7.7 和 metpy 0.12.1。如果我需要提供任何其他可能有帮助的信息,请告诉我。

预先感谢您的任何帮助/见解!

最佳答案

所以这个问题是由 CartoPy 0.18 引起的。我们正在努力发布 0.12.2 版本的 MetPy 来解决这个问题。目前最好的解决方法是将 CartoPy 回滚到 0.17。

关于python - 从 metpy.plots 导入时 cTables 未定义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61906331/

相关文章:

python - 如何在 Django 中调试 'Not all temporary messages could be stored' 值错误?

python - 使用 os.walk() 循环文件并打开它们

python - 使用 Cartopy 插入城市地区的温度数据

matplotlib - metpy:有飓风标记吗?

python - Pytest cov 不生成任何报告

python - 如何使用带有 -l 或 --no input 等选项的 call_command 以编程方式调用 collectstatic 管理命令

python - 确定数据框中元素的位置

python - 计算温度的偏导数(温度的水平平流)

python - AttributeError: 'numpy.ndarray' 对象没有属性 'units'