trace maths technical definitions - cgg · trace maths technical definitions ... (e-format) numbers...

15

Click here to load reader

Upload: ngolien

Post on 06-Sep-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 1 of 15

Trace Maths Technical Definitions Programs and expressions The parser recognizes, compiles and runs free-format programs of arbitrary complexity. A program consists of a number of natural (“infix”) expressions, each terminated by a ; (semicolon). An expression is one or a combination of - numbers, mathematical operators, logical operators, variables, functions and keywords. Numbers Numbers are recognized by the compiler as a separate string of the characters [-.0123456789] - scientific (e-format) numbers are not recognized. Some examples of valid numbers are: 1, -999, 21.563, .22, 0.22, -.333; some examples of invalid numbers are: 1 000 (space is not allowed), 2,333,333 (comma is not allowed), 1.423e+07 (scientific format not recognized). Fractions are not recognized, but can easily be simulated using the / (forward slash) division operator and enclosing the division in parentheses, e.g. (1/4) for ¼ (one quarter). Mathematical operators The parser recognizes mathematical operators as natural (“infix”) single-characters, that is they should appear between the operands (e.g. 2 + 2). The operators the parser recognizes are very similar to those used by the C programming language, with the addition of the exponentiation operator ^ (circumflex), a full list appears below in “Summary of parser features, iv”. Note the distinction between assignment (=) and test for equality (==). Operations that would cause an exception (division by zero or raising a negative value to a non-integer power) give a zero result. Operator precedence is as in normal mathematics and operators of equal precedence are evaluated in the order they appear in the expression: Operator Precedence parenthesized expressions highest unary + and - array subscripts ^ and % * and / + and - logical operators (see below) = lowest Example: 2 ^ 3 % 5; gives a result of 3 (same as (2 ^ 3) % 5;) Logical operators Logical operators are similar to mathematical operators, but they always result in a value of 1 (to represent TRUE) or 0 (FALSE). These results may be used in expressions, but logical operators are primarily intended for use with the if and while keywords (see below). Operator Precedence parenthesized expressions highest && || ==, !=, >=, <=, >, < lowest Example: result = trace - (min(trace) >= 999) * 999; will subtract 999 from all traces whose minimum value is greater than or equal to 999. For examples of the more usual use of logical operators see “Examples of parser expressions” below.

Page 2: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 2 of 15

Variables Variables are strings of characters associated with a value. They may consist of the characters [_abcdefghijklmnopqrstuvwxyz], case-insensitive and up to 32 characters in length. The Compiler will just truncate any longer strings: e.g. a variable called

TwoFourSixEightWhoDoWeAppreciate_darlo is indistinguishable from

twofoursixeightwhodoweappreciate_newton_aycliffe. A variable is created by assigning a value to it using the = (equals) operator, e.g.

sineOfTrace = sin(trace) The parser maintains some variables itself as either constants (e.g. pi)or as READ-ONLY variables. See “Summary of parser features, v” for a complete list. It is not possible to use assignments within expressions, e.g. a=sin(q=33;) will compile but not run, the correct expression would be q=33; a = sin(q);. It is also not possible to “gang” assignments, e.g. a=b=c=33; will also compile but not run, the correct expression would be a=33; b=33; c=33;. Functions The parser has a set of built-in functions (see “Summary of parser features, ii”) all of which take at least one argument and all of which return a value. Most functions can be applied to either arrays or numbers (those that cannot or should not be applied are listed), and exceptions are handled - e.g. log of a negative value gives zero rather than throwing an exception. Functions take the form of a function name followed by the arguments to the function in parentheses, e.g. sin(thing * pi / 4); User-defined functions are not available in this version of the parser. Keywords The parser recognizes the strings else, foreach, if and while as keywords that introduce programming constructs. The if statement takes the form if( logical-expression )

{ … … … } else { … … … … }

If the logical-expression evaluates to TRUE the block of code between the first set of braces is executed. If an else block is present the code within that block is only executed if the logical-expression evaluates to FALSE. The while statement takes the form while( logical-expression )

{ … … … … }

The code within the braces is executed repeatedly as long as the logical-expression evaluates to TRUE.

Page 3: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 3 of 15

The foreach statement takes the form foreach(samp-var, trace-var)

{ … … … … }

