Python的matplotlib / basemap错误消息

时间:2012-12-11 20:39:55

标签: python matplotlib matplotlib-basemap epd-python

我使用py2.7和免费版的EPD for windows,我有一个使用NetCDF4来读取数据的程序,我使用了底图1.0.5从中 http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/

当我绘制我的数字时,它首先运行几次然后我得到以下错误消息,当我重新启动(关闭并再次打开)EPD直到它再次出现时问题得到解决。它可能是matplotlib中的一个错误吗?以及如何解决这个问题? 谢谢

*In [9]: Traceback (most recent call last):
  File "C:\Python27\EPD\lib\site-packages\wx\_misc.py", line 1342, in Notify
    self.notify()
  File "C:\Python27\EPD\lib\site-packages\wx\_core.py", line 14720, in Notify
    self.result = self.callable(*self.args, **self.kwargs)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\backends\backend_wx.py", li
ne 990, in _onDrawIdle
    self.draw(*args, **kwargs)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\backends\backend_wxagg.py",
 line 59, in draw
    FigureCanvasAgg.draw(self)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\backends\backend_agg.py", l
ine 401, in draw
    self.figure.draw(self.renderer)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\artist.py", line 55, in dra
w_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\figure.py", line 884, in dr
aw
    func(*args)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\artist.py", line 55, in dra
w_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\axes.py", line 1983, in dra
w
    a.draw(renderer)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\artist.py", line 55, in dra
w_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\image.py", line 355, in dra
w
    im = self.make_image(renderer.get_image_magnification())
  File "C:\Python27\EPD\lib\site-packages\matplotlib\image.py", line 575, in mak
e_image
    transformed_viewLim)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\image.py", line 202, in _ge
t_unsampled_image
    x = self.to_rgba(self._A, self._alpha, bytes=True)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\cm.py", line 213, in to_rgb
a
    x = self.norm(x)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\colors.py", line 845, in __
call__
    result, is_scalar = self.process_value(value)
  File "C:\Python27\EPD\lib\site-packages\matplotlib\colors.py", line 835, in pr
ocess_value
    result = result.astype(np.float32)
  File "C:\Python27\EPD\lib\site-packages\numpy\ma\core.py", line 2908, in astyp
e
    output = self._data.astype(newtype).view(type(self))
MemoryError
If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True*

1 个答案:

答案 0 :(得分:0)

你需要释放一些内存(你得到一个MemoryError)。您可以通过del执行任何不再需要的变量,如果您有不再需要的数据,请使用plt.close(figure)关闭那些(可以找到关闭文档http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.close

HTH