SciPy的公司的GridData似乎能够处理的数据集这种规模的没有问题:
import numpy as np
import scipy.interpolate
# old grid
x, y = np.mgrid[0:1:201j, 0:1:513j]
z = np.sin(x*20) * (1j + np.cos(y*3))**2 # some data
# new grid
x2, y2 = np.mgrid[0.1:0.9:201j, 0.1:0.9:513j]
# interpolate onto the new grid
z2 = scipy.interpolate.griddata((x.ravel(), y.ravel()), z.ravel(), (x2, y2), method='cubic')
的一步的GridData大约需要一个旧的AMD Athlon 5秒。
如果你的数据在一个网格(即对应于z值[I,J]为(x [I],Y [j])坐标),您可以通过使用scipy.interpolate.RectBivariateSpline 获得更快的速度
z3 = (scipy.interpolate.RectBivariateSpline(x[:,0], y[0,:], z.real)(x2[:,0], y2[0,:])
+ 1j*scipy.interpolate.RectBivariateSpline(x[:,0], y[0,:], z.imag)(x2[:,0], y2[0,:]))
需要0.05s。这要快得多,因为即使网格间距不规则,只要网格是矩形的,就可以使用更高效的算法。