The block of code within the braces is executed as many times as the number of samples in trace-var. At each iteration the time of the sample is calculated and stored in a read-only variable _time. The value of the sample at this iteration is copied into samp-var before each iteration and copied back to the correct element of trace-var after each iteration. foreach is provided as a convenience for dealing specifically with traces – the Compiler actually translates it into a while loop as below: foreach statement translates to foreach(samp, trace) _fe_n_1 = numsamples(trace); { _fe_c_1 = 0; CODE; while(_fe_c_1 < _fe_n_1) } { samp = trace[_fe_c_1]; _time = _starttime + _fe_c_1 * _srate; CODE; trace[_fe_c_1] = samp; _fe_c_1 = _fe_c_1 + 1; } Comments Are just like C. Any text between (and including) the symbols /* and */ are treated as a single space character. Note that this means they cannot be used as a pasting operator, e.g. 2/**/2 is treated as 2 2, not 22. The parser “language” The language is very like C: it consists of free-format statements separated by ; (semicolon) characters, the statements being made up of the elements described above. The result the parser returns is the final expression evaluated, there is no special “result” variable. In the “Examples of parser expressions” below the final expression is not assigned to any variable, as the desired result is obtained by the final expression on the last line.

Examples of parser expressions Create a 45° rotated “P times G” stack from two volumes cosTheta = cos(pi / 4); sinTheta = sin(pi / 4); rotatedP = pVolTrace * cosTheta - gVolTrace * sinTheta; rotatedG = pVolTrace * sinTheta - gVolTrace * cosTheta; rotatedP * rotatedG; Create a dummy volume of increasing-frequency sine waves sinewave(0, 10 * xline);

Page 4: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 4 of 15

Create a dummy volume of a constant value foreach(sample, trace) { sample = 0.1819938457; } trace; Average adjacent traces numxlines = 141; if( xline > 1 xline < numxlines ) { lastTrace = trace; result = trace; trace; } else { result = (lastTrace + trace) / 2; lastTrace = trace; result; } Apply 3-sample average smooth to traces prev2 = trace[0]; prev1 = trace[1]; result = trace; resIndex = 1; index = 2; while( index < numsamples(trace) ) { result[resIndex] = (prev1 + prev2 + trace[index]) / 3; prev2 = prev1; prev1 = trace[index]; index = index + 1; resIndex = resIndex + 1; } result; Apply a mute from start time to 250 ms to traces at offsets greater than 500m if( abs(offset) > 500 ) { foreach(sample, trace) { if( _time < 250 ) { sample = 0; } } } trace;

Page 5: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 5 of 15

Offset dependent mute, linear interpolation of 3 offset points /* Parameters */ trace = gathers; dist0 = 0; mute0 = 300; dist1 = 200; mute1 = 400; dist2 = 400; mute2 = 500; dist3 = 1000; mute3 = 650; /* Code */ absoffset = abs( offset ); currentmute = 0; if (absoffset < dist1 ) { currentmute = mute0 + (mute1-mute0)*(absoffset-dist0) / (dist1-dist0); } else { if (absoffset < dist2 ) { currentmute = mute1 + (mute2-mute1)*(absoffset-dist1) / (dist2-dist1); } else { if (absoffset < dist3 ) { currentmute = mute2 + (mute3-mute2)*(absoffset-dist2) / (dist3-dist2); } else { currentmute = mute3; } } } foreach( sample, trace ) { if ( _time < currentmute ) { sample = 0; } } trace; Offset dependent scaling, linear interpolation of 3 offset points /* Parameters */ trace = gathers; dist0 = 0; scal0 = 1; dist1 = 200; scal1 = 1.2; dist2 = 400; scal2 = 1.5; dist3 = 1000; scal3 = 2.0; /* Code */ absoffset = abs( offset ); currentscal = 0;

Page 6: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 6 of 15

