Download Icon Downloads PriceTag Icon Prices Youtube video 20 px icon Videos


GeolOil - The GLS Well Logging Scripting Programming Language


"GeolOil has strong programming capabilities in GLS and Groovy."
Enis Aliko. Senior Drilling Engineer. Wellynx. Italy.∎



How many times have you needed to create or modify a log curve, using your equations and algorithms, only to discover that other petrophysical software offer limited choices? How many times have you ended using Excel spreadsheets, or Python script routines?


GLS GeolOil Logging Scripting is perhaps the easiest tool to write your own simple and short source code. Type your own equations, calibrations, variable petrophysical parameters per zone in a curve, or design your own functions and algorithms quickly. For example, the classical Archie SW water saturation to enforce its result to 0-1 can be scripted as:


GLS GeolOil minimal script to compute Archie water saturation


where porosity is the LAS curve number 13, deep or true resistivity the curve 7, and formation water resistivity the curve 10. No worries about missed -999.25 values in any curves. GeolOil will analize, compile and run your code behind the scenes (check the GLS Reference Manual for details). You can also of course compute SW easily with our collection of 24 built-in, out of the box GUI water saturation models.


The Sigil "@" is prepended to define curve numbers and aliases. For instance MD=@1 refers to the first curve on the log (Measured Depth). Likewise, if a curve mnemonic has been aliased as PhiE, then the statement EffectivePorosity=@PhiE defines a variable curve for effective porosity, regardless of its curve number or its original mnemonic.


The Sigil "%" is prepended to define constants that automatically access the LAS or GLOG Sections: ~Parameters, ~Well info, and even the non-standard (but recommended) ~Tops section. For instance, if the table for the parameters section has an entry for Salinity with a constant parameter value of 35000, the formation water salinity can be referred anywhere in the script as %Salinity.


Let's suppose now that you are processing a large depth interval. A clean eolian sandstone formation A spans from MD=3507-4713, and a carbonate formation B spans from MD=4713-6876. The electrical parameters for the clastic formation are a=0.81, m=1.9, n=1.8. But the parameters for the carbonate zone are different, a=1.0, m=2.0, n=2.0. One easy solution to compute SW, is to define a, m, n, not as constants, but curves. This is how:


GLS GeolOil script to define variable parameters instead of constants


Notice how this concise and legible code does not require special syntax like for, if, then, else: It is a Stream Scripting language. It analyzes, compiles and executes the necessary loops and if conditions to skip -999.25 occasional curve values. That simple, yet powerful.



GLS GeolOil Logging Scripting petrophysics programming language

The GLS script window, integrated in the Functions panel:


GLS GeolOil Logging Scripting is fully integrated with the Muti-Well work-flow module

The GLS scripts are integrated as exportable functions with the Multi-Well work-flow module.



GLS is a minimal, domain specific scripting language to process well logs for petrophysicists and geologists. It has two modes, the Stream Scripting already shown is the simpliest one (most problems are solved with this mode), and the GLS conventional Regular Scripting that might be preferred by users with basic programming skills using if, then, else, and for depth looping syntax. Both modes can be integrated seamlessly.


Just to explore how GLS Regular Scripting can be blended with GLS Stream Scripting, check an equivalent example code using a depth loop:


GLS GeolOil script that uses depth loops instead of streaming programmig


light bulb idea NOTE:   The return() command returns the value for the script, and can be placed anywhere in the code.

If the script does not find a return() statement, it will return the value of the last expression evaluated. This makes the code even easier and more concise. If the last line return(SW) is removed from the code, SW would be returned anyway, since the last expression evaluated is SW*blankOutside(topA,MD,baseB)

Make sure to always put a return() command in your script. Lack to do that, might generate a syntax error.


Notice that the regular scripting code is far longer and complex than its stream script version. More important, the GLS Stream Scripting language is safer, readable, and will take care of most details, logic, looping, and skipping special cases for you. Just design and type your equations as you think them.


The GLS Stream Scripting properly takes care of invalid numbers and -999.25 exceptions. But if you prefer or need maximum control and use the GLS regular scripting, it is advised to skip all invalid cases explicitly. Although any operation involving -999.25 or invalid numbers will produce -999.25 results, comparisons like == or < or > will behave unexpectedly and must be avoided manually. The best way to skip invalid numbers in the depth for loop is then:


GLS GeolOil script to skip -999.25 null missed values



Take Notes Related article:

Watch YouTube Educative Petrophysics Video Related video:

© 2012-2023 GeolOil LLC. Please link or refer us under Creative Commons License CC-by-ND