leouieda/fatiando — pull request #44 by leouieda (2013-08-13 17:11:44+00:00)
Title: Extrapolation when gridding data and better interpolators

A problem we had with grid interpolation was that the `matplotlib.mlab.griddata` function that was used didn't extrapolate the data outside of the convex hull of the data points. This is good because extrapolated data is usually meaningless and misleading. But this is bad because it looks bad on plots and sometimes you want extrapolated data.

Also, the nearest neighbors algorithm used by `matplotlib.mlab.griddata` is not very good. A better option is `scipy.interpolate.griddata` which has a cubic interpolation.

So I've added support for scipy `griddata` by default. You can still use the nearest neighbors of matplotlib by setting `algorithm='nn'`.

There is also an `extrapolate` option (True by default) that extrapolates the data using the `nearest` method of scipy `griddata` (takes the value of the closest data point).

![interpolation](https://f.cloud.github.com/assets/290082/956324/4b4f927c-043b-11e3-8066-bd2d003b1cb9.png)