问题
longtime programmer but new to python and metpy. I'm trying to learn by following the examples on the unidata site and youtube (metpy mondays)
I'm trying to follow along with building a simple skew-t lesson and running into an issue. When I try to use imports like so:
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
I get this error:
---------------------------------------------------------------------------
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
I haven't had any issue with this import before so wondering what is going on here? Is there some inconsistency between the packages in my environment, or is there something I'm missing? I have tried updating everything to make sure I'm not using anything old.
For reference I am using conda version 4.8.3 with python 3.7.7 and metpy 0.12.1. Let me know if I need to provide any other information that may be helpful.
Thanks in advance for any help/insight!
回答1:
So that problem is caused by CartoPy 0.18. We're working on releasing a 0.12.2 version of MetPy to fix this. For now the best work-around is to roll CartoPy back to 0.17.
来源:https://stackoverflow.com/questions/61906331/ctables-undefined-when-importing-from-metpy-plots