title: Interpolate large irregular grid onto another irregular grid in Python
body: <p>I am trying to interpolate complex values from one irregular grid to another irregular grid using Python. The grids are in 2D and there are 103,113 data points. I am using Python 2.6.6, Scipy 0.7.2, Numpy 1.3.0, Matplotlib 0.99.3</p>
  
  <p>In Matlab using griddata this is achieved in roughly 5 seconds.</p>
  
  <pre><code>BnGRID2  = griddata(R_GRID1,Z_GRID1,BnGRID1,R_GRID2,Z_GRID2) (MATLAB)
  </code></pre>
  
  <p>(Note all arrays are 201 x 513)</p>
  
  <p>However, if I try using matplotlib.mlab.griddata I get a memoryError even if I try to work with the real part only:</p>
  
  <pre><code>mlab.griddata(R_GRID1.flatten(),Z_GRID1.flatten(),num.real(BnGRID1.flatten()),R_GRID2.flatten(),Z_GRID2.flatten())
  </code></pre>
  
  <p>If I try using interp2d I get a segmentation fault and Python exits:</p>
  
  <pre><code>a = interp.interp2d(R_GRID1,Z_GRID1,num.real(BnGRID1))
  </code></pre>
  
  <p>I have tried using KDTree and this seems to work ok, however, it takes a few minutes compared with the few seconds for Matlab, but I haven't explored this option too much yet.</p>
  
  <p>Was wondering if anyone has any ideas how I can get this done as quickly as Matlab seems to? I noticed that the newer version of Scipy also has griddata, does anyone know if this can handle large irregular grids?</p>