Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def df_splitter_by_gap(data, depth_key = 'MD'):
- #split dataframe well_data on subset
- data.reset_index(inplace = True)
- l = []
- for i in range(0, len(data)-1):
- if((np.array(data[depth_key][i+1:i+2])[0]- np.array(data[depth_key][i:i+1])[0])>1.2):
- l.append(i)
- l_mod = [0] + l + [len(data)]
- list_of_dfs_data = [data.iloc[l_mod[n]+1:l_mod[n+1]] for n in range(len(l_mod)-1)]
- #delete first old index column that occured on previous step
- for i in range(0, len(list_of_dfs_data)):
- cols = list_of_dfs_data[i].columns
- list_of_dfs_data[i] = list_of_dfs_data[i][cols[1:]]
- return(list_of_dfs_data)
- list_of_well_data = df_splitter_by_gap(well_data, 'MD')
- list_of_auto_ML_plot = df_splitter_by_gap(auto_ML_plot, 'MD')
- well = str(number)
- #bound
- max_depth = float(well_data['MD'][-1:])
- min_depth = float(well_data['MD'][0:1])
- #plot
- fig, axs = plt.subplots(1, 2, figsize=(4, 10))
- for p in range(0, len(list_of_well_data)):
- well_data_ = list_of_well_data[p]
- auto_ML_plot_ = list_of_auto_ML_plot[p]
- if(p == 0):
- axs[0].plot(well_data_[output], well_data_['MD'], c = 'blue', linewidth = 0.6, label = 'init')
- axs[0].plot(auto_ML_plot_[output], auto_ML_plot_['MD'], c ='green', linewidth = 0.6, label = 'auto ML')
- axs[0].legend(bbox_to_anchor=(-0.7, 0.5))
- else:
- axs[0].plot(well_data_[output], well_data_['MD'], c = 'blue', linewidth = 0.6)
- axs[0].plot(auto_ML_plot_[output], auto_ML_plot_['MD'], c ='green', linewidth = 0.6)
- axs[0].set_title(output)
- axs[0].set_ylim(min_depth, max_depth)
- axs[0].axes.get_xaxis().set_ticks([])
- axs[0].invert_yaxis()
- axs[1].plot(well_data_['DS'], well_data_['MD'], c = 'purple')
- axs[1].set_title('DS')
- axs[1].axvline(x=lavel, c = 'black', linewidth=1)
- axs[1].axes.get_yaxis().set_ticks([])
- axs[1].set_ylim(min_depth, max_depth)
- axs[1].axes.get_xaxis().set_ticks([])
- axs[1].invert_yaxis()
- plt.subplots_adjust(wspace=0, hspace=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement