Hi all,

I am very new to Python. I want to use the functionality within NumPy and SciPy to do a nearest neighbour interpolation for multi-variable data I have.

1. I have a text file (points.dat) in each line I have a sample for (x1, x2, x3,..., x14). The number of line is 1600. So I have 1600 sample with 14 variables.

2. I have a text file(value.dat) in each line I have only one value corresponding to the sample in that line.

3. I want to use Nearest neighbor Interpolation of Scipy to make interpolation for a new sample . This sample however is saved in another text file (TestSample.txt) but it is column-wise. it means that in line 1 I have only x1, in line 2 I have only x2,... to x14.

Can you please help to write some lines of codes to use NumpY loadtxt and Scipy interpolate.NearestNDinterpolator to import the data, and build the interpolant, and make use of scipy.spatial.cKDTree to test with a new sample for obtaining the value of interpolation?

I have written some codes but I have problem with data dimensions and etc.

Thank you.