title: Scipy griddata interpolation results in lots on NaNs
body: <p>I'm trying to interpolate a sparse matrix to fill the 0 values. I'm using numpy <code>griddata</code> function starting from the example available <a href="https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.interpolate.griddata.html" rel="nofollow noreferrer">here</a>. Just as a reference, the data I'm starting from has the shape of a 1 channel image and looks like this (roughly 1 data point every 4x4):
  <a href="https://i.stack.imgur.com/1T7FK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1T7FK.png" alt="sparse data"></a></p>
  
  <p>The code that should do the interpolation is this:</p>
  
  <pre><code># a contains the data
  grid_y, grid_x = np.mgrid[0:128:1, 0:384:1]
  points = []
  for z in zip(a.nonzero()[0],a.nonzero()[1]):
      points.append(np.array(z))
  
  values = [a[x] for x in zip(a.nonzero()[0],a.nonzero()[1])]
  
  interp = griddata(points, values, (grid_x, grid_y), method='cubic')
  </code></pre>
  
  <p>But for some reason, this is the result of the interpolation:
  <a href="https://i.stack.imgur.com/T4KZb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T4KZb.png" alt="results"></a>
  Where the white parts in the image are actually NaNs. From my understanding of the example, I really can't figure out what I'm doing wrong. Any ideas?</p>
  
  <p>Thanks!</p>