I would like to interpolate 2D array "test" whose dimensions are 4x4 (just as example, in reality close to 1000x1000) with a grid of shape 8x8.
import numpy as np
X = np.arange(0,4,1)
Y = np.arange(0,4,1)
points = np.vstack((X,Y))
points = points.T #my coordinates
#my values as a 2D array
test = np.array([[ 1.2514318 , 1.25145821, 1.25148472, 1.25151133],
[ 1.25087456, 1.25090105, 1.25092764, 1.25095435],
[ 1.25031581, 1.25034238, 1.25036907, 1.25039586],
[ 1.24975557, 1.24978222, 1.24980898, 1.24983587]])
I try with griddata but it seems work only 1D isnt it? as the errors tells me i have "different number of values and points" Do i make a mistake?
from scipy.interpolate import griddata
grid_x, grid_y = np.mgrid[0:4:8j, 0:4:8j]
grid_z0 = griddata(points, test, (grid_x, grid_y), method='linear')