title: Interpolating a non-uniform surface
body: <p>I am trying to interpolate a non-uniform surface. By non-uniform, I mean that the input surface has large gaps in the data. I am trying to figure out a way to read this data in and ignore the areas where data is missing and just interpolate the areas where there is data. </p>
  
  <p>Here is an example of the data I am talking about:</p>
  
  <p><a href="https://i.stack.imgur.com/uhLFG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uhLFG.png" alt="This is a snippet of a bathymetric surface I am working with"></a></p>
  
  <p>This is a snippet of a bathymetric surface I am working with. I export this data with an x,y and z value for each point in the surface. As you can tell there is a large gap in the data missing that I want to ignore in the interpolation process. </p>
  
  <p>I use <code>np.genfromtxt</code> to read in the data, and it produces three arrays that contain the x,y, and z values. The problem is that the data is in a staggered format so the data does not contain empty values or NoData values. </p>
  
  <p>Here is my current interpolation method, I am using the <code>scipy griddata</code> package to do the interpolation:</p>
  
  <pre><code>x, y = np.mgrid[x1:xn:complex(numx+1,0), y1:yn:complex(numy+1,0)]
  points = (easting,northing)
  surface = griddata(points,depth,(x, y),fill_value='nan')
  </code></pre>
  
  <p>Here the <code>numx,numy</code> values are just the maximum x and y points in the surface, and <code>easting, northing</code> are the x,y points that are read in from the data. When I run the interpolation, I get something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/Fm9xL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fm9xL.png" alt="enter image description here"></a></p>
  
  <p>You can see that the interpolation is almost getting the nan fill correct. The outside portion of the array is correct, but it is still trying to interpolate the large gap in the middle of the surface. Efficiency is not the import to me right now, but is there a good way to interpolate the surface so it 'honors' the original surface better? So it doesn't try to interpolate areas that do not have values or some way to fill the areas with no values with nans?</p>