2016-09-27 129 views
0

scipy.interpolate.interp1dを使用して、地図画像のx座標とy座標のピクセルに経度と緯度の値をプロットしようとしています。私は、サンプルの値が設定されていますPython scipy.interpolate.interp1dが大きなfloat値で動作しない

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.

は、どんなに私がしようとどのような値は、値をスローしませんエラー、私は入力リストにある同じ緯度または経度値を与えようとしましたが、どちらもうまくいきませんでした。誰がここで何が起こっているのか知っていますか?または、私が間違った補間を使用している場合。

答えて

1

docsinterp1dから:

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.

だから、あなたのいくつかは、データが上記補間バウンドで補間しました。内挿さずに外挿することを試みています。あなたは

xInterpolation = interp1d(xDegree, xPixel) xInterpolation(lon)

のような補間を使用する場合

lonからのすべての値が区間[xDegree.min, xDegree.max]に属している必要があります。

補間のためにデータを修正するか、extrapolationを使用する必要があります。

+0

いいえ、補間境界を超えていません。私はそれを二重にチェックし、この情報を質問にも述べました。 – Omayr

+0

@Omayrまあ、あなたの質問からすべての配列のサンプルを与えることができますか? – ShabashP

関連する問題