[GIS] Interpolating point data using scipy/python is not covering rectangular extent

interpolationpython-2.7rasterscipy.spatial

I am trying to write a python script with help of GDAL to a red point shapefile and considering a field value as z vales where I need interpolation to get raster with interpolated values. I am using scipy grid data for interpolation.

My interpolation code is:

zi = scipy.griddata((x, y), z, (xi, yi), method='cubic')

then I tried to write the interpolated data to raster and I got the following result as screen shot:
enter image description here

It shows interpolation inside points. But, I want to interpolate my points to cover the whole rectangular space.

Does anyone have idea how it works?

Best Answer

The function is interpolating only inside the convex hull of data points https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html.

Here smoothing results from scipy griddata interpolatioin is an example about how to add extrapolation but I do not understand why to do so because extrapolated values are meaningless. But if you want, I suppose you can also fool the algorithm easily by adding fake points to the corners of your area of interest.