title: Unexpected memory error when regriding data with scipy interpolate griddata method
body: <p>I have a <code>3000x6000</code> 2D grid (from a tiff image). I want to regrid it into a lower resolution grid using <code>griddata</code> method from <code>scipy.interpolate</code> library. First, I need to form a <code>18000000x2</code> <code>numpy array</code> as the input for <code>griddata</code> based on what I read <a href="http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html" rel="nofollow noreferrer">here</a>. Here's what I do:</p>
  
  <pre><code>import numpy as np
  from scipy.interpolate import griddata
  x_length = 6000
  y_length = 3000
  def func(x, y):
      return x*(1-x)*np.cos(4*np.pi*x) * np.sin(4*np.pi*y**2)**2
  grid_x, grid_y = np.meshgrid(np.linspace(0,1,x_length),np.linspace(0,1,y_length))
  points = np.random.rand(x_length*y_length, 2)
  values = func(points[:,0], points[:,1])
  grid_z0 = griddata(points, values, (grid_x, grid_y), method='nearest')
  </code></pre>
  
  <p>I get a <code>MemoryError</code> when doing <code>griddata</code>. I have 8 gb of RAM and I shouldn't get this error based on the first answer to <a href="https://stackoverflow.com/questions/19085012/numpy-memory-error-creating-huge-matrix">this question</a>.</p>
  
  <p>Overall, regriding a <code>3000x6000</code> grid into a lower resolution grid shouldn't be that hard and I guess I am doing something funny here. Should I get e <code>MemoryError</code> doing these liens of codes with 8 gb RAM? </p>
  
  <p>P.S: Although I have a <code>64-bit</code> operating system (Windows 7), I use the following Python version:</p>
  
  <pre><code>Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
  </code></pre>