Python scipy.interpolate.interp1d not working with large float values
<p>I am trying to use <code>scipy.interpolate.interp1d</code>to plot longitude and latitude values to x-coordinate and y-coordinate pixels of a map image. I have sample values:</p>

<pre><code>y = [0, 256, 512, 768, 1024, 1280, 1536] 
lat = [615436414755, 615226949459, 615017342897, 614807595000, 614597705702, 614387674936, 614177502635] 
x = [0, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304] 
lon = [235986328125, 236425781250, 236865234375, 237304687500, 237744140625, 238183593750, 238623046875, 239062500000, 239501953125, 239941406250]
</code></pre>

<p>when I pass to the function like this:</p>

<pre><code>xInterpolation = interp1d(xDegree, xPixel)
    yInterpolation = interp1d(yDegree, yPixel)

    return (int(xInterpolation(lon)),int(yInterpolation(lat)))
</code></pre>

<p>I get value error:</p>

<blockquote>
  <p>ValueError("A value in x_new is above the interpolation " ValueError: A value in x_new is above the interpolation range.</p>
</blockquote>

<p>No matter what value I try, it throws value error, I have even tried giving the same lat or lon values that are in the input list but that didn't work either. Does anybody know whats happening here? Or if I am using the wrong Interpolation. </p>

<p>From <code>interp1d</code> <a href="http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.interpolate.interp1d.html" rel="nofollow">docs</a>:</p>

<blockquote>
  <p>bounds_error : bool, optional If True, a ValueError is raised any time
  interpolation is attempted on a value outside of the range of x (where
  extrapolation is necessary). If False, out of bounds values are
  assigned fill_value. By default, an error is raised.</p>
</blockquote>

<p>So, some of yours interpolated data is above interpolation bound. You are trying to extrapolate, not interpolate. </p>

<p>When you use interpolation like </p>

<p><code>xInterpolation = interp1d(xDegree, xPixel)
 xInterpolation(lon)</code></p>

<p>all values from <code>lon</code> must belong to the interval <code>[xDegree.min, xDegree.max]</code>.</p>

<p>So, you need to correct your data for interpolation or use <a href="http://stackoverflow.com/questions/2745329/how-to-make-scipy-interpolate-give-an-extrapolated-result-beyond-the-input-range">extrapolation</a>.</p>

python scipy interpolation