999ms

Untitled

Feb 26th, 2021 (edited)
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. import csv
  2. import pandas as pd
  3. import numpy as np
  4.  
  5. from scipy.interpolate import Rbf
  6.  
  7. import matplotlib
  8. import matplotlib.pyplot as plt
  9. from matplotlib import cm
  10.  
  11. filename = 'Training_wells.csv'
  12. data = pd.read_csv(filename, sep=',',header=None, names=['Well','X','Y','NTG'])
  13. data = data.apply(pd.to_numeric, errors='coerce')
  14. data = data[1:]
  15.  
  16. filename = 'Empty_part.csv'
  17. data_test = pd.read_csv(filename, sep=',',header=None, names=['Well','X','Y'])
  18. data_test = data_test.apply(pd.to_numeric, errors='coerce')
  19. data_test = data_test[1:]
  20.  
  21. # 2-d tests - setup scattered data
  22. x = list(data.X)
  23. y = list(data.Y)
  24. z = list(data.NTG)
  25.  
  26. if True:
  27. avg = sum(z) / len(z)
  28.  
  29. x.append(250)
  30. y.append(900)
  31. z.append(0.45)
  32.  
  33. x.append(250)
  34. y.append(932)
  35. z.append(avg)
  36.  
  37. x.append(250)
  38. y.append(920)
  39. z.append(0.35)
  40.  
  41.  
  42. x.append(250)
  43. y.append(923)
  44. z.append(0.35)
  45.  
  46. x.append(235)
  47. y.append(932)
  48. z.append(avg)
  49.  
  50. x.append(212)
  51. y.append(906)
  52. z.append(0.20)
  53.  
  54. x.append(240)
  55. y.append(905)
  56. z.append(0.35)
  57.  
  58.  
  59. ti = np.linspace(200, 250, 101)
  60. XI, YI = np.meshgrid(np.linspace(200, 250, 101), np.linspace(900, 950, 101))
  61.  
  62. # use RBF
  63. rbf = Rbf(x, y, z, epsilon=2)
  64. ZI = rbf(XI, YI)
  65.  
  66. # plot the result
  67. fig, axes = plt.subplots(nrows = 1, ncols = 1)
  68. fig.set_size_inches(13.5, 7.5)
  69. plt.subplot(1, 1, 1)
  70. plt.pcolor(XI, YI, ZI, cmap=cm.jet, shading='auto')
  71. plt.scatter(x, y, 100, np.asarray(z), cmap=cm.jet, edgecolors = 'black')
  72. plt.xlim(200, 250)
  73. plt.ylim(900, 932)
  74. plt.colorbar()
  75.  
  76. plt.grid(True)
  77. plt.show()
Add Comment
Please, Sign In to add comment