$388 offer expires on November 29 midnight! (California time)
First year full license + learn set.
Only $388 (Regular price: $688)


REFERENCE

GeolOil  Logging Scripting (GLS) Reference Manual and API DocumentationThe GeolOil GLS is a simple and concise scripting programming language specifically designed to process petrophysics LAS files. It allows easy handling of well log curves without worrying too much about invalid blank, or missed 999.25 values. Some minimum exposure to elementary scripting is advised. Please read the GLS log scripting tutorial introduction before checking this reference material. GLS Stream OperatorsThe operators +, , *, /, are normal binary operators that can take either a scalar or a log curve to the left or right side of the operator. The power operator is ^. For instance, x^y means x^{y}. Operators are evaluated from left to right according to standard operator precedence priority as any programming language. To change the evaluation order, just use enough parentheses. The character or sigil @ is reserved for curve number references. For example, if deep resistivity is the curve number 13, the assignation Rt = @13 defines the variable Rt as a whole curve object. Measured depth should normally be the first curve on a LAS file, so MD = @1 defines MD as the curve 1. To separate instructions use ;. To start a remark or a comment to be omited use #. The internal representation for missed, dummy, unknown, blank, invalid, infinite, not a number, or any irregular number is 999.25. GeolOil GLS handles all cases automatically in the stream mode (it compiles and executes for you all necessary depth loops on curves and if conditions), but some manual control is needed on the regular looping mode when using comparisons like ==, <, ≤, >, and ≥. GLS Stream FunctionsA stream function is automatically applied to a whole log curve. It internally takes care of all depth cells, looping, and properly handling of invalid dummy and 999.25 values. A special algebra handles automatically a whole curve without any need to loop inside individual depth values. All functions can be applied to either scalars (a single value), or log curve arguments:
Three exponential and logarithmic functions: Six trigonometric functions: The next five functions are normally used as premultipliers to modify results: (See an example in the tutorial log scripting) Special functions: The merge() and avg() functions combine several curves into one. Let's suppose that a LAS file has two versions of Gamma Ray curves and it is wanted to combine them into a single one (instead of selecting one). If the curve GR1 is more reliable than the curve GR2, we would like to use the curve GR1 when it is available, and use GR2 only when GR1 is missed (999.25). If both curves have a similar behaviour and reliability, perhaps it would be preferred to average the curves to reduce noise, and yet produce an estimate even if only one curve is available: Measured Depth MD : 103.00 103.50 104.00 104.50 105.00 105.50 GR1 : 67.83 89.20 999.25 999.25 56.90 999.25 GR2 : 999.25 87.90 999.25 66.48 49.10 38.61  merge (GR1, GR2) : 67.83 89.20 999.25 66.48 56.90 38.61 avg (GR1, GR2) : 67.83 88.55 999.25 66.48 53.00 38.61 User Defined Stream FunctionsIn some cases the builtin collection of GLS functions is not enough for some advanced computations. Custom specific functions can be defined by the user both in stream mode or regular depth looping mode. The defined functions are usually placed at the end of the script. As an example, the following user defined stream function has the same behaviour as the default builtin GLS avg(x,y) function: def average (x,y) # Sums the valid numbers and divide by the amount of valid ones { numerator = valueOrZero(x) + valueOrZero(y) # The sum of the valid numbers. Zero won't add invalid numbers denominator = isValid(x) + isValid(y) # The amount of valid elements, can be 2, 1, or 0 return (numerator/denominator) # No worries if denominator if zero, GLS will handle this } GLS Regular Depth Looping ModeThe GLS stream mode normally handles most of the programmer's needs. However, in some cases an advanced user may want full control of the computations depth by depth step on a curve. Such custom scripts are usually unnecessarily verbose, long, complex, and prone to bugs, as the user has to take care of all cases, exceptions, if conditions, and looping. While algebra with invalid numbers like NaN or 999.25 is handled correctly by GLS, the user must not use if and comparison operators like <, ≤, ==, ≥, or >. The reason for that is that an unknown number like NaN or 999.25 can't be compared against anything by definition. For instance, what is the logic result of the instructions: x=999.25; if (x<0) {x=x+1;}. Since 999.25 is a missed invalid number, don't expect the result to be true (yielding x=998.25). Likewise, the if() comparison should not be taken as false either!. How to treat this then? There are two workarounds to deal with this problem. The first choice is prefer to script as much as possible in the GLS stream mode that takes those details correctly and automatically for you. The second choice is to explictly skip all invalid comparisons and continue to the next instruction or iteration in a depth loop using the isValid(x) function, or its logic negation !isValid(x) Looping over all DepthsTo build a loop over all depths in a LAS file, the user needs to take care of the followng details:
MD = @1; phi = @13; rt = @7; rw = @10 SW = new LasCurve (MD.blank()) # All cell elements of SW are initialized to missed 999.25 steps = MD.size(); for (int depthIndex=0; depthIndex < steps; ++depthIndex) { por = phi.get (depthIndex) res = rt.get (depthIndex) rwt = rw.get (depthIndex) ... more code follows } for (int depthIndex=0; depthIndex < steps; ++depthIndex) { por = phi.get (depthIndex) res = rt.get (depthIndex) rwt = rw.get (depthIndex) if ( (!isValid(por))  (!isValid(res))  (!isValid(rwt)) ) {continue;} # Skips to the next depthIndex iteration swValue = ( (1/(por^2)) * (rwt/res) ) ^ (1/2) # Calculates one depth element of the Archie water saturation ... more code follows } for (int depthIndex=0; depthIndex < steps; ++depthIndex) { por = phi.get (depthIndex) res = rt.get (depthIndex) rwt = rw.get (depthIndex) if ( (!isValid(por))  (!isValid(res))  (!isValid(rwt)) ) {continue;} # Skips to the next depthIndex iteration swValue = ( (1/(por^2)) * (rwt/res) ) ^ (1/2) # Calculates one depth element of the Archie water saturation if (!isValid(swValue)) {continue;} # swValue can result in 999.25 if for instance por=0 # Now that swValue can't be 999.25 it is legit to make comparisons, like: if (swValue < 0.15) {swValue = 0.15;} # Water saturation must be higher than the irreducible water saturation if (swValue > 1.00) {swValue = 1.00;} # Water saturation must be less or equal than 1.0 SW.set (depthIndex, swValue) } return (SW) All this large boilerplate code is equivalent (and safer, more intuitive and human readable) to just only three lines of scripting in the Stream Mode. So think twice before considering to write code on the Regular Looping Mode, or other petrophysical software under Python scripts. What about trying in Excel? phi = @13; rt = @7; rw = @10 SW = ( (1/(phi^2)) * (rw/rt) ) ^ (1/2) SW = trim (0.15, SW, 1.0) Only if you really need to write complicated math code that involves the flow control statements: if, else, for, do, while, continue, and break, stick with the Stream Mode.




Content, and web design © 20122020 GeolOil LLC. You are welcome to refer them. Please give us fair credits under Creative Commons License CCbyND 