if (absoffset < dist1 ) { currentscal = scal0 + (scal1-scal0)*(absoffset-dist0) / (dist1-dist0); } else { if (absoffset < dist2 ) { currentscal = scal1 + (scal2-scal1)*(absoffset-dist1) / (dist2-dist1); } else { if (absoffset < dist3 ) { currentscal = scal2 + (scal3-scal2)*(absoffset-dist2) / (dist3-dist2); } else { currentscal = scal3; } } } trace * currentscal; Mean scaling /* Parameters */ trace = gathers; startwindow = 500; endwindow = 700; outrmslevel = 1000; windowsum = 0; windownum = 0; foreach(sample, trace) { if( _time >= startwindow && _time <= endwindow ) { windowsum = windowsum + sample * sample; windownum = windownum + 1; } } scale = 0; if (windownum > 0) { windowrmslevel = sqrt( windowsum / windownum ); if (windowrmslevel > 0) { scale = outrmslevel / windowrmslevel; } } trace * scale; AGC option /* Parameters */ trace = gathers; windowsize = 100; /* size in number of samples */ outrmslevel = 1000; size = numsamples( trace ); if (windowsize > size) { windowsize = size; } smoothedrms = trace; if (windowsize > 1 && size > 1 ) { work = trace; work[0] = 0; index = 0; while (index < (size-1) ) { work[index+1] = trace[index] * trace[index]; index = index + 1;

Page 7: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 7 of 15

} workextrasample = trace[size-1] * trace[size-1]; index = 1; while (index < size ) { work[index] = work[index] + work[index-1]; index = index + 1; } workextrasample = workextrasample + work[size-1]; index = 0; while (index < size ) { iup = index + (windowsize/2) + 1; if (iup > size) { iup=size; } idown = index - (windowsize/2); if (idown < 0) { idown=0; } nvals = iup - idown; windowrms = 0; if ( nvals > 0 ) { if (iup == size) { windowrms = workextrasample; } else { windowrms = work[iup]; } windowrms = windowrms - work[idown]; windowrms = windowrms / nvals; windowrms = sqrt( windowrms ); } smoothedrms[index] = windowrms; index = index + 1; } } index = 0; while (index < size ){ multiplier = 0; if (smoothedrms[index] > 0) { multiplier = outrmslevel / smoothedrms[index]; } trace[index] = trace[index] * multiplier; index = index + 1; } trace;

Error messages The Compiler always sends error messages to the terminal, indicating where the error was detected with a string of ^ characters. Pro3D also displays errors in a dialog and waits for the user to press a key. ‘*/’ to end comment missing Compilation error: a comment was started with /*, but no matching */ to end the comment was found, e.g.

/* now get the sine result = sin(thing) which should be

/* now get the sine */ result = sin(thing) '(' expected in call of function `name'

Page 8: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 8 of 15

Compilation error: a function name was recognized, but was not immediately followed by an opening parenthesis, e.g.

sin 2 which should be

sin(2) '(' expected in foreach statement Compilation error: a foreach statement was recognized, but was not immediately followed by an opening parenthesis, e.g.

foreach sample, trace which should be

foreach(sample,trace) '(' expected in if statement Compilation error: an if statement was recognized, but was not immediately followed by an opening parenthesis, e.g.

if a > trace[22] which should be

if( a > trace[22] ) '(' expected in while statement Compilation error: a while statement was recognized, but was not immediately followed by an opening parenthesis, e.g.

while a > min(trace) which should be

while( a > min(trace) ) ')' expected in foreach statement Compilation error: a foreach statement was recognized and correctly parsed, but no closing parenthesis was found, e.g.

foreach(element, trace { which should be

foreach(element, trace) { ')' expected in if statement Compilation error: an if statement was recognized and correctly parsed, but no closing parenthesis was found, e.g.

if( max(trace1) > max(trace2) { which should be

if( max(trace1) > max(trace2) ) { ')' expected in while statement Compilation error: a while statement was recognized and correctly parsed, but no closing parenthesis was found, e.g.

while( a < numsamples(trace) { which should be

while( a < numsamples(trace) ) { ')' missing Compilation error: (part of) an expression in parentheses lacked a closing bracket, e.g.

scaled_val = (sample - minval * scaler; which should be

scaled_val = (sample - minval) * scaler;

',' expected in foreach statement

Page 9: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 9 of 15

Compilation error: the sample and trace variables in a foreach statement were not separated by a comma, e.g.

foreach(sample trace) which should be foreach(sample, trace) ']' expected in subscript of `name' Compilation error: an array subscription was missing its terminating bracket, e.g.

