Advertisement
boolit

well pad

Jul 29th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.01 KB | None | 0 0
  1. def df_splitter_by_gap(data, depth_key = 'MD'):
  2.     #split dataframe well_data on subset
  3.     data.reset_index(inplace = True)
  4.     l = []
  5.     for i in range(0, len(data)-1):
  6.         if((np.array(data[depth_key][i+1:i+2])[0]- np.array(data[depth_key][i:i+1])[0])>1.2):
  7.             l.append(i)
  8.     l_mod = [0] + l + [len(data)]
  9.     list_of_dfs_data = [data.iloc[l_mod[n]+1:l_mod[n+1]] for n in range(len(l_mod)-1)]
  10.  
  11.     #delete first old index column that occured on previous step
  12.     for i in range(0, len(list_of_dfs_data)):
  13.         cols = list_of_dfs_data[i].columns
  14.         list_of_dfs_data[i] = list_of_dfs_data[i][cols[1:]]
  15.     return(list_of_dfs_data)
  16.  
  17. list_of_well_data = df_splitter_by_gap(well_data, 'MD')
  18. list_of_auto_ML_plot = df_splitter_by_gap(auto_ML_plot, 'MD')
  19.  
  20. well = str(number)
  21. #bound
  22. max_depth = float(well_data['MD'][-1:])
  23. min_depth = float(well_data['MD'][0:1])
  24. #plot
  25. fig, axs = plt.subplots(1, 2, figsize=(4, 10))
  26. for p in range(0, len(list_of_well_data)):
  27.     well_data_ = list_of_well_data[p]
  28.     auto_ML_plot_ = list_of_auto_ML_plot[p]
  29.     if(p == 0):
  30.         axs[0].plot(well_data_[output], well_data_['MD'], c = 'blue', linewidth = 0.6, label = 'init')
  31.         axs[0].plot(auto_ML_plot_[output], auto_ML_plot_['MD'], c ='green', linewidth = 0.6, label = 'auto ML')
  32.         axs[0].legend(bbox_to_anchor=(-0.7, 0.5))
  33.     else:
  34.         axs[0].plot(well_data_[output], well_data_['MD'], c = 'blue', linewidth = 0.6)
  35.         axs[0].plot(auto_ML_plot_[output], auto_ML_plot_['MD'], c ='green', linewidth = 0.6)
  36.     axs[0].set_title(output)
  37.     axs[0].set_ylim(min_depth, max_depth)
  38.     axs[0].axes.get_xaxis().set_ticks([])
  39.     axs[0].invert_yaxis()
  40.    
  41.     axs[1].plot(well_data_['DS'], well_data_['MD'], c = 'purple')
  42.     axs[1].set_title('DS')
  43.     axs[1].axvline(x=lavel, c = 'black', linewidth=1)
  44.     axs[1].axes.get_yaxis().set_ticks([])
  45.     axs[1].set_ylim(min_depth, max_depth)
  46.     axs[1].axes.get_xaxis().set_ticks([])
  47.     axs[1].invert_yaxis()
  48. plt.subplots_adjust(wspace=0, hspace=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement