On Thursday, November 3, 2016 at 11:08:34 AM UTC+1, Heli wrote: > Hi, > > I have a question about data interpolation using python. I have a big ascii > file containg data in the following format and around 200M points. > > id, xcoordinate, ycoordinate, zcoordinate > > then I have a second file containing data in the following format, ( 2M > values) > > id, xcoordinate, ycoordinate, zcoordinate, value1, value2, value3,..., valueN > > I would need to get values for x,y,z coordinates of file 1 from values of > file2. > > I donĀ“t know whether my data in file1 and 2 is from structured or > unstructured grid source. I was wondering which interpolation module either > from scipy or scikit-learn you recommend me to use? > > I would also appreciate if you could recommend me some sample > example/reference. > > Thanks in Advance for your help,
Take a look at the scipy.spatial.KDTree class: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.spatial.KDTree.html Given your example, you would build the tree (using the coordinates) from the second file. Subsequently, you can use one of the query methods for every point in your first file. From this it is up to you how to transfer (interpolate) the values. Marco -- https://mail.python.org/mailman/listinfo/python-list