Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Contents
MapLan/VolLan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Maplan/VolLan Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Starting MapLan/VolLan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Program Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Features of MapLan/VolLan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Working with Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Create a New Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Inserting Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Open an Existing Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Save a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Delete a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Running Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Edit Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Tools Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Command Line Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Exit MapLan/VolLan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Program Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Declaration Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Initialization Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Processing Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
End Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Source File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Statement Separators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Variable Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-1
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Program Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
dowhile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
goto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
perform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Frame Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
File Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
User Defined - Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Logical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Numeric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
String Related . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Ask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
External Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Compilation and Linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Future Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-2
Maplan/VolLan Basics
Overview
MapLan/VolLan (an acronym for Map/Volume Language) is Paradigm’s grid/volume processing language.
This online help is a guide to writing programs in MapLan/VolLan and is designed for users who wish to
develop their own modules for grid/volume processing and database access. It also describes MapLan/
VolLan functions which may be used in expressions (e.g., tp_evaluate).
A C compiler must be available in order to develop programs using MapLan/VolLan. See "System
Requirements" in the Introduction of the Geolog 6.7.1 Installation Guide for information regarding which
C compiler is required on each of the supported platforms.
Starting MapLan/VolLan
MapLan/VolLan programs can be created via the program development interface, mui_loglan.MapLan/
VolLan programs can also be created using a text editor.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-3
Program Development
Introduction
MapLan/VolLan is a fully functional programming language which is written, compiled and executed
within Epos. It is used for the creation and maintenance of grid/volume analysis algorithms that can be
applied to Epos data.
Features of MapLan/VolLan
• Multi-step and multi-loop programming logic, including subroutines and one
dimensional arrays.
• Point or row-based processing.
• Performance of calculations such as summations and averages over multiple data frames.
• Direct control of input and output data sources and destinations.
• Read from and write to external ASCII files.
MapLan/VolLan manages access to Epos grid/volume files. There are a wide range of operators, functions
and control commands or functions within MapLan/VolLan so that almost any process can be applied to
Epos data.
As an example of MapLan/VolLan programming, following is a simple program to calculate density porosity
from bulk density:
START:
dowhile GET_FRAME ()
DPHI = (RHOMA - RHOB) / (RHOMA - RHOF)
call PUT_FRAME ()
enddo
end
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-4
Working with Programs
A MapLan/VolLan program actually consists of three files:
<program>.lls and <program> are maintained by mui_loglan. <program>.info is used by the Module
Launcher to display its screen and to control the information it passes to the MapLan/VolLan application.
The MapLan/VolLan window is divided into two sections: Input/Output and Source.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-5
Fig. 2: The VoLan window
Input/Output
Data types, data sources and units. Defines program variables and the interface used when the program is
executed. This information is saved as <program_name>.info when the file is saved. New variables are
created using the Insert menu.
Inserted variables are displayed in table format—see The Module Launcher for information on using tables.
Source
Defines the processing of inputs and outputs carried out by the program, using MapLan/VolLan statements,
functions, etc. Text is entered using the keyboard. Source code, including inputs and outputs and program
documentation, is saved as <program_name>.lls when the file is saved.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-6
Create a New Program
A new program is created by first providing a name and other details about the new program in the
MapLan/VolLan Details dialog box.
These details can be revised at a later date by selecting Edit > Properties.
Inserting Variables
Program inputs and outputs are inserted by using the Insert menu and selecting the type of input/output
variable to insert. The name of the variable is entered in the dialog box that appears.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-7
Input/Output
When the name of a new variable has been specified, an entry is created in the Input/Output section of the
MapLan/VolLan window. Details of the variable are then added (e.g., units, default value, description, etc.).
The Input/Output section of the MapLan/VolLan window is in table format—see The Module Launcher for
further information on using this format. The contents of the table are stored in the <program>.info file.
This file is used by the Module Launcher to construct the graphical user interface (GUI) for the program.
The table below describes the components of the variable.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-8
Table 2-2: Components of Variables in Input/Output Section (Continued)
Field Description
Comment Descriptive comment.
Validation Validation of the input/output. The validation string for a numeric value may have one of the
following forms:
StringMeaning
v1:v2 v1 <= value <= v2, missing not allowed.
v1:v2,-v1 <= value <= v2, missing allowed.
v1<v2v1 < value < v2, missing not allowed.
v1<v2,-v1 < value < v2, missing allowed.
v1,v2[,...] value == v1 or v2 [or ...]. This option causes a list selection button to be displayed by the
Launcher when the field is selected. If one of the values in the list is “-” missing is allowed, and if
“?” is present any other entry is also valid.
The validation string for an alpha value must have the following form:
v1,v2[,...]value == v1 or v2 [or ...]. This option causes a list selection button to be displayed by the
Launcher when the field is selected. If one of the values in the list is “-” missing is allowed, and if
“?” is present any other entry is also valid. If the list entries are in consistent case (e.g., all lower,
edit, or upper), then an entered value will be converted to that case.
For a file, the validation string may be “READ” (in which case the file must be readable) or
“WRITE” (in which case the file must be writable if it exists, or the file’s directory must be writable
if the file does not exist. Irrespective of any validation, the entered data must be a valid filename.
Another component, List, is available which, when used, displays a list of valid options in a Combo Box
(Field). The value entered in this field is executed as a command which should return the list of options, one
per line.
The List component is not available in the MapLan/VolLan window but can be entered into the .info file.
Save a Program
• Use the MapLan/VolLan > Save and MapLan/VolLan > Save As menu items to save new
programs, or a modified program with a new name, to the currently open project’s maplan/
vollan directory (unless otherwise specified).
Delete a Program
• Select MapLan/VolLan > Delete to open the File Select Dialog Box to locate and select a
program to delete.
Properties
• Select Edit > Properties to open the MapLan/VolLan Details dialog box to modify the
descriptions and/or specified layout of a program.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-9
Running Commands
• Select Project > Run to run a command, script or module within the MapLan/VolLan window.
See Running Commands for further details.
Edit Menu
Use the Edit menu to make changes to the description of the MapLan/VolLan program, and specify options
for compiling and linking.
Externals Used to specify the path names for included files and
directories, external libraries and directories, external
objects, and the Linker used to load the compiled program.
Tools Menu
MapLan/VolLan tools on the Tools menu are used once program coding has been completed.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-10
Site Install After compiling the mapLan/volLan, select this option to
install the mapLan/volLan to the site area to make it
available to all users.
NOTE When installing the C compiler for Windows, do not use spaces in the path name (except in
the "Program Files" section).
loglan_compile
Compile and link a MapLan/VolLan program. This runs loglan_to_c and module_generate, compiles
the files and then links them to produce an executable.
Options:
loglan_to_c
MapLan/VolLan to C converter.
Options:
module_generate
Options:
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-11
Exit MapLan/VolLan
Select MapLan/VolLan > Exit to close the MapLan/VolLan window. The File Modified dialog box will be
displayed to enable any unsaved changes to be saved or discarded.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-12
Program Syntax
Program Structure
MapLan/VolLan programs consist of the following sections:
Depending on the purpose of a program, some elements will not be required. For example, a program that
only utilizes data from the constants area will not need to GET or PUT frames, nor require the dowhile-
enddo structure.
Declaration Section
This section does not appear if using mui_loglan to edit MapLan/VolLan programs, however, it is saved in
the source file.
There are three classes of variables, INPUT, LOCAL and OUTPUT, which can store numeric or character
data. Variables can be declared as both INPUT and OUTPUT, for example where a grid is modified by the
MapLan/VolLan program and then saved to the database.
Variable Names
A variable name must start with an alphabetic character and every other character must be alphabetic, a
digit, or an underscore ( _ ). The maximum length of a local variable name (and of the PROGRAM name) is
63 characters, while for input and output variables the length of the name should be no greater than 13. All
variable names are converted to lower case when the program is converted to C. In mui_loglan, local
variables in the input/output window will be in lower case and all others in uppercase. In the Source section,
any case may be used. A variable name may not be a reserved word. The reserved words are:
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-13
and, by, call, divide, do, dowhile, else, elseif, end, enddo, endfor, endif, eq, false, file_in, file_out
for, ge, goto, gt, if, le, lt, minus, missing, multiply, ne, not, or, perform, plus, program, raise,
result, return, then, start, to, true, uminus and until.
Names which are reserved words in the C language have an underscore suffix added, so the use of names
which consist of a C reserved word followed by an underscore should be avoided, since a conflict could occur
if the reserved word itself is also used. The reserved words in the C language are:
argc, argv, auto, break, case, char, const, continue, default, do, double, else, enum, envp, extern,
float, for, goto, if, int, long, main, register, return, short, signed, sizeof, static, struct, switch,
typedef, union, unsigned, void, volatile, and while.
Names which conflict with functions defined in the system include files string.h and math.h may NOT be
used. These functions incude:
acosh, alog, asinh, atan, atan2, atan2f, atanf, atanh, atof, atof, cabs, cbrt, ceil, ceilf, clog, copysign, cos, cosf,
cosh, coshf, dlog, drand48, drem,erand48, erf, erfc, exp, expf, expm1, expm1f, fabs, fabsf, facos, fasin,
fatan,fatan2, fcabs, fceil, fcos, fcosh, fexp, fexpm1, ffloor, ffs, fhypot, finite,flog, flog10, flog1p, floor, floorf,
fmod, fmodf, frexp, fsin, fsinh, fsqrt,ftan, ftanh, ftrunc, gamma, hypot, hypotf, initstate, j0, j1, jn,
jrand48,lcong48, ldexp, log, log10, log10f, log1p, log1pf, log2, logb, logf, lrand48,matherr, memccpy,
memchr, memcmp, memcpy, memmove, memset, modf, modff, mrand48, nextafter, nrand48, pow, powf,
rand, random, remainder, rint, scalb,seed48, setstate, sin, sinf, sinh, sinhf, sqrt, sqrtf, srand, srand48,
srandom,strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn, strdup, strerror, strlen, strncasecmp,
strncat, strncmp, strncpy, strpbrk, strrchr, strspn,strstr, strtod, strtok, strtok_r, strxfrm, tan, tanf, tanh,
tanhf, trunc,truncf, y0, y1, yn, and zlog.
The use of variable names of the form grid attribute"_"name should be avoided. The defined
gridgridattributes are:
name, units, type, min, max, mean, stddev, count, miss, top, bottom, date, user, comment, sr,
repeat and frames.
Input Variables
INPUT variables are extracted from the Epos files by the module launcher and passed to the MapLan/
VolLan program in a table pipe when the MapLan/VolLan program is executed. They may be grids or
volumes.
An example of input variable declarations:
Local Variables
LOCAL variables are temporary variables that are assigned values within a program but are never written
to the database. These may be intermediate calculations or flags used to indicate a particular action.
LOCAL variables are useful for breaking down complex algorithms into simpler components.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-14
Numeric and alpha local variables may be arrays. Arrays in MapLan/VolLan are one dimensional;
multidimensional arrays are not supported.
An example of local variable declarations:
Output Variables
OUTPUT variables are written to the output table pipe by the MapLan/VolLan program and stored in Epos
by the module launcher.
An example of output variable declarations:
Initialization Section
The initialization section of a MapLan/VolLan program is indicated by a START: statement and contains
any program code to:
• initialize variables.
• perform calculations not related to frame-by-frame processing.
When a data frame is read, all input variables are set to the values contained in the current frame.
Variables obtained from constants or interval parameters will also be re-initialized. All output variables
will be set to MISSING.
Processing Section
The Processing section comprises:
• specific MapLan/VolLan statements;
• operators, functions and subroutines;
• user defined subroutine calls.
The iteration to GET, PROCESS and PUT each data frame is controlled by the construct:
dowhile . . . . . . . enddo
GET is performed by the logical function GET_FRAME()
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-15
PUT is performed by the call to the function PUT_FRAME()
Processing is performed by statements between the GET_FRAME() and the PUT_FRAME().
For example:
START:
dowhile GET_FRAME() /* Fetch next data frame
/* Water Saturation using Ratio Method
SW = (RO / RT) ** (1 / N)
CALL PUT_FRAME /* Put or write data frame
enddo
end
Any operations to be performed after all the data has been processed are entered after the enddo statement
but before the end statement.
End Section
end marks the end of the program. Local subroutines used within the program appear after the end
statement.
If the last character on a source line is a tilde (~), then the next line is a continuation of the current line.
For example:
a = a + 9 - ~
b
is treated as if it were:
a = a + 9 - b
The continuation character cannot split a token over more than one line.
Comments
A slash and an asterisk (/*) and all following characters up to the end of a line are ignored by the compiler.
For example:
/*
/* increment value number 1
/*
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-16
this_val_01 = this_val_01 + 1 /* increment value 1
Statement Separators
A number of statements may appear on one line if they are separated by semicolons (;).
For example:
a = 1 ; b = 1 ; c = 1
do ; PERFORM calcite ; until c > 10
Statement separators should be used with restraint because it is easy to obscure program logic when
multiple statements are on the same line. They are useful for initializing similar or repetitious data.
For example:
Operators
MapLan/VolLan provides standard logical and arithmetic operators. When an expression is being
evaluated, the operators are evaluated in the following order:
1. Exponentiation (**)
2. Unary minus (-)
3. Multiplication (*) and division (/)
4. Addition (+) and subtraction (-)
5. Concatenation (//)
6. Relational operators (<, <=, >, >=, <>, ==)
7. Logical NOT (^,\\)
8. Logical AND (&)
9. Logical OR (|)
10. All other operators and functions.
For example:
• -2**2 will evaluate to -4, as the 2**2 is evaluated first, result is 4, and then the unary minus is
performed to give the final result of -4.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-17
• Parentheses may be used in an expression to alter the normal order of evaluation. For example:
(-2)**2 will evaluate to 4.
Operators of equal priority (refer to (3), (4) and (6) above) are evaluated from left to right within an
expression.
For example:
• 5*2 + 6/2 - 9*6/3 + 4
is evaluated as (((5 * 2) + (6 / 2)) - ((9 * 6) / 3)) + 4 which evaluates to -1.
Variable Types
Alpha Variables
Alpha variables have an alpha string value and are defined using the following syntax:
The units alpha.num specify the maximum number of characters which may be assigned to the variable.
Any characters beyond num will be truncated. The default length (if the "*num" is omitted) is 4. The
maximum length is 72 for INPUT/OUTPUT variables and 1024 for LOCAL variables.
For example:
Logical Variables
Logical variables may have the values TRUE or FALSE and are useful for flags, switches or toggles.
For example:
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-18
Numeric Variables
Any variable which is not declared Alpha or Logical is numeric. Numeric variables are usually of type REAL
or DOUBLE, although INTEGER and other types are also supported. A complete listing of data type values
can be found in the file datatypes.h in the installation directory /include/common.
Array Variables
MapLan/VolLan supports the use of one dimensional array variables; multi-dimensional arrays are not
supported.
Array variables may be of type numeric, logical, or, for local variables, string. An array variable is declared
by suffixing the name with the repeat count in square brackets.
For example:
sarray[5] alpha.10
Single array elements may be accessed by following the array name with an index enclosed in square
brackets [ ].
For example:
numarray[2] = numarray[i-2] + 15.602
numarray[3] = SIN (numarray[2]) + 180
When a function requires an array argument, the index is used to indicate which part of an array to pass.
For example:
result = FUNCTION (numarray[5], 23)
passes the array numarray starting at element 5.
Constants
Some frequently used constants have been predefined. These are used in the same way as normal variables
except that their values may not be altered.
CONSTANT VALUE
MISSING Uninitialized numeric value.
PI 3.141592653589793238
TRUE The logical value TRUE.
FALSE The logical value FALSE.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-19
CIRCLE_AREA = PI * RADIUS ** 2
if (GR == MISSING) then
GR_COR = MISSING
else
GR_COR = RHOF * (1-EXP (-0.09 * CALI) + 0.64
endif
MYLOGICAL = TRUE
YOURLOGICAL = FALSE
if (MYLOGICAL & YOURLOGICAL) then
/* Both conditions true
process option A
elseif (YOURLOGICAL)|(MYLOGICAL) then
/* Either condition true.
process option B
else
/* Both conditions FALSE
process option C
endif
Program Control
do
do is a post-tested loop which terminates when the condition evaluates to TRUE. The statements within
the body of the loop are always evaluated at least once.
do
<statements>
until <condition is true>
For example:
do
count = count + 1
bottom = bottom + step
gap = top - bottom
until (gap <= step) | (count == 100)
The loop terminates when gap is less than or equal to step or count reaches 100.
dowhile
dowhile is a pre-tested loop which terminates when the condition evaluates to FALSE. If the condition
evaluates to FALSE the first time, the statements in the loop body are never executed.
dowhile <condition>
<statements>
enddo
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-20
For example:
dowhile count <= 50
COUNT = count + inc
perform WASHOUT
enddo
The body of this loop is executed until the value of count exceeds 50.
for
for is a pre-tested loop which terminates when:
• The value of a variable is greater than the final value, if the step is positive.
• The value of a variable is less than the final value, if the step is negative.
for variable = <initial> to <final> by <step> do
<statements>
endfor
• If loop termination occurs the first time the variable is checked, the statements in the loop are
not executed. The step is optional. If omitted, the step value defaults to 1. In this case the for
line would appear as:
for variable = initial to final do
The variables used in the initial, final and step statements may be altered in the body of the loop. When the
loop is terminated, the loop variable retains the value which caused the termination condition to fail.
For example:
for index = 1 to 10 do
a = a + index - 1
endfor
The loop executes exactly 10 times and leaves index with a value of 11.
for index = 0.5 to 9.25 by 0.5 do
endfor
The loop executes 18 times with index values of 0.5, 1, 1.5, etc. leaving index with a value of 9.5.
goto
The goto statement transfers program execution to the specified label, defined by a line containing only
the label followed by a colon. As a general rule, the goto construct should be avoided since its use can easily
obscure program logic. The required functionality can usually be achieved in a structured way using
do...until, dowhile...enddo, for...endfor or if...elseif...endif constructs.
goto <label name>
For example:
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-21
<statements>
goto FINISH /* transfers control to FINISH:
<statements> /* these statements are skipped
FINISH:
<statements> /* these statements are executed
A goto must not branch into a block structured program element at a level below that of the goto. This
prevents the user from inadvertently jumping into the middle of an if block or a for loop, etc. The block
structured program elements into which a goto must not branch are:
• if...elseif...endif..
• dowhile...enddo
• do...until
• for...endfor
For example, the following program is illegal because it is branching into an IF block at a lower level:
goto MIDDLE
if <condition> then
MIDDLE:
<statements>
endif
However, the following program fragment is legal as the goto is branching to a label in a block which
contains the goto.
if <condition> then
MIDDLE:
<statements>
goto MIDDLE
endif
The following program is also legal as the goto is branching to a label in a higher level block:
if <condition> then
MIDDLE:
do
endif
A goto statement must not use the same label as a perform statement. For example, the following program
is illegal as the same label is used by both a goto and a perform statement:
goto FRED
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-22
<statements>
perform FRED
FRED:
if
MapLan/VolLan provides an if structure as follows:
if <logical-expression> then
<statements>
elseif <logical-expressionthen
<statements>
else
<statements>
endif
There may be zero or many else if statements. There may be zero or one else statement. If there are elseif
and else statements, the else statement must come after the last elseif statement.
For example:
/* this is a valid block-if statement.
if a > b then
c = 1; d = 1/* executed when a is greater than b
elseif a == b then
c = d /* executed when a is equal to b
elseif a < b then
c = 0; d = 0 /* executed when a is less than b
endif
/* this is a valid block-if statement.
if (a > b) & allok then
/* executed when a > b and allok is TRUE.
c = 500
else
/* executed for all other cases.
goto EXIT
endif
/* this is a valid block-if statement.
if c >= d then
c = 10 /* executed when c is greater than or
/* equal to d
endif
/* this is an invalid block-if statement because the else
/* statement must come after the last elseif statement.
if c > 67.2 then
c = 20
else
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-23
d = c
elseif e > maxline then
c = d
endif
perform
MapLan/VolLan provides local subroutines which may be performed any number of times from anywhere
in the program, or from any other local subroutine. A perform statement must not reference a label used
by a GOTO statement.
The structure is:
perform LABEL_NAME
<main program statements>
end
LABEL_NAME:
<subroutine statements>
return
Variables used in local subroutines are global to the main program. Variables used in the main program
may be used or altered in local subroutines and vice versa.
For example:
<statements>
perform SUBA /* transfer control to label SUBA:
<statements> /* returns from SUBA to here
perform SUBB /* transfer control to label SUBB:
end /* returns from SUBB to here and stops
SUBA:
<statements> /* start of SUBA
perform SUBB /* transfers control to label SUBB:
return /* returns from SUBB to here
/* then returns back to the line
/* after the perform SUBA
SUBB:
<statements> /* SUBB statements
return /* returns back to the line
/* after the perform SUBB
end
A program terminates when the end statement is executed or when the physical end of the program is
reached. If there are local subroutines, there must be an end statement at the end of the main program,
before the first subroutine label. If there are no local subroutines, it is not necessary to have an end
statement at the end of the main program.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-24
For example, the following program is legal:
<statements>
perform SUBA /* transfers control to label SUBA:
end /* program stops here
SUBA:
<statements> /* SUBA statements
return /* return control to statement after
/* perform SUBA
The following program is illegal, as there is no end statement between the program body and the first local
subroutine.
<statements>
perform SUBA
SUBA:
<statements>
return
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-25
Functions
Introduction
A MapLan/VolLan function may be called in three ways:
1. call function ( arguments )
2. function ( arguments )
3. variable = function ( arguments )
If the function has no arguments, the parentheses must still be used. If the function has more than one
argument, the arguments are separated by commas. A function may be used anywhere a variable of the
same type as the function is used. For example, a logical function may be used in a dowhile, and a numeric
function in an assignment statement. If either of the first two forms of function call is used, the function
result is ignored. Spaces inside function parentheses are ignored by the compiler and make programs easier
to read.
Frame Control
GET_FRAME
logical = GET_FRAME ( )
GET_FRAME is a logical function which reads the next frame of data and returns TRUE if that
frame exists in the input dataset. If no more frames exist, the function returns FALSE. This
function is usually used in a dowhile statement to process the entire input. When a frame of data is
successfully read, all input variables except those whose location is parameter, will be assigned
the values from the current frame, and all output grids will be set to MISSING.
The dowhile GET_FRAME ()] statement (or an equivalent construct) must be present in a program
where frame-by-frame calculations are made. Brackets () must follow as these indicate that a
function and not a variable is being used.
POS_FRAME
logical = POS_FRAME ( n )
Positions to frame n in the input file and reads the record. If n is less than or equal to 1, the first
record in the input file will be read and the function will return TRUE. If n is greater than the
number of records in the file, the function returns FALSE and the input variables will be undefined.
SKIP_FRAME ( -2 ) will then position to the last record.
The symbolic constants TOP_DATA and END_DATA may be used to position to the top and end of
the file respectively. For example:
call POS_FRAME ( TOP_DATA )
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-26
POS_REFERENCE
PUT_FRAME
logical = PUT_FRAME ( )
The PUT_FRAME function writes all the input-output and output-only variables defined in the
program to the output tp. This function would generally be called at the end of the loop dealing with
the frame by frame processing of data. The enddo statement corresponding to the dowhile
GET_FRAME () normally follows the PUT_FRAME call. The function always returns TRUE.
REWIND
logical = REWIND ( )
Positions to the beginning of the input so that the next GET_FRAME call will read the first frame
of data. The function always returns TRUE.
call REWIND ()
call GET_FRAME ()
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-27
START:
/* This code module sums all RHOB values, rewinds to the top and then writes
/* a new grid but all values greater than one standard deviation from the mean
/* are rejected.
/* Initialize.
x = 0
s = 0
n = 0
dowhile GET_FRAME ()
/* Summation.
x = RHOB + x/* Sum all the values.
s = RHOB * RHOB + s /* Sum the squares of the values.
n = n + 1/* Sum the number of frames
endif
enddo
mean = x / n/* Calculate mean.
/* Calculate standard deviation.
std = SQRT ( ( n * s - x ** 2 ) / ( n * ( n -1 ) ) )
/* Rewind to the top, read records and reject values.
POS_FRAME ( TOP_DATA )
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-28
SKIP_FRAME
logical = SKIP_FRAME ( n )
Skips n frames in an input file and reads the next record. If n is negative, preceding frames may be
read. For example, SKIP_FRAME ( -2 ) will re-read the previous frame. If n is -1, the current frame
will be re-read.
If attempting to skip to before the beginning of the file, the first record in the file will be read and
the function will return TRUE. If attempting to skip past the last record in the file, the function will
return FALSE and the contents of the input variables are undefined. SKIP_FRAME ( -2 ) may then
be used to position to the last input record.
CONGETN
CONGETS
File Input/Output
FCLOSE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-29
FILEDELETE
FILEEXISTS
FILEVALID
FILEFIX
FOPEN
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-30
A string defining the name of the file to be opened. This name may be generated by a call to if
a temporary or scratch file is being created. No case conversion is performed.
• "unit"
A positive integer to identify this file in calls to FREAD, FWRITE, and FCLOSE. The unit must
not be in use.
If the FOPEN call fails, an error message indicating the cause of the error is issued. FOPEN call
failure may be caused by the following:
• file does not exist when trying to open for read mode;
• user does not have the operating system read/write access;
• invalid file name (depends on the operating system being used).
Some examples of the use of FOPEN are:
FREAD
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-31
FWRITE
TMPFILE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-32
enddo
end
Because macros are a directly substituted into the MapLan/VolLan code, the program could become longer
than necessary if a particular macro is used frequently. This may be avoided by using the macro in a local
function.
The structure could be:
dowhile GET_FRAME ()
perform SUBCOAL
call PUT_FRAME ()
enddo
end
SUBCOAL:
SET_COAL ( dt, coal )
return
Logical
AND or &
EQ or ==
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-33
small = 200
same = big == small
will set same to FALSE, as 500 is not equal to 200.
GE or >=
GT or >
LE or <=
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-34
perform ESTROOT
root2 = r2
difference = root2 - ( root1 + root2 ) / 2
until ( iterate <= difference )
Iterate will always be less that difference until the root1 and root2 are closer than 0.01 and thus the
DO...UNTIL will continue to loop. In practice it would be wise to add a test to ensure that the roots
actually converge otherwise the program will never exit the loop.
LT or <
MISS
NE or <>
NOT or ^ or \\
logical = ^ logical_exp
Or
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-35
logical = \\ logical_exp
Or
OR or |
will set stop_calculations to TRUE if one or more of the bracketed expressions evaluate to TRUE,
or if the logical variable error_flag has a value of TRUE.
OUTSIDE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-36
The following will set report to TRUE.
REPORT = OUTSIDE ( 1, bottom, top )
RANGE
TABLE
Numeric
ABS
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-37
height = ABS ( top - bottom )
will set height to 1001.7 as that is the absolute value of -1001.7. It will always be positive.
ACOS
ASIN
ATAN
ATAN2
COS
DIVIDE or /
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-38
numeric = DIVIDE ( exp1, exp2 )
Returns the result of dividing exp2 into exp1.
If both exp1 and exp2 are integers, the expression will be evaluated in integer mode, otherwise the
evaluation will be performed in real mode. For example:
4 / 5 is 0, while 4.0 / 5 is 0.8.
DROUND
EXP
FTEST
IFC
INT
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-39
LIMIT
GRID
GRID10
MAX or |>
MIN or |<
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-40
numeric = MIN ( exp1, exp2, exp3, exp4, exp5 )
vsh_gr = 0.15
vsh_nd = 0.17
vsh_mn = 0.18
vsh_min = MIN ( vsh_gr, vsh_nd, vsh_mn )
will set vsh_mn to 0.15, as that is the smallest value in the argument list.
MINUS or -
MOD
MULTIPLY or *
NINT
NONMISS
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-41
PLUS or +
RAISE or **
RANDOM
RANNORMAL
ROUND
SIGN
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-42
SIN
SQRT
TAN
UMINUS or -
numeric = -exp
Or
String Related
CONCAT or //
ENCODE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-43
alpha = CONVERT ( format, expression )
Converts the numeric or logical argument to a string. The format argument is a string in which to
embed the numeric or logical argument. An '{N}' in the format is replaced by the value of the
numeric argument and an '{L}' is replaced by the value of a logical argument.
A logical argument is returned as either TRUE or FALSE. The N format may have the form
{N[width][.decimals][#]} where "width" is optional and specifies the number of decimal places. If "#"
is used, leading zeroes are not suppressed.
value = 20
result_str = CONVERT ( 'There are {N} seams', value )
result_1 = CONVERT ( 'There are {N6.2#} seams', value)
would set results_str to:
'There are 20 seams'
and would set results_1 to:
'There are 020.00 seams'
Similarly:
avail = FALSE
detail_line = CONVERT ( 'Sectors available: {L}', avail )
would set detail_line to: 'Sectors available: FALSE'
IFCS
INDEX
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-44
LDECODE
LEN
LOCASE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-45
"UPCASE".
NDECODE
NUMSTR
SCALE_APPLY
SCALE_CODE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-46
STRNUM
SUBSTRING
TOKEN
TRIM
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-47
UPCASE
WILDCARD
Regression
The MapLan/VolLan regression functions use arrays which must be declared in the MapLan/VolLan
program. The sizes of these arrays are:
SUM_SIZE = (nval+1)*(nval+2)+1 (Size of the regression sums array)
INV_SIZE = (nval+1)*(nval+1) (Size of the inverted sums work array)
BS_SIZE = (1+nval) (Size of the coefficients array)
where nval is the number of independent variables. Unless otherwise specified, all arguments are numeric
and are not modified by the functions.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-48
MR_APPLY
This function returns the value of the dependent variable calculated by applying the regression coeficients
to the passed point.
MR_BACKELIM
MR_GET_COR
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-49
cor is a numeric array of size nval*(nval+1); on return,
the first nval elements contain the correlations of the
first independent variable against the independent
variables, the second nval elements contain the
correlations of the second independent variable
against the independent variables, etc., and the last
nval elements (nval2 + 1) to (nval2 + nval) contain the
correlations of the dependent variable against the
dependent variables.
MR_GET_COV
MR_GET_DEV
MR_GET_DFD
Returns the degrees of freedom for deviation (number of points - 1 - number of independent variables).
numeric = MR_GET_DFD ()
MR_GET_DFR
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-50
numeric = MR_GET_DFR ()
MR_GET_DFT
numeric = MR_GET_DFT ()
MR_GET_F
numeric = MR_GET_F ()
MR_GET_MEAN
MR_GET_MND
numeric = MR_GET_MND ()
MR_GET_MNR
------------------------------------------------------------------------------
sum of squares due to regression
number of independent variables
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-51
numeric = MR_GET_MNR ()
MR_GET_MSD
MR_GET_R
numeric = MR_GET_R ()
MR_GET_R2
R ----------------------------------------------------------------------------
2 sum of sqares due to regression
sum of squares due to deviation
numeric = MR_GET_R2 ()
MR_GET_RA
2
Returns the adjusted coefficient of multiple correlation Ra .
numeric = MR_GET_RA ()
MR_GET_RA2
2
Returns the adjusted goodness of fit or adjusted coefficient of multiple determination R a .
numeric = MR_GET_RA2 ()
MR_GET_SSD
n
ˆ 2
Returns the sum of squares due to deviations yi – yi
i=1
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-52
numeric = MR_GET_SSD ()
MR_GET_SSR
ŷi – y
2
Returns the sum of squares due to regression
i=1
numeric = MR_GET_SSR ()
MR_GET_SST
yi – y
2
Returns the total sum of squares.
i=1
numeric = MR_GET_SST ()
MR_GET_SXX
xi – x
2
Returns SXX for each variable
i=1
MR_GET_VAR
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-53
var is a numeric array of size BS_SIZE; on return the
first nval values contain the variances for the
independent variables and var[nval+1] contains the
variance for the dependent variable.
MR_INIT
This function initializes the sums array and the count of values. These are used in subsequent calls to the
other regression routines.
Any number of regression analyses may be performed simultaneously, but there must be one
MR_INIT call for each analysis, and each one must use different variables for the three arguments.
MR_SOLVE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-54
MR_STATISTICS
This function must be called before any of the MR_GETxxx statistics query functions are called. The
regression statistics are calculated and stored for use by the MR_GETxxx query functions. Note that since
this function calls MR_SOLVE, a separate call is not required.
call MR_STATISTICS ( nval, sums, suminv, bs )
where:
MR_USAGE_CODE
MR_VALUE
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-55
count is modified and is the updated count of the number of
points in the regression;
The first nval elements of the vals argument are the independent variables; the dependent variable is
passed in element [nval+1] of vals.
Miscellaneous
DEGTODMS
where:
For example:
counter1 = 105.1003591667
DEGTODMS ( 'full', counter1 )
returns: 105 6' 1.2390012001"
DEGTODMS ( 'abbrev', counter1 )
returns: 105 6 1.2930012001
DEGTODMS ('survey', counter1)
returns: 105.060129300120
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-56
DISPLAY_ERROR
DISPLAY_MESSAGE
DMSTODEG
For example:
counter1 = DMSTODEG ('105.0601293')
counter1 = DMSTODEG ('105 6 1.293')
counter1 = DMSTODEG ('105 6" 1.293"')
are equivalent, and all would set counter1 to 105.1003591667 degrees.
Refer to the DEGTODMS for converting numeric degrees to a degrees, minutes and seconds string.
RAINBOW
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-57
min is a numeric specifying the lower limit;
max is a numeric specifying the upper limit.
If the passed value is less than or equal to the minimum, blue (#0000ff) is returned. If it is greater
than or equal to the maximum, red (#ff0000) is returned. Intermediate values return results such
that colors corresponding to a rainbow are produced.
SYSTEM
Ask
The action of the Ask functions depends upon whether the environment variable MIN_DIALOGS is defined.
If it is not, the default value is returned. If it is defined, a dialog window is created with the default value
displayed, and the entered value is returned.
ASKL
ASKLIT
ASKN
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-58
prompt_string is a string containing the prompt to be displayed
default is a numeric containing the default value to be returned.
ASKS
ASKS differs from ASKLIT in that it returns only the first token in the entered string.
Status
This group of functions returns information about the execution status of a MapLan/VolLan module.
EXIT_STATUS
FINISH
logical = FINISH ()
Returns TRUE if no more frames of data remain to be processed by the MapLan/VolLan module.
START
logical = START ()
Returns TRUE if no frames of data have yet been processed by the MapLan/VolLan module.
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-59
External Functions
Overview
External functions may be called from within a MapLan/VolLan program. Because the MapLan/VolLan
program is converted to C, it is easier if the external function is also written in this language, although
Fortran may also be called if the argument passing mechanism is compatible.
Example
The following is an example of a MapLan/VolLan program which uses an external function:
PROGRAM: EXTTEST
INPUT
GRID_IN
LOCAL
OUTPUT
GRID_OUT1, GRID_OUT2
START:
.cc_begin
extern double ufunc ( double in_grid, double* out_grid );
.cc_end
dowhile GET_FRAME ()
.cc_begin
grid_out1 = ufunc ( grid_in, &grid_out2 );
.cc_end
call PUT_FRAME ()
enddo
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-60
end
Future Changes
It is proposed that in a future release of Geolog, this procedure will be simplified. The module which
translates MapLan/VolLan code to C will have the ability to process a header file containing the prototypes
for external functions. This will eliminate the need to use C mode directly and allow the external function
to be called directly from MapLan/VolLan. The above example would then become:
#include <ext_header.h>
START:
dowhile GET_FRAME ()
log_out1 = ufunc ( grid_in, grid_out2 );
call PUT_FRAME ()
enddo
end
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-61
Expressions
Overview
This section is a guide to expressions which are used to evaluate results in grid expressions, evaluate
modules, etc. The functions are described in detail in the section on Functions.
Functions
Logical
Relational
EQ == EQ(a,b) or a == b
GE >= GE(a,b) or a >= b
GT > GT(a,b) or a > b
LE <= LE(a,b) or a <= b
LT < LT(a,b) or a < b
MISS MISS(exp)
NE <> NE(a,b) or a <> b
Numeric
ABS ABS(a)
ACOS ACOS(a)
ASIN ASIN(a)
ATAN ATAN(a)
ATAN2 ATAN2(a,b)
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-62
COS COS(a)
DIVIDE / DIVIDE(a,b) or a / b
DROUND DROUND(a)
EXP EXP(a)e**a
IFC IFC(logical,a,b)
INT INT(a)
LIMIT LIMIT(VALUE, MIN, MAX)
GRID GRID(a)base e
GRID10 GRID10(a)base 10
MAX |> MAX(a,b) or a |> b
MIN |< MIN(a,b) or a |< b
MINUS - MINUS(a,b) or a - b
MOD MOD(a,b)
MULTIPLY * MULTIPLY(a,b) or a * b
NINT NINT(a)
NONMISS NONMISS(a,b,c...d) max 10 args
PLUS + PLUS(a,b) or a + b
RAISE ** RAISE(a,n) or a**n
RANDOM RANDOM(min,max)
RANNORMAL RANNORMAL(mean,std_dev)
ROUND ROUND(a)
SIGN SIGN(a,b)
SIN SIN(a)
SQRT SQRT(a)
TAN TAN(a)
UMINUS - UMINUS(a) or -a
String
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-63
TABLE TABLE ( "string1", "string2" )
TOKEN TOKEN(string,n)
TRIM TRIM(string)
UPCASE UPCASE(string)
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-64
Index
C
constants
predefined in MapLan/VolLan 19
control statements in MapLan/VolLan 20
creating modules using MapLan/VolLan 3
D
develop MapLan/VolLan modules 3
E
expressions
guide 62
L
line control in MapLan/VolLan 16
logs
analysis algorithms, programming language for 4
M
MapLan 3
MapLan/VolLan
control statements 20
database access management 4
expressions guide 62
functions, methods of calling 26
input variables 14
line control 16
local variables 14
modules, methods of creating 3
output variables 15
predefined constants 19
program structure 13
variable names 13
Maplan/VolLan
aritmetic and logical operators 17
methods
of calling MapLan/VolLan functions 26
of creating MapLan/VolLan modules 3
modules
writing MapLan/VolLan 3
P
program
structure of MapLan/VolLan 13
writing in MapLan/VolLan 3
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-65
V
variables
MapLan/VolLan input 14
MapLan/VolLan local 14
MapLan/VolLan output 15
names in MapLan/VolLan 13
VolLan 3
Paradigm™ Rock & Fluid Canvas™ 2009 | Epos® 4.0 MapLan/VolLan 2-66