def resample_2d(array, sample_pts, query_pts):
''' Resamples 2D array to be sampled along queried points.
Args:
array (numpy.ndarray): 2D array.
sample_pts (tuple): pair of numpy.ndarray objects that contain the x and y sample locations,
each array should be 1D.
query_pts (tuple): points to interpolate onto, also 1D for each array.
Returns:
numpy.ndarray. array resampled onto query_pts via bivariate spline.
'''
xq, yq = np.meshgrid(*query_pts)
interpf = interpolate.RectBivariateSpline(*sample_pts, array)
return interpf.ev(yq, xq)
评论列表
文章目录