trace[count = 99 which should be

trace[count] = 99 '{' expected starting block Compilation error: a foreach, if or while keyword was not immediately followed by an opening brace, e.g.

if( a > b ) a = b; which should be

if( a > b ) { a = b; } '{' only used after `else', `foreach', `while' or `if' Compilation error: an opening brace was found in an inappropriate place. Most likely a typo, e.g.

trace{a] which should be

trace[a] '}' expected ending block Compilation error: a foreach, if or while block was not correctly terminated by a closing brace. Error in call to function 'name' Run-time error: a call to a function caused an invalid result - error messages are sent to the terminal - most likely due to inappropriate types of data being sent as arguments to a function. Please report this. The expression results in a single value: cannot make a volume from a single number Pro3D error: the expression to be applied to a seismic volume would result in a volume being created with all traces containing the same value. If you really want to do this, do it this way:

dummy=trace * 0 + 999; replacing trace with the variable name you gave to the seismic volume, and 999 with the value you want the output volume to contain. attempt to assign to a constant variable `name' Compilation error: the parser will not allow assignment to either of the variables pi or e. If you want to use some other value for one of these constants, you will have to create your own variable, e.g. wrongpi=22/7;sin(trace * (wrongpi / 180)); attempt to assign to an internal reserved variable name `name' Compilation error: in Pro3D the variable names _endtime, _starttime and _srate are used internally and the Compiler will reject attempts to assign values to them. In foreach statements a variable _time is available, which is the time of the current sample, again, the Compiler will also reject attempts to assign to this variable. attempt to compile a NULL program Implementation error: the Compiler class was passed a NULL pointer as the program to be compiled. Please report this. attempt to compile with NULL symboltable

Page 10: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 10 of 15

Implementation error: the Compiler class was created with a NULL SymbolTable pointer. Please report this. bad token `symbol' Compilation error: some symbol which the Compiler does not understand was encountered in the expression to be compiled, most likely a typo, e.g. a = trace ? 22: which should be

a = trace / 22; call of non-function `name' Compilation error: the Compiler encountered an attempt to call a function with the same name as a variable, e.g.

sine = sin(j); … … a = sine(q); which should be

sine = sin(j); … … a = sin(q); call of unknown function `name' Compilation error: the Compiler detected a function call but knows of no function of that name, most likely a typo, e.g.

J = instantamp(trace); which should be

j = instamp(trace); cannot add variable name `name' Implementation or memory error: an attempt to create a new variable failed, probably because the parser is out of memory. Please report this. cannot create a variable with the same name as a function: `name' Compilation error: the Compiler detected and rejected an attempt to create a variable with the same name as a known function, e.g.

cos=cos(trace); which should be something like

theCos = cos(trace); cannot create or use sample variable `name' Implementation or memory error: the variable which will be assigned each sample value in a foreach statement could not be created due to lack of memory or could not be found in the SymbolTable after insertion. Please report this. cannot create temporary variables for foreach statement Memory error: two temporary variables needed for the foreach statement could not be created due to lack of memory. Please report this. cannot make copy of program Run-time implementation or memory error: the Interpreter was not able to create a copy of the parser expression, most likely due to lack of memory. Please report this. cannot subscript element of a function `name' Compilation error: the Compiler detected and rejected an attempt to use a function name as an array - probably a typo, e.g.

sine=sin(trace); … … sin[33]; which should be

Page 11: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 11 of 15

sine=sin(trace); … … sine[33]; data queue beyond system capacity Implementation or memory error: whilst scanning the parser expression the Compiler detected that the number of data items in the expression caused the counter to become less than zero. Probably a memory error somewhere else in the program corrupting Compiler class variables. Please report this. data queue too large Implementation or memory error: the Compiler was not able to allocate enough memory to hold the data items in the parser expression. Please report this. execution error Critical run-time error: execution of the program created an invalid result - error messages will be written to the terminal - please report this. information about input data would be lost in assignment to variable `name' Compilation error: in Pro3D the variables inline, tracenum and xline are created and maintained for the parser, recording information about each trace as it is processed. The Compiler will not allow assignment to these variables. input data would be lost in assignment to variable `name' Compilation error: in Pro3D the variables that contain the traces from your input seismic volumes cannot be assigned to, since they contain input data. You can only change the value of a copy of your input data, or through the foreach command, e.g. foreach(sample, trace) { sample = sin(sample); } instruction queue beyond system capacity Implementation or memory error: whilst scanning the parser expression the Compiler detected that the number of instructions generated from the expression caused the counter to become less than zero. Probably a memory error somewhere else in the program corrupting Compiler class variables. Please report this. instruction queue too large Implementation or memory error: the Compiler was not able to allocate enough memory to hold the instructions generated from the parser expression. Please report this. invalid number of arguments # in call to function 'name' Critical run-time implementation error: a function was called with the wrong number of arguments, the Compiler should not have generated such code, so the instruction queue has probably been corrupted. Please report this. invalid type `#' in if test Critical run-time implementation error: please report this. invalid type `#' in while test Critical run-time implementation error: please report this. misplaced else (without if) Compilation error: an else keyword was detected but there was no if statement preceding it. Probably due to an expression or a semicolon between the closing brace of the if block and the else keyword, e.g.

if( a > b ) { j = 1; }; else … which should be

if( a > b ) { j = 1; } else …

Page 12: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 12 of 15

misplaced function call in foreach statement, function `name' Compilation error: the Compiler detected and rejected the use of a function name in a foreach statement, e.g.

sine=sin(trace); … … foreach(samp, sin) { … … which should be

sine=sin(trace); … … foreach(samp, sine) { … … need numsamples() function for foreach statement Critical implementation error: the Compiler cannot find the numsamples() function in the SymbolTable whilst compiling a foreach statement. Please report this. no program to run Run-time error: the Interpreter has been sent an empty program and so has nothing to do. The Compiler should not generate empty programs, please report this. not enough memory to compile program Memory error: the Compiler cannot allocate sufficient memory. Please report this. null symbol to be added to queue? Critical implementation error: the Compiler attempted to add a NULL Symbol pointer to the data queue. Please report this. primary expected before `symbol' Compilation error: the Compiler expected a number, name, parenthesized expression or function call before the symbol reported, probably caused by a typo, e.g.

j = trace[q] * * 3; which should be

j = trace[q] * 3; subscript # out of bounds for array `name' Run-time error: whilst running the compiled parser expression, the Interpreter detected an attempt to access an element beyond the bounds of a trace (this can only be detected at run-time). subscript of non-array `name' Run-time error: whilst running the compiler parser expression, the Interpreter detected an attempt to access an element of a variable that is not a trace (this can only be detected at run-time). This is probably due to a typo. too few arguments or missing separator in function call, `name' Compilation error: the Compiler detected an error in a function call, either a comma was missing between arguments e.g.

atan2(a b * j) which should be

atan2(a, b * j) or not enough arguments were present within the parentheses, e.g.

spike(12) which should be

spike(12, 1) too many arguments or missing ')' in function call `name' Compilation error: the Compiler detected an error in a function call, either too many arguments were included between the parentheses or the closing bracket was omitted, e.g.

atan(12, j) which should be either atan2(12, j)

Page 13: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 13 of 15

(since atan2 takes two arguments) or atan(12)

unimplemented keyword `name' Critical implementation error: the Compiler recognises a symbol as a keyword, but has no method of implementing it. Please report this. unknown array `name' Compilation error: the Compiler detected an attempt to use a non-existent variable as an array, probably due to a typo, e.g.

thing=sin(trace * pi); … … j = theng[1]; which should be

thing=sin(trace * pi); … … j = thing[1]; unknown variable `name' Compilation error: the Compiler detected an attempt to use a non-existent variable. Variables must be created by assignment, or be created for you (e.g. trace variables in Pro3D) before they can be used, e.g. ratio = pi / ROOT_2; which should be ROOT_2 = 2 ^ 0.5; ration = pi / ROOT_2; unknown variable for array in foreach statement `name' Compilation error: the array-variable second argument in a foreach statement does not exist. variable depends upon others that are not available: `name' Compilation error: the _time variable created by the Compiler in foreach loops is dependant on the variables _endtime, _srate and _starttime which Pro3D inserts into the SymbolTable. If you're using the parser outside of Pro3D you will have to create and maintain these variables yourself. variable name for array expected in foreach statement Compilation error: the array-variable second argument in a foreach statement is missing. variable name for sample expected in foreach statement Compilation error: the sample-variable first argument in a foreach statement is missing.

Summary of parser features i. Constants Name Description pi 3.14159265358979323846 (M_PI from math.h) e 2.7182818284590452354 (M_E from math.h) ii. Functions Function Args Returns Description + abs 1 TN Absolute value * acos 1 TN Arc cosine - argument in radians * asin 1 TN Arc sine - argument in radians * atan 1 TN Arc tangent - argument in radians * atan2 2 TN atan2(y, x) - Arc tangent of y / x * ceil 1 TN Largest integer >= argument * cos 1 TN Cosine - argument in radians * cosh 1 TN Hyperbolic cosine @ cosinewave 2 T cosinewave(phase, freq) - cosine wave trace, phase

(or initial angle) in radians, freq in Hz

Page 14: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 14 of 15

deg 1 TN Convert radians to degrees * exp 1 TN Inverse natural log * floor 1 TN Largest integer <= argument # instamp 1 T Instantaneous amplitude of a trace # instfreq 1 T Instantaneous frequency of a trace # instphase 1 T Instantaneous phase of a trace * log 1 TN Natural logarithm * log10 1 TN Base-10 logarithm ~ max 1 N Maximum value in trace ~ mean 1 N Mean value in trace ~ median 1 N Median value in trace ~ min 1 N Minimum value in trace ~ mode 1 N Modal value in trace ~ numsamples 1 N Number of samples in trace ~ product 1 N Product of all samples in trace ~ productpow 2 N productpow(trace, power) product of all samples in

trace, each raised to power * pow10 1 N Inverse base-10 logarithm rad 1 TN Convert degrees to radians ~ rms 1 N Root-mean square of a trace sign 1 TN -1 if argument < 0, +1 otherwise * sin 1 TN Sine - argument in radians @ sinewave 2 T Number of samples in trace * sinh 1 TN sinewave(phase, freq) - sine wave trace, phase (or

initial angle) in radians, freq in Hz Hyperbolic sine

@ spike 2 T spike(time, duration) - spike (0 to 1) trace with spike of length duration milliseconds starting at time milliseconds

sqrt 1 TN Square root (implemented as argument raised to power of 0.5) @ step 1 T step(time) - step (0 to 1) trace with step occurring at time

milliseconds ~ stdev 1 N Standard deviation of trace ~ sum 1 N Sum of all values in trace ~ sumpow 2 N sumpow(trace, power) - Sum of all values in trace, each

raised to a power * tan 1 TN Tangent - argument in radians * tanh 1 TN Hyperbolic tangent ~ variance 1 N Variance of trace Key + standard C library function (fabs) - more info available from UNIX manual * standard C library function more info available from UNIX manual @ requires _srate, _starttime and _endtime to be set or will FAIL. Pro3D sets these. # requires _srate to be set (defaults to 1). Pro3D sets this. ~ stats functions, should only be used on a trace T returns a trace N returns a number iii. Keywords Keyword Usage foreach foreach(sample-var, trace-var) { expr; ... } if, else if( expr ) { expr; ... } else { expr; ... }

Page 15: Trace Maths Technical Definitions - CGG · Trace Maths Technical Definitions ... (e-format) numbers are not recognized. Some examples of valid numbers are: ... Functions take the

Hampson-Russell Trace Maths Definitions

May 2008 Page 15 of 15

while while( expr) { expr; ... } iv. Operators Symbol

Description

() Parenthesize expressions or function arguments [] Array indexing = Assignment ^ Exponentiation % Modulus * Multiplication / Division + Addition - Subtraction or unary negation == Test for equality != Test for inequality >= Test for greater-than or equality <= Test for less-than or equality > Test for greater-than < Test for less-than && Logical AND || Logical OR ; Terminate/separate expressions , Separate arguments in function call v. Special variables Name Key Description _time @ The time of the current sample _starttime * The starting time of the current trace _endtime * The last time of the current trace _srate *+ The sample rate of the current trace inline 3 The in-line number of the current trace xline 3 The x-line number of the current trace tracenum 3 The sequential number of the current trace (from 1 … number-of-traces-in-file) offset 3 The offset of the current trace from the source shot shotpoint 3 The shotpoint number of the current trace cdp 3 The CDP ensemble number of the current trace sourceX 3 The UTM X co sourceY 3 The UTM Y co receiverX 3 The UTM X co receiverY 3 The UTM Y co Key @ only available and valid WITHIN the body of a foreach loop * needed for trace-generating functions (step + needed for attribute functions (instamp 3 maintained for Pro3D by ApplyParserToVolume (parsrvol.{h Notes • All the above are READ-ONLY in the Pro3D parser, they cannot be assigned to. • Times and sample rate are in milliseconds. • Trace variables set up from the Pro3d parser menu first page are also marked as READ-ONLY.