geolog6.6 loglan programming tutorial

Upload: jimmymorelos

Post on 13-Oct-2015

118 views

Category:

Documents


4 download

TRANSCRIPT

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    1/71

    Geolog 6.6

    Loglan Programming

    Tutoria

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    2/71

    Geolog 6.6 - Loglan Programming Tutorial 01 / 2006

    Content

    Introduction to Geolog'sLoglan Programming Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Tutorial Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Loglan Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    What is Loglan?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    Create a New Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    The Loglan Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    The Loglan Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Loglan Program Development Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    Starting Loglan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    Loglan Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    The Module Launcher Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    Single Well Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    Multiwell Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    How to Write a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    Make a Plan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Make the Code Maintainable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    Make the Code Robust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Remain Logical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Re-Use Existing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Loglan Language Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Source File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Types of Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Loglan Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    Arrays in Loglan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Log Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    External Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    3/71

    Geolog 6.6 - Loglan Programming Tutorial Introduction 1

    Introduction to Geolog's

    Loglan Programming Tutorial

    Welcome to Paradigms Geolog Loglan Programming tutorial.

    This tutorial teachs you to develop log processing modules to perform your own processing

    algorithms on your Geolog data. These modules will be fully integrated into the Geolog6environment, and will function in exactly the same way as any other module in Geolog6.

    The tutorial guides you through:

    a simple example to give you a feel for how Loglan works

    the general structure of a Loglan program and the program development interface

    Loglan variables

    the Module Launcher interface

    an introduction to general programming principles

    specific details of the syntax of the Loglan language

    A number of exercises are included throughout to demonstrate concepts and to allow you tocheck your progress.

    Prerequisites

    Basic familiarity with the Geolog6 environment is the only prerequisite for this course, although

    some prior experience with programming concepts would be helpful. Geologs online help forLoglan also provides further information.

    Document Conventions

    In this document, all INPUT to the computer is in Bold Courier New, while all OUTPUT fromthe computer is in Courier New, but not bold.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    4/71

    Geolog 6.6 - Loglan Programming Tutorial Introduction 2

    Tutorial Data

    The following additional files (files not supplied with software) are used in this tutorial:

    DATA: stars_master.unl

    nuke.asc

    sonic.asc

    REPORTS:

    LAYOUTS: SECTIONS:

    LOGLAN: ./examples/ans*.lls and ans*.info

    c_extern.c

    extern_c.lls and extern_c.info

    launcher.lls and launcher.info

    validation.lls and validation.info

    SPECS:

    PLOTS: WELLS: atlas

    botein

    capelladeneb

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    5/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Overview 3

    Loglan Overview

    What is Loglan?

    Loglan (an acronym for Logging Language) is Geologs log processing language and provides

    the Software Development Kit for Geolog.

    Loglan is a programming language especially suited to log processing and its syntax is similar

    to that of C, but it is reasonably intuitive so familiarity with C is no great advantage for learningLoglan. It does help if you have a programming background, if only because it makes yourealise how unintelligent computers are, in that they will do exactly and onlywhat they are told

    to do!

    Loglan is fully integrated into the Geolog environment. There is a Graphical User

    Interface (GUI) for creating and modifying Loglan programs, and, as far as Geolog isconcerned, a Loglan program is no different from any other module.

    When you compile your Loglan program, it is first translated into the C programming language;

    then it is compiled and linked to produce an executable program. To create and edit Loglanprograms, you need to have an ANSI C compiler installed on your computer. The default

    compiler used is the one provided by the hardware vendor for Unix, and Visual C++ for Windows.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    6/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 4

    Create a New Program

    Procedure

    In this section, you are introduced to the Loglan programming interface, and you will:

    create a simple program for use in Geologs Well application.

    Getting Started

    Before getting into the details of the language, we will perform a simple exercise todemonstrate how easy it is to write and run a Loglan program (do not worry if you

    do not understand exactly what is happeningthe details will be covered later).The program will calculate porosity from sonic according to the algorithm ofRaymer, Hunt and Gardner (SPWLA, 1980), valid for porosities of less than 0.37,

    using the formula:

    Eq. [1]

    and

    Eq. [2]

    where:

    is the porosity to be calculated

    is the matrix t in s/ft

    is the fluid t in s/ft

    is the value of the sonic log in s/ft

    To start the program development interface

    1. Start Geolog and open the STARS project.

    2. Start the Well application.

    Exercise 1

    2 tma

    t------------ 1+=

    tm

    2tfl------------ 1=

    tma t

    tfl t

    t

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    7/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 5

    3. Open the BOTEIN well.

    4. On the Well menu, select General > Loglan... to open the Loglandevelopment interface mui_loglanand present its base window.

    5. Select Loglan > Newto display the Loglan Properties dialog box (seeFigure 2).

    Figure 1: Blank Loglan Window

    Menu Bar

    Toolbar

    Message Area

    Status Bar

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    8/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 6

    6. In the "Program" field, enter the program name rhg_por.

    7. In the "Description" field, enter Raymer-Hunt-Gardner Porosity.

    8. Do notenter a layout name. This field allows you to specify a layout to beopened automatically when the Loglan program is executed.

    9. Leave Hide insensitive arguments as toggled ON. This means insensitivearguments wil not be displayed when the program is run in Geologs Module

    Launcher (the SHOW INSENS checkbox will be toggled OFF in the ModuleLauncher).

    10. Click OK open the Loglan window ready for program creation.

    Figure 2:Loglan Properties Dialog Box

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    9/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 7

    The Loglan window contains three tabs; Input/Output, Source and

    Description.

    Input/Output Tab - Inserting Variables

    The program variables and the interface displayed when the program is executedare defined here. This information is saved as .infowhen the

    loglan is saved.

    The next step is to define the variables required by our program:

    an input sonic log, DT

    two input constants, DT_MA and DT_FL, for the matrix and fluid delta t

    an output porosity log which we will call PHIE_RHG

    another output porosity log limited to the range, zero to one, which we will call

    PHIE

    a temporary (local) variable alpha

    You can insert variables with a mode of input, input/output, and output, and Local

    variables. In this example, you will insert six rows on the Input/Output tab forvariables DT,DT_FL, DT_MAS, PHIE_RHG, PHIE,and alpha.

    Figure 3: Loglan Window Ready for the New rhg_por Program

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    10/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 8

    11. Select Edit >Insert(or press Insert on the keyboard) to display the Insert

    Row window.

    12. Enter DT(for the sonic log) as the Name, set the Location to Logand the

    Mode to Input, and click OK.

    13. Repeat steps 11. and 12. using the data provided in the following table.

    Specifying units

    A default list of applicable units is generated if the Name is defined in theloginfo file (e.g., if the log name used is DEPTH, a list of valid length units,

    such as metres, centimetres, millimetres, is generated).

    14. In the Input/Output tab, ensure the units for DT_FL, DT_MA, and DTare set

    to s/fand the units for PHIE and PHIE_RHG as v/v(volume ratio).

    NAME LOCATION MODE

    DT_FL

    This is set to Input-Output so that when the

    program is run, the value we enter is saved and

    then used as the default next time the program is

    run.

    The reason we make this an interval value rather

    than a constant is that the value is intervalrelated. If we are not processing intervals, the

    value will be obtained from and saved as a well

    constant; otherwise, a log in the interval set will

    be used.

    Interval Input/Output

    DT_MA Interval Input/Output

    PHIE_RHG Log Output

    PHIE

    This is a copy of the PHIE_RHG curve limited

    between zero and one.

    Log Output

    ALPHALocal variables are used within the program for

    "local" processing, and are not input or output.

    Local "greyed out"

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    11/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 9

    Specifying default values

    15. The following values are used as the defaults when the program is run if

    values cannot be obtained from the constants or interval information:

    Default value for: use:

    DT_FL 189

    DT_MA 55.5

    The following specifies the default curve names for the output logs, which will

    be placed into the output set when the program is executed.

    Default value for: use:

    PHIE_RHG PHIE_RHG

    PHIE PHIE

    Specifying comments

    16. Edit the Comments as shown in Figure 4:

    Source Tab - Entering the Code

    The actual Loglan code for the program is typed into the Source tab.

    To indent text, press the Spacebar or Ctrl+Tab.

    Figure 4: Completed Input / Output Tab of Loglan Program

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    12/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 10

    17. Click the Source Tab and enter the code as shown in Figure 5using the

    following guidelines:

    Instructions which are to be executed for each frame of data must beentered within the dowhile get_frame ()enddoloop. Instructions

    before or after this loop are executed only once.

    As the variable alphais a local variable and is constant throughout the wellor interval, it does not need to be recalculated for every frame. Therefore, it

    can be placed BEFORE the dowhile get_frame ()enddoloop.

    To toggle off the Arguments table click the icon.

    Description Tab - Entering Program Documentation

    18. Click the Description Tab and type in the description as shown in Figure 7.

    Figure 5: Code for Loglan Program Entered in Source Tab

    Argument Table

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    13/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 11

    19. Select Loglan > Save.

    This creates two files in the loglandirectory in the local project area:rhg_por.llswhich contains the source code and rhg_por.infowhich

    contains descriptive information about the loglan, as well as information onhow to control the variables displayed in Geologs Module Launcher.

    20. Compile the program by selecting Tools > Compile.

    If your program compiles successfully, the message

    Loglan program compiled okis displayed

    in the Message area at the bottom of the Loglan window. The program can berun in the same way as any Geolog-supplied program.

    Executing the program

    21. Close the Loglan application and return to Geologs Well application.

    22. In Well, select General > Module...to invoke Geologs Module Launcher and

    open the File Select dialog box.

    Figure 6: Description Tab

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    14/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 12

    23. Select the rhg_por.infomodule to open the Loglan program you have justcreated (see Figure 8).

    Figure 7: Geologs Module Launcher

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    15/71

    Geolog 6.6 - Loglan Programming Tutorial Create a New Program 13

    24. Click Startto execute your Loglan program.

    Note

    If you are running with metric units, the values displayed for DT_MA and DT_FL are in s/m, but

    they are passed to your Loglan program in s/f.

    Figure 8: rhg_por Module Displayed in Geologs Module Launcher

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    16/71

    Geolog 6.6 - Loglan Programming Tutorial The Loglan Environment 14

    The Loglan Environment

    Procedure

    The Loglan environment has three components the Loglan program, the Loglan

    development interface mui_loglan, and the Module Launcher. In this section, you will learnabout the Loglan program. The Loglan development interface mui_loglanis covered in"Loglan Program Development Interface" on Page 17, and the Module Launcher, a

    component of both Geologs Well and Project applications, is covered in "The ModuleLauncher Interface" on Page 31.

    The Loglan Program

    A compiled Loglan program actually comprises three files:

    the source code file, identified by the .lls (loglan source) suffix

    the module information file (identified by the .info suffix)

    the executable file created when the Loglan program is compiled (no suffix on

    Unix, .exe on Windows).

    Loglan Source File

    The source file consists of a header section with the program description as

    entered in the Description tab (see Figure 6 on Page 11) of mui_loglan, then a listof the variables used by the program, followed by the executable code. Using the

    program created in Exercise 1, the source filerhg_por.llscontains:

    PROGRAM: RHG_POR Raymer-Hunt-Gardner Porosity

    /*-------------------------------------------------------------

    /*start_doc

    /*This program calculates the Raymer Hunt Gardner

    /*porosity using the equation:

    /*

    /*Porosity = -alpha - SQRT ( alpha**2 + DT_MA/DT -1)

    /*

    /*where:/*

    /*alpha = DT_MA/(2*DT_FL) -1

    /*

    /*end_doc

    /*-------------------------------------------------------------

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    17/71

    Geolog 6.6 - Loglan Programming Tutorial The Loglan Environment 15

    INPUT

    /*

    /* INTERVALS --------------

    /*

    DT_FL US/F /* Delta T Matrix

    DT_MA US/F /* Delta T Fluid

    /*

    /* LOGS -------------------

    /*

    DT US/F /* Sonic log

    LOCAL

    alpha /* Temporary

    OUTPUT

    /*

    /* INTERVALS -------------- /*

    DT_FL US/F /* Delta T Matrix

    DT_MA US/F /* Delta T Fluid

    /*

    /* LOGS -------------------

    /*

    PHIE_RHG V/V /* Limited porosity

    PHIE V/V /* Raw proosity

    START:

    /* Calculate the constant before looping through the data.alpha = DT_MA / ( 2 * DT_FL ) -1

    /* Now loop through the data calculating the porosity.

    dowhile GET_FRAME ()

    /* Skip calculation if value is missing.

    if ( DT == MISSING ) then

    goto finish

    endif

    PHIE_RHG = -alpha - SQRT ( alpha**2 + DT_MA / DT -1 )

    /* Apply limit.

    PHIE = LIMIT ( PHIE_RHG, 0, 1 )

    finish:

    call PUT_FRAME ()

    enddo

    end

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    18/71

    Geolog 6.6 - Loglan Programming Tutorial The Loglan Environment 16

    TIP

    Generally, source files are edited using the Loglan program development interface (Loglanwindow) but it is quite easy to edit them using your favourite editor. If you want to edit source

    files using a text editor other than the Loglan window, you should be very careful whenchanging anything before the START:label. Variables should be inserted, deleted and

    modified only through the Loglan window, since changes to these require the .infofile to bechangedthis process is handled automatically by mui_loglan.

    Module Information File

    The module information file, identified by the .infosuffix, is a Geologspecification file which controls the appearance of the module, including default

    values and logs, comments, data validation and the visibility of variables in theModule Launcher window, when invoked from Geologs Well or Project

    applications.

    This file should not be changed except through the Loglan window.

    Executable File

    This file has no suffix under Unix, and a suffix of .exeunder Windows; it is created

    by the Loglan compilation procedure.

    All of these files are stored in the loglandirectory of the local project. If they areto be made available to your entire company, they can be copied to your site/

    loglandirectory. It is good practice to create programs with names that describe

    what they are designed to do.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    19/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 17

    Loglan Program Development Interface

    Procedure

    In this section, you will learn the various methods for starting the Loglan development interface

    (Loglan window) and the components of the interface are covered in detail. You will:

    Practice using most of the commands available in the Loglan window.

    Edit a program which demonstrates validation string usage.

    For the remainder of this manual, the "Loglan program development

    interface" will be referred to as the "Loglan window".

    Starting Loglan

    The Loglan window can be opened using several different methods:

    From Geologs Project or Well application menu, select General > Loglan...

    OR

    From Geologs Launcher Bar, click on the Loglan button or selectApplications > Loglan.

    OR

    At a Unix prompt, enter geolog6 mui_loglan.

    The Loglan window is fully documented in Geologs Loglan online help documentation, so themain points will be mentioned only briefly here. Loglan operation is quite intuitive.

    1. If you do not have a Loglan window already open, open one now so that youcan try out the commands as they are explained.

    Create a New Loglan Program

    2. Select Loglan > Newfrom the menu to create a new Loglan program.

    Open an Existing Loglan Program

    3. Select Loglan > Opento open and edit an existing Loglan program.

    Exercise 1

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    20/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 18

    Save a Loglan Program

    4. Select Loglan > Saveto save the currently open program. NOTE, however,that this command does not create a new executable; to do that you have to

    use the Compile command.

    Save a Loglan with a Different Name

    5. Select Loglan > Save As...to save the currently open program under adifferent name.

    Run Command

    6. Select Loglan > Run...to execute an external program or command.

    Delete a Loglan Program

    7. To delete an existing program which is no longer required, select Loglan >

    Delete...All the files associated with the program (the source, information,and executable files) will be deleted.

    Exit the Loglan Window

    8. Select Loglan > Exit. If any of your loglans have not been saved, you are

    prompted to Save or Discard the open Loglan program, or Cancel the Exitcommand.

    Edit Menu

    Undo Only available when a row has been removed in theInput/Outputtab.

    Insert Used for inserting rows in the Input/Output tab in whichprogram inputs and outputs are defined.

    Find Select to open the Find dialog box. If you have the Input/

    Output tab selected, the Quick Find dialog is displayed; ifyou have the Source or Description tab selected, the

    Loglan Find dialog box is displayed. Sort Sorts Input/Output variables by location.

    Sort By Name Sorts Input/Output variables by location and name.

    Properties... Display/modify details of the program's name, descriptionand documentation.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    21/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 19

    Externals... Specify the path names for included files and directories,

    external libraries and directories, external objects, andthe Linker used to load the compiled program.

    Loglan programs are converted to C language and

    compiled to produce an executable module. This requiresa C compiler in your environment. The environmentvariable MIN_CC defines the C compiler to be used.

    Code... Start the editor specified by the environment variableMIN_EDITOR to edit the Loglan code. If a compile error

    has previously occurred, the editor will be startedpointing to the line containing the first error.

    The editor must start up in a new window, and the

    mui_loglan window is blocked until the editor exits. If no

    editor is specified by the environment variable, "xtermvi" is used. Emacs (usually /usr/local/bin/emacs) is agood choice.

    Description... Used to enter a detailed description (programdocumentation or users guide) via the editor specified by

    the environment variable MIN_EDITOR.

    Input/Output Table Click the Table Menu icon to display editingfunctions for the Input/Output tab (see Figure 9).

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    22/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 20

    Tools Menu

    The commands on the Tools menu perform the tasks described below:

    Compile Compiles the program. Error messages are displayed

    in the message area of the Loglan window. Requires anANSI-C compiler.

    Windows 2000/XP requires Microsoft Visual C++

    version 4, 5 or 6. The installation path cannot containspaces (except for the "Program Files" section).

    Site Install After compiling the loglan, select this option to installthe program to the Site area to make it available to all

    users.

    Function Maintenance Select this option to create/modify user defined

    functions.

    View Menu

    Functions Table Select this option to toggle the display of a Functionslist.

    Figure 9: Table Menu

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    23/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 21

    Arguments Table Use this option to toggle the display of the Arguments

    table while viewing the Source tab.

    Compile Output Use this option to toggle the display of the compilationoutput window on the Source tab.

    Loglan Variables

    As mentioned previously, a Loglan program consists of basically two parts:

    the variables or data on which the program operates, and

    the code, or instructions, executed by the program.

    Variables in Loglan have a number of attributes, most of them displayed in theInput/Output tab of the Loglan window. These include the name, location, mode,

    units, default, comment, validation and visibility of the variable.

    Location

    A variable's location defines its source and destination, and may be one of:

    Parameter

    This is generally used for input data which is not well or interval dependent. It is

    usually more convenient to use a constant instead.

    ConstantThis is used for data which is not interval dependent. For Input or In/Out variables,

    the value used for a constant will be obtained from the well header constant withthe same name as the variable. If no such constant exists, the default value

    specified in the Loglan program is used. For Output or In/Out variables, it will bestored as a well header constant when the Loglan program is executed.

    Variable

    attributes

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    24/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 22

    Log Constant

    These variables must have a name of the form _, where is the name of a log header constant such as UNITS, MAX,

    MEAN, etc. (see the Loglan online help for further information), and is the name of a log used in the program.

    Interval

    Interval variables are similar to constants, except that values will be obtainedfrom and stored in a log in the current interval set. If you are not using interval

    processing, well header constants will be used. These are used for data whosevalues are interval dependent.

    LogThis is used for variables whose values vary for each frame (i.e., for log data).

    LocalFor variables used only within the Loglan program, usually as temporary

    variables to hold intermediate results. Local variables are not stored in the.infofile, so are never displayed in the Module Launcher window.

    Mode

    A variable's mode defines the way in which it is processed by the ModuleLauncher. It must be one of:

    InputFor variables which are read by the Loglan module but are not to be written

    back to the well.

    In/Out

    For variables which are used both as input for the Loglan module and output tothe well after the module has executed. Often, this mode is used for constants

    and interval parameters so that the values used for an analysis will be stored inthe well and used as defaults next time the Loglan module is run.

    OutputFor variables which are calculated by the Loglan module and are to be stored in

    the well.

    Name

    Valid names must start with an alphabetic character, and the other characters

    must be alphabetic, numeric, or the underscore character. The name may be nolonger than 32 characters for input or output variables, while the limit for local

    variables is 63 characters. A name may not end with an underscore followed by anumber, as this could be confused with a version number.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    25/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 23

    There are a number of names which cannot be used:

    words which are reserved in the Loglan language itself (such as endif);

    those reserved in the C language (such as case);

    those whose names conflict with standard functions used by the C language.

    There is a complete list of these in the Loglan online help documentation, but youdo not really need to know the list, as the compile step will report any

    transgressions. Names of the form _ should be avoided, sincethese may be confused with Log Constants (see "Log Constants" on Page 66). It

    is good programming practice to use meaningful names: this makes it easier forothers to understand what is going on if they need to look at the code.

    Type

    Variables can be of type Alpha, Numeric (Integer, Real, or Double), or Logical.

    Alpha

    Alpha variables have an alpha string value and are defined using the followingsyntax:

    Log Name Type Comment

    Log alpha*num /* General case

    The units alpha*num specify the maximum number of characters which may be

    assigned to the variable. Any characters beyond num will be truncated. Thedefault length (if the "*num" is omitted) is 4. The maximum length is 72 for

    INPUT/OUTPUT variables and 1024 for LOCAL variables.

    Numeric

    Any variable which is not declared Alpha or Logical is numeric. The units can beany valid units defined for the variable in the unit category specified in the

    variable's loginfo definition.

    Logical

    Logical variables have the values TRUE or FALSE and are useful for flags,

    switches or toggles.

    Unit

    For a unit to be valid, the variable to which it applies must be defined in a loginformation (loginfo.loginfo) file, and the unit must exist in the unit categoryfor that variable. It is usually easiest to use the List Select dialog box.

    Note: Units cannot be specified for Local Variables.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    26/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 24

    The way the units are used depends on whether the variable is input or output (for

    In/Out, both apply).

    Input variables

    If you specify valid units for an input variable then, when the Loglan programexecutes, its data will be passed in those units, irrespective of the units in which

    the data is held in the well and displayed, provided the units in the well are valid.

    If either the Loglan units or the data units are invalid (or blank), then no unit

    conversion can be performed by the Module Launcher and an error will bereported unless the Loglan units are blank. For character variables, the data will

    be truncated (if the Loglan length is less than that of the data in the well), orpadded with spaces (if the Loglan length is longer). If no units are specified for a

    numeric variable, the Loglan program will receive the data in the units in whichthe data is stored in the well. The log constant UNITS_ can be used

    to access these units. This is often useful when reporting data.

    Output variables

    If you specify valid units for an output variable, these will be used only if thepreferred units for the variable are blank; otherwise, the data will be stored in

    (after conversion to) the preferred units. If the units in the Loglan program areblank, the variable is assumed to be in the preferred units. For character

    variables, the length specified in the Loglan program will be used only if thevariable does not already exist in the well; if it does already exist, the length will

    not be changed and the data will be truncated or padded with spaces, asrequired.

    Default

    The interpretation of the default depends on both the variable's location and itsmode (see "Location" on Page 21and "Mode" on Page 22).

    Terminology

    In the descriptions below:

    Launcher defaultmeans the value displayed in the Module Launcher (and used by the

    Loglan program when it is executed).

    Loglan defaultis the value specified as the default in the Input/Outputsection of theLoglan window.

    Note that the following discussion implies that there is no defaults file for the

    module; the use of a defaults file is explained in "Notes on Saving" on Page 38.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    27/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 25

    Log constants are not included in this discussion since they do not appear in the

    Module Launcher window.

    For local variablesthe Loglan default is ignored. These variables do not appear on the Module

    Launcher window.

    For input logsthe Launcher default is a log with the same name as the input variable. The

    Loglan default is used only if the log with the same name as the variable cannotbe found. If the variable is numeric, and the Loglan default is numeric, theLoglan default will be used as a constant value of the input log for all frames

    processed by the program. If the variable is numeric, and the Loglan default is aname, then, if a log of that name exists, it will be used as input to the Loglan

    program; otherwise, the Loglan default is ignored. If the variable is of typecharacter (alpha), the Loglan default will be used as the name of a log if that log

    exists; otherwise, it will be used as a constant value.

    For input constants

    the Launcher default is the value of the well header constant with the samename as the input constant. The Loglan default will be used if its type (i.e.,

    numeric or alpha) matches the type of the constant, and if the constant with thesame name as the input variable does not exist in the well. If the types do not

    match, the Loglan default is ignored.

    For input interval constantsthe Launcher default is the value of the log (in the interval set) with the same

    name as the variable, for the current interval. If that log does not exist, or ifinterval processing is not enabled, the Launcher default is the value of a well

    constant with the same name as the variable. If that does not exist, then theLoglan default will be used if its type (i.e., numeric or alpha) matches the type of

    the interval constant; if the types do not match, the Loglan default is ignored.

    For input parametersthe Loglan default will be used if its type matches the type of the parameter; if

    the types do not match, the Loglan default is ignored.

    For output logsthe Launcher default (i.e., the name of the log produced by the Loglan program)

    is the Loglan default, which must be a valid log name.

    For output constants and interval constants

    the Loglan default is ignored. Interval and well constants are always createdwith the name used in the Loglan program, and the value output by theprogram.

    Output parametersshould not be used.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    28/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 26

    For Input/Output logs

    the Launcher default is a log with the same name as the variable. The Loglandefault is used only if the log with the same name as the variable cannot be

    found, in which case the Loglan default must be a valid log name.

    Input/Output constants and interval constantsare handled in the same way as input constants and input interval constants,

    respectively.

    Input/Output parametersshould not be used.

    Comment

    The comment is displayed on the Module Launcher window and should thereforebe meaningful. It is also stored in the well as the comment for any logs or

    constants created by the Loglan module when it is run.

    Validation

    Validation specified in the Loglan window is applied in the Module Launcher whenthe value of an entry is changed, and when Startis selected. There are two types

    of validationlists and ranges. For strings, only list validation is permitted. Thevalidation is ignored for logical variables.

    A range validation

    is a string of the form lower limit:upper limit, or lower limit

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    29/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 27

    Visibility

    Defines input/output visibility when a Loglan module is executed. If TRUE, the

    entry is displayed when the program is executed. If FALSE, the entry is notdisplayed when the program is executed.

    If the visible parameter is a statement in the following form:

    variable1:[!]value[,value...]

    and is true (if variable1 has any of the specified values), the parameter is visibleand active. If the condition is false, the parameter is not displayed unless the

    SHOW INSEN button in the Module Launcher is toggled ON, in which case, it willbe inactive (grayed out). Case is ignored when the value is tested. Use of the !

    (exclamation mark) reverses the sense of the test.

    Example:

    RHO_DSH visibility may be controlled by OPT_PHITYPE:TOTAL. See Figure 10for

    an example.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    30/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 28

    If controlling visibility with a logical (e.g. OPT_COAL), the following syntax must be

    used:

    OPT_COAL:YES or OPT_COAL:TRUE or OPT_COAL:1

    If more complex control over visibility is required, an expression may be used. Thismust be a quoted string, and has exactly the same form as a logical expression in

    Loglan (see "Logical expressions" on Page 45).

    Figure 10: Examples of Visibility in the Module Launcher

    OPT_SON is set to FALSE and therefore,

    is not visible in the Module Launcher.

    OPT_PHITYPE is not set

    to TOTAL, and Show

    Insens is toggled on so

    RHO_DSH is "grayed

    out" - visible but inactive.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    31/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 29

    For example:

    "FILTER_TYPE'EXTERNAL' & FILTER_TYPE'KLAUDER' & PHASE_MODE ==

    'CONSTANT'"

    Note that if you are using this form, all literals (character constants) must be

    quoted using single quotes.

    The objective of this Validation exercise is to test the different kinds of validationavailable in Loglan programming.

    1. Open the Loglan program, validation.lls, in the Loglan window, andvalidation.infoin the Module Launcher to see the results of the differentvalidation strings used.

    Exercise 2

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    32/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Program Development Interface 30

    Note that for variable a3, a blank is allowed. The Dropdown List (in the

    Module Launcher window) contains a blank at the end of the list. Click belowthe last item in the list to select the blank.

    2. In the Loglan window, insert an Input Constant as follows:

    call it BS;

    set units to inches;

    set the default to 7 inches;

    set the value to be between 3.625 and 18 inches;

    set visibility to be true when ALPHA_LIST:val2.

    3. Save the changed programthere is no need to compile since we will not beexecuting the program.

    4. Update the Module Launcher window by selecting Launcher > Module...andreopening the module.

    5. Toggle on Show Insensto view the BSconstant.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    33/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 31

    The Module Launcher Interface

    Procedure

    In this section, you are introduced to the components of the Module Launcher interface and

    you:

    practice using the various components of the Module Launcher.

    Overview

    The Module Launcher is a component of both Geologs Project and Wellapplications and multiwell analysis is carried out within both of these applications.

    In Well, several wells can be loaded into memory, processed, and the changes

    saved to the database or discarded, as required. You should use the Wellapplication where only a few wells need to be open at one time. Where a largenumbers of wells are to be processed simultaneously, use the Project application,

    as the wells are not stored in memory, and data is immediately processed andsaved to the database.

    We discuss the Well interface first using "Single Well Processing" below, and thenexamine the additional facilities in the Project interface (see "Multiwell Processing"

    on Page 40).

    The Module Launcher window is exactly the same for a Loglan program as it is forany module which is part of Geolog. A user defined module is opened by selecting

    General > Module...from the menu, and specific modules are opened directly byselecting the relevant menu command (e.g. General > Evaluate).

    Single Well Processing

    1. If it is not already running, start the Well application and open the

    BOTEIN well.

    2. Select General > Module...to open the Module Launcher and the File Select

    dialog box (see Figure 11).

    Exercise 1

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    34/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 32

    3. Enter or locate the required filefor this exercise, open launcher.info.

    See "Using Geolog" in the online help documentation for further informationon using the File Select dialog box.

    4. Click OK. This causes the .infofile to be read and the module arguments

    will be displayed in the Parameters section of the window (see Figure 12).

    Figure 11: File Select dialog box - Opening a Module

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    35/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 33

    Input Set

    The set displayed is either the set specified for the module, or, if not specified, thedefault set specified for the application (select Well > Default Set...). Logs to be

    processed by the module come from this set, unless otherwise specified. For

    instance, in Figure 12, if COR.DT is entered, the DT log from the COR set is used,rather than the DT log from the WIRE set.

    5. To change, click on the Set Select icon to select from a list of availablesets, or enter a set name in the field.

    In previous versions of Geolog, when the Input Set was changed, allParameters were reset to the defaults for the module. This no longer occurs.

    To reset the Parameter defaults, select Launcher > Reopen.

    Output Set

    The set displayed is either the set specified for the module, or, if not specified, thedefault set specified for the application (select Well > Default Set...). Logs to beprocessed by the module are written to this set, unless otherwise specified. Forinstance, in Figure 12, if COR.PHIE is entered, the PHIE log from the COR set is

    used, rather than the PHIE log from the WIRE set).

    If the set specified does not exist, it is created.

    Parameters

    section

    Figure 12: Components of the Module Launcher

    Sampling Log

    Input /

    Output Sets

    Set Processing Limits

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    36/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 34

    6. To change, click on the Set Select icon to select from a list of available

    sets, or enter a set name in the field.

    To specifiy an Input Set or an Output Set for a Loglan prgram, create an

    ALPHA input parameter called SET_IN or SET_OUT and use the requiredset name as the default.

    Sampling Log

    7. Click on the Log Select icon to display a Log Select dialog box and

    select the name of the log which will control the sampling (i.e., the dataframes) of the input data to be passed to the module.

    If this field is left blank, the input/output sample rate is determined by the input

    sets reference (e.g. depth) or, if no input set is specified, by the first input log.

    Set Processing Limits

    8. Click the Set Processing Limitsbutton to open the Datum dialog box tospecify whether interval processing is to be used (and, if so, which intervals

    are to be processed), or the range of reference values to be processed.

    Parameters Section

    The Parameterssection is a table displaying all the visible arguments used by the

    module (log constants are never displayed because they are automatically derivedfrom the associated logs).

    colors

    The colors in the table depend on both the Mode and the Location of the module

    parameters. Data displayed with a colored background is read-only. The Valuecolumn (white background) can be edited. The Location, Mode, Comment, Unit

    and Name columns come from the variable definitions in the Loglan program, andare described in "Loglan Variables" on Page 21.

    If interval processing has been selected (either by clicking on the Set Processing

    Limits...button or selecting Well > Datum...from the menu), there is a Valuecolumn for each selected interval, and the column heading is the interval name

    rather than "Value". Also, the location for the variable "INTERVAL_IN_OUT"changes from "Constant" to "Interval", and the color of that line changes.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    37/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 35

    special module parameters

    There are a few variables which are handled in a special manner by the Module

    Launcher; these are SET_IN, SET_OUT, and INTERVAL. If your program usesSET_IN or SET_OUT as a parameter, or INTERVAL as an interval constant, these

    do not appear on the Module Launcher window but are automatically passed toyour program with the appropriate value(s). A constant named WELL also

    automatically receives a value.

    Data Entry and Execution

    Quick Entry

    For small modules, it is quicker to enter/select values directly in the Value column

    fields. For large modules, the Quick Entry option opens a dialog box whichenables you to quickly cycle through and select the required values for the Value

    column(s) in the Parameters section of the the Input/Output tab.

    To use Quick Entry for multiple intervals

    1. In the Well application, select Launcher > Moduleand selectLauncher.info.

    2. Set the processing limits to Interval, the interval log totops.tops, and

    select MALABAR FM and THORLEY FM as the intervals.

    3. For multiple value columns, where applicable, toggle the ALL column on (see

    Figure 13), to enable simultaneous multiple entries for a value entered.

    4. Click in a Value field.

    5. Select Edit > Quick Entryto display the Quick Entry dialog box (seeFigure 13).

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    38/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 36

    6. In the Quick Entry dialog box:

    double click the required value in the List field to enter the value in the Value

    column and go to the next editable cell.

    OR

    select a value and then click Apply or press ENTER to enter the value in theValue column and go to the next editable cell.

    If the ALL column is available and toggled ON, editing continues down

    otherwise, editing continues to the right.

    where there are no values in the List field, click in the Selection field and enter a

    value, then press ENTER or click Applyto enter the value.

    to skip a field, press ENTER or use the Nextbutton.

    to finish editing or cancel the operation, click Close.

    Figure 13: Using Quick Entry to enter values in Values column(s)

    ALL column

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    39/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 37

    Launcher Menu

    The Launcher menu options are used to manage modules.

    TOOLBAR MENUITEM DESCRIPTION

    Module... Opens the File Select dialog box to locate and select a module.

    A module can also be opened by:

    Selecting a relevant menu item (e.g. General > Evaluate);

    OR, selecting General > Module...in a Geolog application to

    open the Module Launcher and File Select dialog box;

    OR, selecting Appl icat ionname> Run...(e.g. Well > Run...) and

    entering the command applicationname_modulein the Run dialog

    box. An empty Module Launcher window is displayedselect

    Launcher > Module... to open a module. If you know the name of

    the module you wish to open, in the Run dialog box enter

    applicationname_module module=modulename

    For example:

    well_module module=tp_calc

    Reopen If and when required, use this function to reload the defaults for the

    currently open module. If a defaults file exists, it will be reloaded.

    Note: The manual function, Launcher > Reopen, replaces the

    automatic function in previous versions of Geolog where,

    when the Input Set was changed, the Parameter defaults for

    the module were automatically reloaded.

    Close Closes the Module Launcher window. Note that if you have not saved

    the specifications currently entered, they will be permanently

    removed (see "Launcher > Save As" below).

    Well...

    Well Previous

    Well Next

    Use to specify the well(s) to process. Not available/applicable in all

    multiwell processing applications.

    Datum Use to specify datum to use for the currently active view.

    Start Select to start execution of the module.

    Cancel Some functions run a series of modules and/or other processes. Use

    the Cancel option to cancel the operation before or after execution ofany process in the series. The entire operation will be cancelled and

    the Module Launcher window cleared. The function can then be

    restarted, or the Module Launcher closed.

    Note the Module Launcher is also cleared after a series of processes

    have been run.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    40/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 38

    Edit > Undo/Redo

    If this option is selected after the module has executed, the changes resulting fromthe execution of the module will be undone. Clicking it again undoes the effect of

    the "Undo".

    Notes on Saving

    When saving specifications, if you do not enter a file name extension, the modulename is used as the extension. If you do enter an extension, the information will besaved with the file name and extension you specify, but that file will NOT be

    automatically displayed when you select Restore(you need to change the Filter tolocate the file).

    Note: When one of the three commands listed below is selected, the Filter field in the File Select dialog

    box defaults to *.(where is the name of the currently openmodule) therefore, if you wish to find/save/delete a file with a different extension, you must

    change the filter.

    Restore... Restore previously saved or executed specifications for the module.

    When the File Select Dialog Boxopens, select your saved file (see

    Save As below) or "previous.". Geolog automatically

    saves the last specifications used when the module was run in a file

    calledprevious.(located in the project's

    specsdirectory). Therefore, when you select the Restore commandto retrieve your saved specifications, you will see files similar to the

    following:

    previous.tp_evaluate specifications when last executed

    mysettings.tp_evalutespecifications you have saved

    Use the Restore Previous icon to quickly reload (Files Select

    dialog box is not opened) the last specifications run.Note that the

    "previous" file is always REPLACED, so specifications are only those

    relevant to the last execution.

    Save As... Save the specifications you have entered in the currently open

    module. See "Notes on Saving" belowfor further information.

    Delete... Opens the File Select Dialog Boxto locate and permanently delete

    files containing previously saved specifications.

    Module Help Opens a separate window that displays the Detailed Description (see

    Figure 2 on Page 6) from the .infofile for the module

    documentation for this module. You can also click the

    button.

    TOOLBAR MENUITEM DESCRIPTION

    www.fanarco.net

    http://b/geolog6.6/using_geolog_01_basics.pdfhttp://b/geolog6.6/using_geolog_01_basics.pdfhttp://b/geolog6.6/using_geolog_01_basics.pdfhttp://b/geolog6.6/using_geolog_01_basics.pdf
  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    41/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 39

    When the values for a module are first displayed, the Module Launcher checks to

    see if a defaults.specification exists. If it does, the values inthat specification will be automatically restored. So, if you save your values with

    the name defaults, the information will subsequently be automatically restoredwhenever you run the module. This is useful if you want to always use the same

    values.

    Warning

    The saved data contains interval information. If your processing limits (i.e., intervals) are

    different from those which were applied when you performed the save, the results may not beexactly what you expect. If the data was saved without intervals, and restored with interval

    processing enabled, every interval will receive the same value.

    As well, when you select Launcher > Reopento reload the parameters, the defaults file isused, not the original defaults for the module.

    1. Select General > Loglan...and open the Loglan program, launcher.lls, inthe Loglan window (launcher.infoshould still be open in the Module

    Launcher, as well).

    2. Use this Loglan program to experiment with different modes of processing

    (i.e. interval and depth range).

    3. Open a Text view (Well > View > Text) to check the results.

    Experiment with the Undo/Redo, Saveand Restorefunctions.

    Exercise 2

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    42/71

    Geolog 6.6 - Loglan Programming Tutorial The Module Launcher Interface 40

    Multiwell Processing

    When in Geologs Well or Project application with more than one well open to beprocessed, the window displayed when you select General > Module...has an

    additional column in the Parameters section of the Input/Output tab.

    The additional column after the Name column specifies the source for theparameter; "S" for "screen", "W" to indicate the information must come from the

    well (the well is not processed if the value cannot be obtained), or "P" to indicatethe value is to be obtained from the well, if possible, otherwise the screen value is

    used.

    Multiwell processing is beyond the scope of this tutorial, and is covered in detail in

    the Deterministic Petrophysics tutorial.

    Figure 14: Multiwell Processing - Loglan Program Displayed in Module Launcher

    Extra column

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    43/71

    Geolog 6.6 - Loglan Programming Tutorial How to Write a Program 41

    How to Write a Program

    Procedure

    In this section of the tutorial, we will look at some general programming principles to help you

    get your Loglan programs written and working as quickly as possible.

    Make a Plan

    The most important part of writing a program is to have a plan showing how the

    program will operate. It does not need to be "formal": a written description of thesteps involved is often adequate, though sometimes a flowchart can be helpful if

    the program is complicated and involves a number of different paths, dependingon the data. It is often easiest to start off with a very high level plan, and then fill in

    the details later. The important point is that you have at least some kind of plan asa starting point.

    Make the Code Maintainable

    A program is almost never be perfect on the first attempt as problems may occur,

    or enhancements may be requested. It is very important to make the maintenanceand enhancement procedures as straightforward as possible, and the best way to

    ensure this is to document your code. This means using meaningful names foryour variables, adding comments as often as possible, and making sure that the

    program header explains what the program is intended to do. It is often worthwhileto keep some form of revision history.

    The Description tab (see Figure 6 on Page 11) is a facility within Loglan to place a

    documentation section in the header that allows other users or programmersinvestigating the Loglan program to know what the program is supposed to be

    doing, and how it is doing it. It cannot be stressed enough that the moredocumentation exists within a program, the easier it is for other users to

    understand the processes used.

    Another important consideration is to make your code easy to follow. It is all very

    well to do really neat, clever things, but when you or someone else needs tomodify the code some months later, practices like these can lead to frustration,

    errors and wasted time. Generally speaking, efficiency is nowhere near asimportant as maintainability.

    If your site has any standards for coding, documentation, or variable naming

    conventions, adhering to these makes it easier for others to maintain your code.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    44/71

    Geolog 6.6 - Loglan Programming Tutorial How to Write a Program 42

    Make the Code Robust

    Protecting your code against bad data and inexperienced users is also important.If there is something wrong, display an error message. Failure to do so can lead to

    wasted time on the part of the user in trying to track down the cause of erroneousresults. If you are thorough in ensuring that your data is valid, you can also prevent

    the user from having to call the programmer to sort out these problems.

    Remain Logical

    When a program does not work, and resists all your best efforts to make it work, it

    is easy to become desperate and frustrated. It is important to tackle the problem ina logical, analytical way, working through the code by hand. If necessary, use

    debugging display statements to report what the program is doing.

    Re-Use Existing Code

    Often, problems related to the one you are trying to solve will have been tackled

    before. Looking through existing code is an efficient way of learning how to goabout solving your own problem, as well as providing an insight as to how the

    Loglan language can be used. The Loglan programs included in the Geologdistribution would often be a good place to start. Generally speaking, these

    programs are well documented and well written, and provide worthwhile examplesof good programming techniques.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    45/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 43

    Loglan Language Syntax

    Procedure

    This section deals with the details of the language itself. You should also have access to the

    Loglan online help documentation, as this tutorial contains only general information to guideyou on what to look for in the documentation. You will:

    Create a program to calculate and display porosity.

    Create an interactive user input program.

    Create several programs to read or write to external files.

    Create a program to analyze data on an interval basis across multiple wells.

    Create a program using data from frames other than the current one.

    Program Structure

    The first section of any Loglan program is the declarationsection, which is used todeclare the variables used by the program. It is maintained by mui_loglan (using

    the Input/Outputtab of the Loglan window), and it should not be otherwisemodified.

    The next logical section is theprogram codesection, containing the instructions tobe executed by the program when it runs. This may be logically subdivided into:

    the initialisationsection, which contains code which does not need to beexecuted for each data frame; this code precedes the program's "dowhile

    GET_FRAME" loop.

    theprocessingsection, which contains the code to be executed for each dataframe.

    Then follows the endsection, which consists only of the keyword endand tells theLoglan processor that the end of the code has been reached. It is required only if

    the program contains subroutines. When the endstatement is executed, theLoglan program terminates.

    Optionally, there may be a subroutinessection containing segments of code which

    may be executed from within theprocessingsection. See "Subroutines" onPage 48for further information.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    46/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 44

    Source File Format

    Continuation character

    Generally, the Loglan source contains one command or statement per line. If a

    statement is long, it may be split over more than one line by terminating every linebut the last with the continuation character, ~(tilde).

    Statement separator

    More than one statement may be placed on a line by using the statement

    separator character, ;(semicolon).

    Comment

    A comment, preceded by the comment specifier,/*(forward slash and star), mayappear either on a line by itself or at the end of a statement.

    Blank lines

    Blank lines are ignored but may be used to logically group sections of code.

    Case

    Case, except in character constants, is ignored. Conventionally, local variablesare lowercase while all other variables are uppercase, but you are free to use no

    case or your own convention.

    Types of Statement

    Loglan has three fundamental types of statement:

    assignment statements used to assign a value to a variable.

    control statements change the normal sequential flow of a program;among other things, they may be used to either

    conditionally or repeatedly execute groups ofstatements.

    function call statements executes a Loglan provided function.

    We will deal with each of these types in turn.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    47/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 45

    Assignment Statements

    An assignment statement has the form:

    variable = expression

    where variableis any variable defined in your Loglan program, andexpressionis a combination of variables, constants, function calls and

    operators, whose result is a single value.

    A function call in an expression consists of the function name, an opening round

    bracket, the function argument (or arguments, separated by commas), and aclosing round bracket. For example:ATAN ( 5, 10 ). Details of the functionsavailable in Loglan are covered in "Loglan Functions" on Page 49.

    Expressions

    An expression in Loglan has two attributes, a typeand a value. The type of an

    expression may be numeric, alphanumeric or character, or logical; these are thesame types which are defined for variables. The type of an expression is determined

    by the types of the variables and constants it contains; in general, all the variables inan expression must be of the same type, and the expression in an assignment

    statement must have the same type as the variable to which it is being assigned.

    Numeric expressions

    Numeric expressions can contain numeric variables (e.g. depth), numericconstants (e.g. 3.14159), or functions returning a numeric value (e.g. SQRT),

    combined with numeric operators.

    The operators and their order of precedence are described in "Operators" under

    the "Program Syntax" section of the Loglan online help documentation. Note thatoperators of equal precedence are evaluated from left to right; thus 5/2*4evaluates to 8. This is because when all the components of an expression are

    integers, the expression will be evaluated using integer arithmetic, so 5/2 = 2. Ifyou want the evaluation performed using real values, add a decimal point at least

    one of the numbers.

    Character expressions

    Like numeric expressions, character expressions can contain character variables,

    character constants (e.g. 'Hello'), or functions returning a character value(e.g. UPCASE), combined with character operators. The only character operator is

    the concatenation operator,//.Logical expressions

    Logical expressions contain logical variables, logical constants (e.g. TRUE),logical functions (e.g. MISS), and logical operators such as NOT, AND, and OR.

    Additionally, logical expressions may contain other types of variables combinedwith relational operatorssuch as < (less than), (not equal to), etc.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    48/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 46

    Constants

    Constants, like variables and expressions, come in 3 flavours: numeric, character,

    and logical. Numeric constants are just numbers, such as 5 or 1.234. Additionally,Loglan has pre-defined numeric constants such as PI, MISSING, and TOP_DATA.

    A character constant consists of a sequence of characters enclosed in single

    quotes, such as 'Here is an example'.

    There are two logical constants, TRUE and FALSE.

    Control Statements

    Normally, statements in a Loglan program are executed sequentially. Control

    statements are used to alter this flow.

    if statement

    The ifstatement lets you conditionally execute other statements. Its basic form is:

    if ( logical-expression ) then

    statements

    endif

    This statement will cause the statements following the "if" to be executed if thelogical expression evaluates to TRUE. The brackets around the logical expression

    are optional. You may optionally have one or more elseifstatements, optionallyfollowed by an elsestatement. For example:

    if ( OPT_GR == 'LINEAR' ) then

    VSH_GR = v

    elseif ( OPT_GR == 'STIEBER1' ) then

    VSH_GR = v / ( 3.0 - 2.0 * v )

    elseif ( OPT_GR == 'LARINOV1' ) then

    VSH_GR = 0.33 * (( 2.0 ** ( 2.0 * v )) - 1.0 )

    else

    DISPLAY_ERROR ( 'Invalid option: ' // OPT_GR )

    endif

    for statement

    The forstatement is used to repeatedly execute a group of statements. Its form is:

    for = to [by ] do

    statements

    endfor

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    49/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 47

    This statement will execute the statements in the body of the loop, varying the loop

    variable from the initial value to the final value, incrementing the loop variable bythe step after each iteration. If the "by step" is omitted, a value of 1 is assumed.

    The loop is pre-tested. This means that the loop is not executed if the value of theloop variable is greater than the final value. The step may be negative. For

    example:

    sum = 0

    for i = 1 to 20 do

    sum = sum + i

    endfor

    do until statement

    This is a post tested loop which executes a group of statements until the

    termination condition evaluates to TRUE. Its format is:do

    until

    See "Program Control" under the "Program Syntax" section of the Loglan online

    help documentation for an example.

    dowhile statement

    The dowhilestatement has the form:

    dowhile statements

    enddo

    It is more or less the opposite of the do untilstatement: the condition is tested

    before the statements in the body are executed, and the loop continues to execute

    until the condition evaluates to FALSE.

    goto statement

    The goto statement has the form:

    goto

    where label-nameis a name (the validity rules are the same as for variables)which appears elsewhere in the program as a label, consisting of the label name

    immediately followed by a colon (:). This command causes execution flow to betransferred to the statement following the label. It can be useful for skipping

    sections of the program, if an error occurs.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    50/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 48

    Function Call Statements

    A function call statementis used to execute an internal Loglan function. This maybe done in one of two ways. The first method is to use the function name in place

    of a variable name, with the arguments to the function (separated by commas if

    the function has more than one argument) in round brackets after the functionname. If the function has no arguments, you must use () after the function name.The second method is to use the callcommand before the function name,

    followed by the arguments as before; in this case, the function result is ignored.This will be more fully described in "Loglan Functions" on Page 49.

    Subroutines

    A subroutine is a block of code which may be called from (often multiple places)within a Loglan program. It is often preferred to inline code to make the program

    more modular and easier to understand, or to eliminate duplication of thesubroutine code if it is to be executed from more than one place in your program.

    Subroutines are coded after the endstatement within the Loglan program (the

    endstatement causes the Loglan program to terminate execution), and areexecuted by the performcommand. A subroutine begins with a label, which is the

    name of the subroutine used in the performcommand. A labelconsists of a name(the validity rules are the same as for variables) followed by a colon (:). Then

    follow the instructions to be executed in the subroutine, including one or morereturncommands. The returncommand causes execution to transfer to the

    command immediately following the performcommand which caused thesubroutine to be called. For example:

    perform sub1

    end

    sub1:

    return

    would execute the expressions up to the performcommand, then transfer

    execution to subroutine sub1, and then jump back to the line following the performstatement.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    51/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 49

    Loglan Functions

    Much of the power of the Loglan language comes from the wide variety offunctions supported by the language. These are all described in the "Functions"

    section of the Loglan online help documentation. In this tutorial, we will discussonly the more important ones.

    All Loglan functions return a result, but often the result is ignored (for example

    put_frame). The case of the function name is not significant. Spaces around theparentheses, as well as between the arguments, are ignored.

    In the examples which follow, the word "text is used to indicate an alpha ortext variable, while "numeric" is used for a numeric variable, and logical for

    a logical variable.

    Display Functions

    At any time during the execution of a Loglan program, you can display messagesin the Message area at the bottom of Geologs Well or Project application

    windows. These messages could be results of calculations, status comments,variable input values, or any other text.

    The Loglan functions in this category are:

    DISPLAY_MESSAGE ( 'Text for Display' )

    and

    DISPLAY_ERROR ( 'Error message' )

    The argument can be either a quoted string (as in the examples above), or analpha variable or expression. Both functions display their argument in theMessage area of the window. In addition, the second function causes the Loglan

    program to abort with an error condition. It is useful if you want the program toabort if, for example, the input data is invalid. A few further examples:

    DISPLAY_MESSAGE ( 'Processing interval ' // INTERVAL )

    call DISPLAY_ERROR ( 'Invalid option: ' // option )

    Note that the callcan be omitted. In the first example, if INTERVAL was defined

    as an interval constant, it would automatically contain the name of the intervalbeing processed, if you are processing intervals (otherwise, it will be blank).

    If you want to display the value of a numeric variable, you will first need to convertits value to text using one of the functions described in "Conversion Functions" on

    Page 50. For example:

    DISPLAY_MESSAGE ( 'Value of SW: ' // NUMSTR ( SW ) )

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    52/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 50

    Conversion Functions

    This group of functions converts character to numeric variables and vice versa.These include:

    NUMSTR function

    Converts a numeric variable to a string (text), using a fixed precision of 13 digits.

    The syntax for this is:

    text = NUMSTR ( numeric )

    CONVERT function

    Similar to the NUMSTR function, except that it provides two additional facilities.

    Firstly, you can control the number of character positions (field width) as well asthe number of decimal places to be used. Secondly, you can add additional text tothe resulting text string.

    text = convert ( format, numeric )

    where formatis a text literal or variable which defines how the numeric variable isto be converted. It consists of text which is copied to the function result, and a field

    code enclosed in curly brackets. The value of the numeric, formatted according tothe field code, replaces the field code in the function result. The field code has the

    form Nw.d, where "w" is the number of characters to be used, and "d" specifiesthe number of decimal places. For example:

    CONVERT ( 'The value of Sw is:{N8.3}', sw )

    would produce the string "The value of Sw is: 0.134" (where "" represents a

    space) if the value of swwas 0.134234455. As a further example, if you have

    variables DEPTH, RHOB and NPHI with values of 5200, 2.56, and 0.176respectively, then

    CONVERT ( '{N8.3}', DEPTH ) // ~

    CONVERT ( '{N8.3}', RHOB ) // ~

    CONVERT ( '{N8.3}', NPHI )

    would produce "5200.000 2.560 0.176".

    STRNUM function

    Converts a string to a number:

    text = STRNUM ( '1.23456' )

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    53/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 51

    In this and the other exercises which follow, the variables listed are onlysuggestions. Also, the flow of the program is indicated by comments.

    Example solutions can be found in the /loglan/examplessubdirectory. In this exercise, you will write a program to display the average value of porosity

    for a well.

    The program is to calculate a simple value of density porosity and display theaverage for the well to the Message area of the Well application. Use the

    formulaporosity = ( RHOma- RHOB ) / ( RHOma- RHOfl ).

    Program: DISP_POR

    Input variables:

    RHO_MA (Constant, G/CC) (Validation Range 1.5 - 3.5)RHO_FL (Constant, G/CC) (Validation Range 0.5 - 1.2)

    RHOB (Log)

    Local variables:

    poro, count, sum

    Program steps:

    /* Initialise variables.

    /* Loop through the data.

    /* Calculate porosity, increment sums.

    /* End loop.

    /* Calculate average.

    /* Display the calculated average.

    REMEMBER: all INPUT to the computer is in Bold Courier New, while all

    OUTPUT from the computer is in Courier New, but not bold (i.e., the codefor the comments listed above which are NOT bold are automatically

    created by mui_loglan).

    ASK Functions

    ASK are used to obtain interactive user input. They are most often used when the

    input required depends on the parameters passed to the programotherwise, itwould be much more efficient to get the required values by using module

    parameters. For these functions to work, the environment variable MIN_DIALOGSmust be set to TRUE, otherwise, the default value is returned. If you are not sure

    how to do this, contact your Geolog administrator.

    Exercise 1

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    54/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 52

    In the normal case, a popup window appears into which the user enters the

    required value. There are three functions involvedone each for text, numeric,and logical values; these are ASKS, ASKN, and ASKL, respectively. They all have

    the same syntax:

    result = ASKx ( prompt, default )

    where promptis a literal or text variable containing the prompt to be displayed,and defaultis the value (which must be of the appropriate type) to be used if the

    user does not enter a value. For example:

    rho_ma = ASKN ( 'Enter value of Rho Matrix:', 2.65 )

    or, exactly equivalently:

    string = 'Enter value of Rho Matrix:'

    rho_ma = 2.65

    rho_ma = ASKN ( string, rho_ma )

    In this exercise, you will create an "interactive" program.

    The program will calculate Sw using the Archie formula

    sw=SQRT(rw/(rt*phi**m))

    and display the result in the feedback window.

    Because the program requires no input or output parameters, all variables will

    be local.

    The program should ask for, and display, a username (merely so we candemonstrate ASKS), and should iterate, if required.

    Exercise 2

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    55/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 53

    Program: ASK_SW

    Local variables:

    rw, m, phi, rt, sw, name (ALPHA*16), again (LOGICAL)

    Program steps:

    /* Initialize logical variable.

    /* Ask for the user's name.

    /* Start the iteration loop.

    /* Get the values for the variables.

    /* Calculate the water saturation.

    /* Display the results.

    /* Ask the user whether to run again.

    File Access Functions

    In addition to accessing data from the Geolog database, Loglan programs canaccess external files for both input and output. Text files can be both read and

    written by a Loglan program, allowing you to perform data manipulation as well asloading or unloading data. In this section of the tutorial, we will discuss the

    functions involved in opening and closing external files, and those which facilitatereading and storing data in those files.

    File Opening

    To access a text file in a Loglan program, it must first be opened:

    logical = FOPEN ( mode, filename, index )

    where:

    mode is the action that is to be performed on the file'read'opens an

    existing file for reading; 'owrite'overwrites an existing file or creates anew one for writing; and 'awrite'either appends to an existing file, or

    creates a new file if the named file does not exist.

    filename is the name of the file to be opened, either a literal (quoted string), or

    a text variable.

    index is a number (or the name of a numeric variable). This index is used toread from or write to the file. Up to 40 files may be opened at any one

    time within a Loglan program, so it is possible to read and write manyfiles simultaneously.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    56/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 54

    The function returns TRUE if the file was successfully opened. Possible causes of

    failure are:

    an invalid file name

    a non-existent file opened for read

    a non-existent directory

    a protection failure

    It is good practice to test the result of the FOPEN call so your program can takethe appropriate action if it fails:

    if ( ^ FOPEN ( 'read', filename, 1 ) ) then

    DISPLAY_ERROR ( 'Failed to open file ' // filename )

    endif

    This checks if the file can be opened for reading, and aborts the program with anerror message if the file cannot be opened; otherwise, the file is opened and the

    index 1is associated with it.

    File Closing

    When your Loglan processing has finished processing a file, it must be closed

    using the FCLOSE function:

    FCLOSE ( index )

    where indexis the file index with which was opened by FOPEN.

    Reading from a File

    External files are always read sequentially; the next line from the file is returned by

    the FREADfunction:

    text = FREAD ( index )

    where indexis the number used in the FOPEN call. If no more data remains to be

    read from the file, the string EOFis returnedif you want to detect end-of-file, youmust test for this result. This is a common way of processing a file:

    record = FREAD ( 1 )

    dowhile ( record 'EOF' )

    record = FREAD ( 1 )

    enddo

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    57/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 55

    Processing the Data Read from a File

    Because FREAD returns a single character string, you usually need to do somework to extract the data from this string. The method used depends on how the

    data is stored in the file. If it is in fixed columns, it is most efficient to use the

    SUBSTRING function. If the data is not stored this way, or if you want to take theeasy way out, use the TOKEN function:

    text = TOKEN ( string, index )

    where stringcontains the text from which a token is to be extracted, and indexisthe number of the token to be extracted. A token is a string of characters delimited

    by one or more spaces. The function draws a blank if there are fewer then indexcharacters in the passed string. For example, if the variable recordcontained "a b

    ab 123.456", then

    numeric = STRNUM ( TOKEN ( record, 4 ) )

    would assign 123.456 to the variable numeric.To retrieve data from fixed positions in a record, use the SUBSTRING function:

    text = SUBSTRING ( string, start, length )

    where stringcontains the text from which the substring is to be extracted, startis

    the position of the first character to be extracted, and lengthis the number ofcharacters to be extracted from the string. For example:

    SUBSTRING ( '1234567890', 3, 6 )

    would return the text 3456.

    Other functions which are useful for manipulating text in buffers are INDEX andTRIM (see "String Related" under "Functions" in the Loglan online

    help documentation).

    Writing to a File

    The FWRITE function is used to write a buffer of data to a file opened for write. Itsformat is:

    logical = FWRITE ( index, buffer )

    where buffercontains the text to be written to the file, and indexis the numberused in the FOPEN call. The function returns TRUE unless an error occurred.

    www.fanarco.net

  • 5/23/2018 Geolog6.6 Loglan Programming Tutorial

    58/71

    Geolog 6.6 - Loglan Programming Tutorial Loglan Language Syntax 56

    By now you should have enough knowledge to complete an exercise to process atext file containing log data and load it into Geolog.

    In this exercise, you will write a program to read data from a fixed-column formatfile.

    The file to be loaded is in your datasubdirectory and is named nuke.asc. The

    data contains GR, DRHO, RHOB and NPHI curves in the following fixed-columnformat:

    DEPTH GR DRHO RHOB NPHI

    5100.000 61.155 -0.022 2.452 0.268

    5100.500 60.522 -0.018 2.445 0.262

    5101.000 58.631 -0.012 2.437 0.253

    5101.500 54.852 -0.002 2.425 0.238

    5102.000 51.073 0.008 2.414 0.223

    5102.500 50.139 0.010 2.421 0.213

    As you can see, the file has a header line and then data lines each containing5 values in fixed fields each 10 character positions long.

    In this exercise, the data will be read one line at a time using the FREADfunction, and the resulting text string split into the separate numbers to be used

    as data using the SUBSTRING function.

    Note that, because there are no input logs, you will not require the dowhileget_frame loop.

    It is VERY important to specify units for the output logs, otherwise, they will be

    assumed to be in your preferred units when they are written to the Geologdatabase.

    Program: READ_COL

    Input variable:

    FILENAME (Alpha*32) (PARAMETER)

    Output variables:

    DEPTH (FEET) (LOG)

    GR (GAPI) (LOG)

    DRHO (G/C3) (LOG)

    RHOB (G/C3) (LOG)

    NPHI (V/V) (LOG)

    Local variable:

    buffer (Alpha*80)

    Exercise 3

    www