我試圖使用scipy.interpolate.interp1d
將經度和緯度值繪製爲地圖圖像的x座標和y座標像素。我有樣本值:Python scipy.interpolate.interp1d不適用於大浮點值
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]
當我通過像這樣的功能:
xInterpolation = interp1d(xDegree, xPixel)
yInterpolation = interp1d(yDegree, yPixel)
return (int(xInterpolation(lon)),int(yInterpolation(lat)))
我得到的值錯誤:
ValueError("A value in x_new is above the interpolation " ValueError: A value in x_new is above the interpolation range.
不管我什麼價值,它拋出價值錯誤,我甚至嘗試給出輸入列表中相同的緯度或經度值,但這也不起作用。有人知道這裏發生了什麼嗎?或者如果我使用錯誤的插值。
不,它不在插值範圍之上。我已經仔細檢查過,並在問題中提到了這條信息。 – Omayr
@Omayr那麼,你可以給你的問題提供所有陣列的樣本嗎? – ShabashP