From 49e29a64ff6403e793db26f938a02584a69c47e7 Mon Sep 17 00:00:00 2001 From: AlexanderJuestel Date: Sat, 8 Jun 2024 21:22:19 +0200 Subject: [PATCH] EditingColumnName --- pyborehole/plot.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/pyborehole/plot.py b/pyborehole/plot.py index 79c1e08..21abc36 100644 --- a/pyborehole/plot.py +++ b/pyborehole/plot.py @@ -145,6 +145,16 @@ def plot_well_logs(logs, if len(tracks) == 1: tracks = tracks[0] + # Adding N/G if add_net_to_gross is provided + if add_net_to_gross: + if 'N/G' not in df.columns: + raise ValueError('Net to gross has not been calculated yet') + + net_to_gross = df['N/G'] + + # Selecting tracks + df = df[tracks + [depth_column]].reset_index() + # Selecting tracks if tracks are provided as a list of string elif isinstance(tracks, list): @@ -261,7 +271,7 @@ def plot_well_logs(logs, # Setting x label ax[j + k].set_xlabel(tracks + ' [%s]' % - logs.curves[logs.curves['original_mnemonic'] == tracks].reset_index(drop=True)[ + logs.curves[logs.curves['mnemonic'] == tracks].reset_index(drop=True)[ 'unit'].iloc[ 0], color='black', @@ -269,7 +279,7 @@ def plot_well_logs(logs, fontsize=fontsize_xlabels) # Setting y label - ax[0 + k].set_ylabel(depth_column + ' [%s]' % logs.curves.at[logs.curves[logs.curves['original_mnemonic'] == depth_column].index.tolist()[0], 'unit'], + ax[0 + k].set_ylabel(depth_column + ' [%s]' % logs.curves.at[logs.curves[logs.curves['mnemonic'] == depth_column].index.tolist()[0], 'unit'], fontsize=fontsize_ylabels) # Fill between curve @@ -374,7 +384,7 @@ def plot_well_logs(logs, # Setting x label ax[j + k + l].set_xlabel(tracks + ' [%s]' % - logs.curves[logs.curves['original_mnemonic'] == tracks].reset_index(drop=True)[ + logs.curves[logs.curves['mnemonic'] == tracks].reset_index(drop=True)[ 'unit'].iloc[ 0], color='black', @@ -402,7 +412,7 @@ def plot_well_logs(logs, depth_min - buffer) # Setting y label - ax[0].set_ylabel(depth_column + ' [%s]' % logs.curves.at[logs.curves[logs.curves['original_mnemonic'] == depth_column].index.tolist()[0], 'unit'], + ax[0].set_ylabel(depth_column + ' [%s]' % logs.curves.at[logs.curves[logs.curves['mnemonic'] == depth_column].index.tolist()[0], 'unit'], fontsize=fontsize_ylabels) # Plotting tracks @@ -436,7 +446,7 @@ def plot_well_logs(logs, # Setting x label ax[i + j + k].set_xlabel(tracks[i] + ' [%s]' % - logs.curves[logs.curves['original_mnemonic'] == tracks[i]].reset_index( + logs.curves[logs.curves['mnemonic'] == tracks[i]].reset_index( drop=True)[ 'unit'].iloc[0], color='black' if isinstance(colors[i], type(None)) else colors[i], labelpad=10, @@ -718,7 +728,7 @@ def plot_logs_multiple_wells(wells: list, # Setting x label ax[i].set_xlabel(params[i]['track'] + ' [%s]' % wells[i].logs.curves[ - wells[i].logs.curves['original_mnemonic'] == params[i]['track']].reset_index( + wells[i].logs.curves['mnemonic'] == params[i]['track']].reset_index( drop=True)[ 'unit'].iloc[0], color='black' if isinstance(colors[i], type(None)) else colors[i]) @@ -750,7 +760,7 @@ def plot_logs_multiple_wells(wells: list, ax_second.plot(df_well_logs[param['track']], df_well_logs[param['depth_column']], color='purple', linewidth=0.5) ax_second.set_xlabel(param['track'] + ' [%s]' % wells[param['ax']].logs.curves[ - wells[param['ax']].logs.curves['original_mnemonic'] == param['track']].reset_index( + wells[param['ax']].logs.curves['mnemonic'] == param['track']].reset_index( drop=True)[ 'unit'].iloc[0], color='purple')