Channel Math

Use the Database Tools > Channel Math menu option (geogxnet.dll(Geosoft.GX.Math Expression Builder.Math Expression Builder;RunChannel)*), to create, save, load, and execute math expressions for your channel data. This easy-to-use, standardized dialog provides all the math expression options on a single tabbed dialog.

The option is also available with the UAV Merge Sorties extension under the UAV Merge Sorties > Pre-processing menu.

Channel Math dialog options

Step 1: Enter a mathematical expression, or alternatively, build the expression using the buttons and tabs located below the Expression box.

Expression

Enter the math expression in this box. The syntax is straightforward and based on the C programming language. The expression can contain any combination of functions and operators, absolute and/or variable channel names, DUMMY values, and numbers, spanning multiple equations. The expression can either be directly typed in or built using the supplied Variables and Operators and Functions tabs.

For further details, see the Expression section under Application Notes.

Click this toggle button to expand and display the available Operators and Functions to build the channel math expression. Use the keyboard to enter numerical values.

For more detailed information about the operators and functions of this expanded section, click on the links below:

  • Common Keys: Buttons consisting of the most commonly used operations and values, grouped along the left, right below Operators and Functions.

  • Frequent Tab: Frequently used conditional and logarithmic operators and functions.

  • Special Tab: Special limit and mathematical functions.

  • String Tab: String functions. This tab is only visible if your database contains channels of type String.

  • Trig Tab: Trigonometric functions.

  • Statistics Tab: Statistical properties of one or more lines.

  • Offset Tab: Operators to access channel values on rows other than the current one.

  • Date Tab: Convert Julian Date (day, month, year) to Geodate (fractional years) or vice versa.

  • Time Tab: Convert Time (second, minute, hour) to Geotime (fractional hours) or vice versa.

Click on this button to add a new channel variable at the location of the cursor in the Expression box. The variable channel naming convention is C#, where # is the next available number.

This is not to be confused with temporary variables (see Common Keys), which only exist at run time and are not read from or saved to the database.

Step 2: Assign channels from the current database to the variable names used in the expression.

Assign channels

This box is automatically populated with all the channel variables present in the Expression box. Select from the drop-down list the appropriate channel name to assign to each of the variables in the expression. The drop-down list is populated with the channel names from the current database.

The tool distinguishes between input and output channels. Input channels are preceded by a character and must be selected from a drop-down list, while output channels can be both selected from a list of existing channels and entered manually as a new channel name.

For further details, see the Assign Channels section under Application Notes.

Common tasks

To speed up building the expression, this drop-down list offers a number of simple common math expressions:

  • Add 2 Channels: C0 = C1 + C2;

  • Divide 2 channels: C0 = C1 / C2;

  • Multiply 2 channels: C0 = C1 * C2;

  • Multiply channel by factor 2: C0 = C1 * 2;

  • Remove 5000 from channel: C0 = C1 - 5000;

  • Subtract 2 channels: C0 = C1 - C2;

  • True/False statement: C0 = (C1>5000) ? C2 :C3;

You can select an expression from the list and, if needed, continue to further edit it.

Expression file

Once you have built the expression, you can save it to a file for future use. Similarly, if you have previously saved expressions, you can load them from a file.

The expression files are simple ASCII text files and can be viewed outside of Oasis montaj using a text editor.

Click on Clear to remove all entries, including the expression, grid assignment, and expression file.

Click on Apply to apply the expression without exiting the dialog. This is useful when you intend to apply the same expression to multiple channels in the same database.

Application Notes

If an equation yields a value outside the data range, the output is set to DUMMY.

In Geosoft convention, the DUMMY value depends on the data type:

  • For signed integer data types, the DUMMY value is set to the minimum value of the corresponding data range.

  • For unsigned integer data types, the DUMMY value is set to the maximum value of the corresponding data range.

  • The DUMMY values and data ranges for floating data types do not follow this convention. Instead, they are set to limits outside the data ranges you would typically handle in geophysical processing.

ClosedClick the link to expand and view the Geosoft data ranges and DUMMY values for the different data types.

Expression

Expressions are parsed from right to left. For example, in the conditional expression G0 = (condition)?G2:G3, the data type of the rightmost channel, G3, defines the data type of the output.

Longer, more complex expressions spanning multiple lines remain visible as you work. When new rows are added to the Expression box, its height automatically expands to display up to 12 lines. Beyond this, a scroll bar appears along the right margin for navigation.

To further increase the vertical height of the box, while the focus is on the Expression box, hover the cursor over the top or bottom edge of the dialog until the double arrow appears. Click and drag the edge of the dialog to resize the box accordingly.

When working with long expressions, the dialog can also be widened. Hover the cursor over the left or right edge of the dialog until the double arrow appears, then click and drag to adjust the width as needed.

Assign Channels

When building the expression, instead of using variables and assigning a channel to each variable, you can use channel names as they appear in the current database. You will not be prompted for these in the Assign channels box. Similarly, you will not be prompted for any temporary variables that may be present in the Expression box.

To further increase the vertical height of the Assign channels box, focus on it, then hover the cursor over the top or bottom edge of the dialog until the double arrow appears. Click and drag the edge of the dialog to resize the box accordingly.

If the output channel does not exist, it will be created with a logical data type.

If the variables in the conditional expressions are of different types, the equation parser will define the output type based on the leftmost variable, which may not align with your intention. If the equation parser cannot reasonably determine the output data type, the output channel will be populated with DUMMY values.

Array Data

Array data is now supported in the Channel Math Expression Builder. The desired elements of an array can now be placed within square brackets. For example, you could have the following expression:

CO=C1[1]+C2[5]

  • The elements of an array are now supported by the Offset dot (.) functions and Statistics dot (.) functions.
  • Special Functions

    Table lookup functions, although supported, are not directly offered as a choice under the Functions tabs and cannot be executed from within the Math tools. However, they can be executed within the Spreadsheet Window.

    Temporary Variable Definition

    Temporary variables can be defined in a math expression. These variables exist only during the computation stage and are not saved in the output. To define a temporary variable, precede it with the "@" symbol (e.g., @Var1). Multiple temporary variables can be included in an expression.

    *The GX.NET tools are embedded in the geogxnet.dll file located in the "...\Geosoft\Desktop Applications \bin" folder. If running this GX interactively, bypassing the menu, first change the folder to point to the "bin" directory, then supply the GX.NET tool in the specified format. See the topic Run GX for more details on running a GX.NET interactively.