This demonstrates how to plot a three-combo plot with Petrolib
modules. The first step is to load the well data (either in .las, .csv or .txt). For simplicity, you can decide to selectively load the the composite logs
# Importing the load_las function from the petrolib.file_reader module
from petrolib.file_reader import load_las
# Loading data from the LAS file 'WELL_A - Copy.LAS' using the load_las function from the petrolib.file_reader module,
# specifying to return a DataFrame (well_df) and LAS object (las_obj), and selecting specific log curves ('GR', 'RT', 'RHOB', 'NPHI_NUERALNET')
well_df, las_obj = load_las('WELL_A - Copy.LAS', return_csv=True, curves=['GR', 'RT', 'RHOB', 'NPHI_NUERALNET'])
# Resetting the index of the DataFrame
well_df = well_df.reset_index()
# Displaying the first few lines of the DataFrame
well_df.head()
DEPT | GR | RT | RHOB | NPHI_NUERALNET | |
---|---|---|---|---|---|
0 | 5000.0 | NaN | NaN | NaN | NaN |
1 | 5000.5 | NaN | NaN | NaN | NaN |
2 | 5001.0 | NaN | NaN | NaN | NaN |
3 | 5001.5 | NaN | NaN | NaN | NaN |
4 | 5002.0 | NaN | NaN | NaN | NaN |
Next off, we rename the log curves to maintain conventional names
# Importing the set_alias function from the petrolib.procs module
from petrolib.procs import set_alias
# Setting aliases for columns in the DataFrame using the set_alias function,
# mapping 'DEPTH' to 'DEPT', 'GR' to 'GR', 'RT' to 'RT', 'NPHI' to 'NPHI_NUERALNET', and 'RHOB' to 'RHOB'
well_df = set_alias(well_df, DEPTH='DEPT', GR='GR', RT='RT', NPHI='NPHI_NUERALNET', RHOB='RHOB')
# Displaying the first few lines of the DataFrame
well_df.head()
DEPTH | GR | RT | RHOB | NPHI | |
---|---|---|---|---|---|
0 | 5000.0 | NaN | NaN | NaN | NaN |
1 | 5000.5 | NaN | NaN | NaN | NaN |
2 | 5001.0 | NaN | NaN | NaN | NaN |
3 | 5001.5 | NaN | NaN | NaN | NaN |
4 | 5002.0 | NaN | NaN | NaN | NaN |
Then you may decide to clean the data to ensure that it follows conventional values
# Importing the process_data function from the petrolib.procs module
from petrolib.procs import process_data
# Processing data in the DataFrame using the process_data function, with parameters specifying columns to
# process ('GR', 'RT', 'NPHI', 'RHOB')
well_df = process_data(well_df, 'GR', 'RT', 'NPHI', 'RHOB')
# Displaying descriptive statistics for the DataFrame using the describe method
well_df.describe()
DEPTH | GR | RT | RHOB | NPHI | |
---|---|---|---|---|---|
count | 10041.00000 | 8637.000000 | 9806.000000 | 9778.000000 | 8637.000000 |
mean | 7510.00000 | 62.190853 | 87.168153 | 2.259300 | 0.307351 |
std | 1449.36568 | 27.879147 | 333.953441 | 0.141427 | 0.119166 |
min | 5000.00000 | 4.790300 | 0.790300 | 1.950000 | -0.150000 |
25% | 6255.00000 | 38.343800 | 2.274725 | 2.156425 | 0.239921 |
50% | 7510.00000 | 59.883099 | 6.123750 | 2.241600 | 0.314726 |
75% | 8765.00000 | 87.391701 | 17.965950 | 2.364800 | 0.406013 |
max | 10020.00000 | 150.000000 | 2000.000000 | 2.674300 | 0.450000 |
Then we plot the three combo plot
# Importing the tripleCombo function from the petrolib.plots module
from petrolib.plots import tripleCombo
# Generating a triple combo plot using the tripleCombo function, with parameters specifying
# DataFrame (well_df), depth column ('DEPTH'), gamma ray ('GR'), resistivity ('RT'),
# neutron porosity ('NPHI'), density ('RHOB'), depth range (5500 to 9000),
# figure size (10, 22), fill method ('both'), and title ('X-A')
tripleCombo(well_df, depth='DEPTH', gr='GR', res='RT',
nphi='NPHI', rhob='RHOB', ztop=5500, zbot=9000,
figsize=(10, 22), fill='both', title='X-A')
Lets's tweak things
# Generating a triple combo plot using the tripleCombo function, with parameters specifying
# DataFrame (well_df), depth column ('DEPTH'), gamma ray ('GR'), resistivity ('RT'),
# neutron porosity ('NPHI'), density ('RHOB'), depth range (5500 to 9000),
# reservoir threshold (10), fill method ('both'), limit ('left'), color palette ('RdBu'),
# and figure size (11, 30)
tripleCombo(well_df, 'DEPTH', 'GR', 'RT', 'NPHI', 'RHOB', ztop=5500, zbot=9000,
res_thres=10, fill='both', limit='left', palette_op='RdBu', figsize=(11, 30))