irregular grid in python interpolation

Solutions on MaxInterview for irregular grid in python interpolation by the best coders in the world

showing results for - "irregular grid in python interpolation"
Luciano
24 Jun 2016
1import numpy as np
2import matplotlib.mlab as mlab
3import matplotlib.tri as tri
4import pandas as pd
5
6data = pd.read_csv('sample.csv',delim_whitespace=True)
7data.columns = ['x','y']
8x = data['x']
9y = data['y']
10
11x = np.array(x)
12y = np.array(y)
13
14xi = np.linspace(-10.0,10.0,2500)
15yi = np.linspace(-10.0,10.0,2500)
16zi = mlab.griddata(x,y,z,xi,yi,interp='linear')
17
18X,Y = np.meshgrid(xi,yi)
19Z = zi
20
21h1 = np.min(Z)
22h2 = np.max(Z)
23
24plt.contourf(X,Y,Z,255,norm=plt.Normalize(h1,h2),cmap=plt.cm.jet)
25plt.show()