#author("2022-06-17T18:41:15+09:00","default:Miyashita","Miyashita")
#author("2022-06-17T18:41:34+09:00","default:Miyashita","Miyashita")
* 内挿 メモ [#c3362d0c]

** 1次元 [#j534b352]
1次元の場合は Interpolation パッケージでOK.
#codeprettify(lang-julia){{
using Interpolations

itp = interpolate((xorg, ), Vorg, Gridded(Linear()))
Vint = itp(xint)
}}
Interpolations.interpolate の第一引数はタプルになるらしい.


**2次元 [#rb17d06e]
不均一な点群から規則的な meshgrid へ内挿する方法を諸々試そうと思ってやってみたけどどれも微妙で,結局は scipy を呼ぶのが個人的に一番楽という結論に至った.
#codeprettify(lang-julia){{
using PyCall
scipyinterpolate = PyCall.pyimport("scipy.interpolate")
 Z_grid = scipyinterpolate.griddata(hcat(vec(LON),vec(LAT)), vec(Z), (lon_grid,lat_grid), method="cubic")

Z_grid = scipyinterpolate.griddata(hcat(vec(LON),vec(LAT)), vec(Z), (lon_grid,lat_grid), method="cubic")
}}
ここで LON, LAT, Z は元データ,lon_grid, lat_grid はデータを内挿したい座標データ.

Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes