I am trying to use scipy.interpolate.interp1d
to plot longitude and latitude values to x-coordinate and y-coordinate pixels of a map image. I have sample values:
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]
when I pass to the function like this:
xInterpolation = interp1d(xDegree, xPixel)
yInterpolation = interp1d(yDegree, yPixel)
return (int(xInterpolation(lon)),int(yInterpolation(lat)))
I get value error:
ValueError("A value in x_new is above the interpolation " ValueError: A value in x_new is above the interpolation range.
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.