Resampling irregularly spaced data to a regular grid in Python
问题 I need to resample 2D-data to a regular grid. This is what my code looks like: import matplotlib.mlab as ml import numpy as np y = np.zeros((512,115)) x = np.zeros((512,115)) # Just random data for this test: data = np.random.randn(512,115) # filling the grid coordinates: for i in range(512): y[i,:]=np.arange(380,380+4*115,4) for i in range(115): x[:,i] = np.linspace(-8,8,512) y[:,i] -= np.linspace(-0.1,0.2,512) # Defining the regular grid y_i = np.arange(380,380+4*115,4) x_i = np.linspace(-8