Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy
- import numpy as np
- import scipy as sp
- import matplotlib.pyplot as plt
- from scipy.interpolate import interp1d
- data = numpy.loadtxt('24march2015.txt')
- pres = data[:,0]
- temp = data[:,2]
- points = zip(pres, temp)
- points = sorted(points, key=lambda point: point[0])
- pres, temp= zip(*points)
- xnew = data[:,0]
- ynew = sp.interpolate.interp1d(pres, temp, kind= 'linear')(xnew)
- print(ynew)
- plt.plot(pres, temp, 'o', label = 'Original_data')
- plt.plot(xnew, ynew, '-', label = 'Interpolated_data')
- plt.legend()
- plt.legend(loc='4')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement