VBA Macro: Clastic Sedimentary Lithology Interpreter based on Geophysical logs-Density and Gamma




The code is using geophysical gamma and density data to interpret the lithology. However, even in simplest conditions, other interpreting criterion will be required to make an accurate interpretation. So, the code and Macro provided here is for your reference, and I am not take any responsibility of you using this macro. BTW, the density and gamma logs have to corrected (no trends or tool errors or anything), otherwise the result looks like a joke...

Right, I am not a programmer, and this is something I came out in work and think might of help to some geologists. The code is quite lazy and there must be efficient ways to do this, and I will be grateful if you can offer some suggestions and help or ideas to improve the function/performance or the code, you can leave your comments here or email me. Also, if you have questions, please leave some words as well. 

What is it again? what can it do if anything at all?

Function: The purpose of the this marco is to interpret the lithology based on the geophysical logs (gamma and density) and the criteria you set for the common clastic sedimentary rocks, as Coal, Mudstone, Sandstone, Siltstone, Carbonaceous Mudstone, Overburden...

As shown in the below screenshots, it allows you to input the gamma and density criteria for each of the lithology, and also the OVB thickness, and the thin layer thickness to be merged which will be explained below. 

Mechanism: Three steps are taken in the code,

1. Interpret each line of the geophysical log based on the sampling interval (such as 0.01m per line) and assign a lithology name based on the density and gamma value of this sampling interval. Such as, in the interval of 100m to 100.05m, the density is 2 G/CC, and the gamma is 100 API, and you think it is sandstone, the sandstone is assigned to this line.

2. After the lithologies are assigned to the raw geophysical data, you will have thousands if not more of lines of lithology, but that is not what you want for the result. So, we combine then. Here, the code combines the lithology of intervals with the same lithology above and below of that interval. This will shorten the lithology list, but that is still too much. So, we process further.

3.  Consolidate/merge the very thin layers which has similar or very close lithology to the overlying or underlying layers, or where you think the lithology and underlying and overlying can be merged. Probably it is more reasonable/conservative to merge the spatially and lithologically close ones, such as merge the thin layer of mudstone into overlying and/or underlying siltstone, and siltstone into sandstone etc, not coal into sandstone.

Meanwhile, the step 2 and step 3 are executed sequentially and repeatedly for the resultant consolidated lithology list.





The whole process is described in sequence as,

1. Assign the lithology to the raw geophysical data

2. Merging and combining

Merge thin SLT in to SST (overlying) and SST (underlying)
Combining them
Merge thin SST in to SLT (overlying) and SLT (underlying)
Combining them
Merge thin CS in to C (overlying) and C (underlying)
Combining them
Merge thin C in to CS (overlying) and C (underlying)
Combining them
.....
then Merge slightly thicker  SLT in to SST (overlying) and SST (underlying)
Combining them 

--> The result lithology list



But how to use it, if I care at all...

Data preparation: the data and results are currently given at the same spreadsheet. Original geophysical data should be put in cols and starting from row 2. Otherwise, you will have runtime errors.

Original and result of the lithology interpretation
Original and result of the lithology interpretation

To use the macro, in the Input Options Panel->Col. Location tab, you put in the data col. for depth, gamma and density in . Then, you input the criteria for gamma and density and the thickness limit you want the thin layers to merge. For the thin layer merger, you can leave some entire rows empty; also, the lithology of the overlying and the underlying don't have to be the same, but it is a more reasonable way to make them the same. 

Abbr. for lithology

SST - Sandstone
SLT - Slitstone
C - Coal
CS - Carb. Shale
MDS - Mudstone


Lithology interpretation Panel
Lithology interpretation Panel

After Click Calculate, it is going to tell you which col it will display the data. By default it is 3 col. after the end for the data. 

Then it shows.



The Download is here.


To use this macro:

The download is LAI.xlam, the macro file. In case you are not very familiar with how to make it run, the below are the simple steps.

1. Put the download file in your computer, 
2. open the excel, file-> option-> excel addin, and click on OK



3. on the addin window, click on browse, find the LAI. xlam, click on it, and then click on OK

4. LAI.xlam should show in the addin window.

5. Now let's add it to the ribbon. Go to option--> customize ribbon--> Macro--> select LAIStartPanel (the MainEXE as you can see in the list is just one of the function in the macro, don't select this) as shown below, and then at right of the window, find a place for this new item, or you can add a new tab or group, and then click on the "add" connecting the right and left side of the window, and click on OK. That is it, you have the marco in you ribbon.