1

I use py2.7 with the free version of EPD for windows, I have a procedure that uses NetCDF4 to read data and I use basemap 1.0.5 from
http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/

when I plot my figure it works well few times at first then I get the following error message, the problem is resolved when I restart (close and open again) the EPD until it appears again. Could it be a bug in matplotlib? and how to solve the problem? Thank you

*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*
bmu
  • 35,119
  • 13
  • 91
  • 108
  • It says it's a memory error (that is, running out of space in memory), which explains why it happens inconsistently and can be fixed by restarting IDLE. How big is the data you are plotting? – David Robinson Dec 13 '12 at 17:39
  • It is a very large file, map of radar covering whole continent with 1km resolution. How can I free the memory after each plot? – majid fekri Dec 14 '12 at 14:53
  • I thought plt.clf() would clear the memory and solve the problem but it didn't – majid fekri Dec 14 '12 at 15:19

1 Answers1

0

You need to free up some memory (you're getting a MemoryError). You could do this by deleting any no longer needed variables and, if you've got figures that you no longer need, closing those with plt.close(figure) (close documentation can be found http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.close).

HTH

pelson
  • 21,252
  • 4
  • 92
  • 99