Search code examples
geometryscipygeospatialinterpolation

Will scipy.interpolate.griddata correctly interpolate values for longitude and latitude float coordinates?


Lets say, I have 3 np.arrays of float values in Python: latitudes, longitudes and values. I want to interpolate some values for coordinates that are not in the latitude and longitude arrays. I can use scipy.interpolate.griddata for that and it works just fine.

However I recently started to wonder if interpolate works as I expected it to: Because it does not know the difference between an euclidean grid and the spherical nature of a latitude and longitude grid, it may calculate the interpolated values wrong, at least for the linear. (Because the distance between 2 coordinates at the poles maybe vastly different than the distance between two coordinates at the equator.)

I did take look at the documentation that can be found at the scipy site but did not find information about the handling of not-equidistant transformations.

Is the differnce between the spherical and equidistant nature of the coordinates a problem for scipy.interpolate.griddata, or is it irrelevant?


Solution

  • griddata assumes Euclidean distance measure, so you have the usual sphere-to-plane map projection problems.

    Scipy 0.11.0 has tools for interpolation of data on a sphere: http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RectSphereBivariateSpline.html

    This works for rectilinear lat/lon grids.