Skip to Main Navigation. Each navigation link will open a list of sub navigation links.

Skip to Main Content

Apply to the University of Wyoming apply now

Global Resource Navigation

Visit Campus
Download UW Viewbook
Give to UW

Digital Geophysical Laboratory (DGL)

DGL is a collection of free and open source C/C++ codes of specific interest to the geoscience community that builds on the GNU compiler collection (GCC) for geophysical and petrophysical applications, which will run on any platform. Some of the applications are based on FLTK (the Fast Light Toolkit, http://www.fltk.org) to provide modern graphical user interface (GUI) functionality and/or on the FFTW library (http://www.fftw.org) for computing the discrete Fourier transform.

FOREWORD:
The downloadable source codes found below under "Program Codes/Descriptions", together with the installation/compilation notes, form resources necessary for building computational geology/geophysics applications. While using and learning from these free software tools, students and researchers in solid Earth physics will acquire the ability to write their own computer programs for the processing, analysis, and modeling of geophysical data and phenomena. Sample input files are available in the menu on the left under "Quick Links" for testing the compiled applications.

Use of this software is subject to the Warranty Disclaimer at the bottom of this page. For questions or comments about the DGL, please see contacts:

  • Geophysics, C/C++ programming & installation under Apple OS X
    Yuri Ganshin
    (307) 766-6898
    yganshin@uwyo.edu

 

Installing GCC

GCC, produced by the GNU free software project, is included with all Unix-like platforms. For Windows, you could either install MinGW GCC (http://www.mingw.org) or Cygwin GCC (https://www.cygwin.com). In our experience, it was easier to work with MinGW (Minimalist GNU for Windows), which is a port of the GNU Compiler Collection and GNU Binutils for use in Windows. It also includes MSYS (Minimal System, http://www.mingw.org/wiki/msys), which is basically a Bourne shell (bash). While Apple OS X ships with a number of common commands available through the Terminal application, by default Apple does not include those that are used for compiling and developing applications. There are several ways you can get them on the Mac platform. The first is to install Apple’s XCode developer suite, which is available via the Mac App Store for free. The next option is to download the latest command line tools from Apple’s developer site. To do this, you simply need to log into the “downloads” section of the Apple developer site using an Apple ID. Here you can search for "Command Line Tools" to view all versions of the tools from Lion through El Capitan.

Installing FLTK Under UNIX/Linux and Apple OS X

FLTK is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Mac OS X, and Microsoft Windows. It provides a modern graphical user interface, look, and functionality with easy-to-implement widgets. FLTK is designed to be small and modular enough to be statically linked, and also works well as a shared library. Most importantly, FLTK is provided under the terms of the GNU free software General Public License (http://www.gnu.org/licenses/gpl-3.0.html). In general, the installation procedure includes the following operations:

  1. Download FLTK from the http://www.fltk.org website
  2. Extract the package files from the archive into an empty directory
  3. Navigate to the extracted folder in the terminal window
  4. Run the following commands in the terminal window: 
  • ./configure
  • sudo make
  • sudo make install

Basically, you are done! For more information, please consult the platform-dependent README files in the FLTK distribution package. For specific Linux distributions (UBUNTU, FEDORA, CentOS) there are package managers and repositories that include self-contained scripts that will configure and install FLTK automatically. While each particular distribution is different, the major two Linux flavors (UBUNTU, FEDORA) use commands that look like the following:

  • UBUNTU:  sudo apt-get install libfltk1.3-dev
  • FEDORA (CentOS):  yum install fltk

This is to show the main workflow using these popular distributions and package managers. Individual Linux operating systems may have different repositories and different specific package names. The online community is very active and helpful with Linux, and one should consult each particular distribution’s documentation.

Installing FLTK Under Microsoft Windows

FLTK 1.3 is officially supported on Windows 2000, 2003, XP, and later. Older Windows versions prior to Windows 2000 are not officially supported, but may still work. FLTK 1.3 is known to work on recent versions of Windows such as Windows 7 and Vista and has been reported to work in both 32-bit and 64-bit operating systems. We didn’t have any trouble installing FLTK on a 64-bit version of Windows 7 with pre-installed Msys/MinGW tools on it. If using Cygwin with the Cygwin shell, or MinGW with the Msys shell, these build environments behave very much like a Unix or OS X build and the notes above in the section on "Installing FLTK Under UNIX/LINUX and Apple OS X" apply, especially when using the ”configure” script. For example, when using MinGW with the Msys shell, it should suffice to ”cd” into the directory where you have extracted the FLTK archive and type:

  • ./configure 
  • make

This will build the FLTK libraries and they can then be utilized directly from the build location or installed somewhere else. For example, if you ”install” the libraries using Msys/MinGW with the following command:

  • make install

Then Msys will ”install” the libraries to where it thinks the path ”/usr/local/” leads to. If you only build code from within the Msys environment this works well, however, the actual ”Windows path” these files are located in will be something like ”C:\msys\1.0\local\lib” depending on where your Msys installation is rooted. If you want to install your built FLTK libraries in a non-standard location you may do:

  • sh configure --prefix=C:/FLTK make

Where the value passed to ”prefix” is the path at which you would like FLTK to be installed. A subsequent invocation of the ”make install” command will then place the FLTK libraries and header files into that path. The other options to ”configure” may also be used to tailor the build to suit your environment.

Installing FFTW

Fast Fourier transforms are of great importance for geophysical applications such as time series and wavelet analysis, convolution and filtering, pre- and post-stack migration, and spectral decomposition, to mention a few. We have chosen the FFTW library for computing the discrete Fourier transform because it provides a fast and efficient way to work with:

  • One or more dimensions
  • Arbitrary input size 
  • Real and complex data

And finally, because FFTW is a free software released under GNU Generic Public License (http://www.fftw.org/doc/License-and-Copyright.html), FFTW comes with a configure program in the GNU style where installation on Unix and Mac OS X can be as simple as: 

  • ./configure 
  • make
  • make install

It is also quite straightforward to install FFTW on non-Unix systems lacking the niceties of the configure script. The FFTW Home Page may include some FFTW packages preconfigured for particular systems/compilers, and also contains installation notes sent in by users. All you need to do is to compile all of the .c files in the appropriate directories of the FFTW package. For more details, please refer to the Installation and Customization notes on http://www.fftw.org/fftw2_doc/fftw_6.html.

FLTK Basics

A simple FLTK program

All programs must include the file <FL/Fl.H>. In addition, the program must include a header file for each FLTK class it uses. Listing 1 shows a simple ”screen_size” program that uses FLTK to display dimensions and resolution of the screen work area that are always useful to know for developing applications.

Listing 1 - ”screen_size.cxx”

#include <FL/Fl.H>
#include <FL/fl_message.H>

int main(int argc, char *argv[]) 
{

int height = Fl::h();
int width = Fl::w();
float hr,vr;

Fl::screen_dpi(hr,vr,0);

fl_message("Screen Work Area in pixels:\n\
The height = %d, the width = %d\n\n\
Screen Resolution in dots per inch:\n\
Horizontal = %.1f, vertical = %.1f\n\n\
Close the window to exit...",
height,width,hr,vr);

exit(0);

}

After compilation (iMac under OS X), and typing in the Terminal window “screen_size” the result will look like the following.

screenshot

Compiling FLTK programs

Under UNIX, Mac OS X, and Microsoft Windows when using the GNU development tools, you will probably need to tell the compiler where to find the header files. This is usually done using the -I option:

g++ -I/usr/local/include ...

The “fltk-config” script included with FLTK can be used to get the options that are required by your compiler:

fltk-config --cxxflags

Similarly, when linking your application you will need to tell the compiler to use the FLTK library:

g++ ... -L/usr/local/lib -lfltk -lXext -lX11 -lm

Aside from the ”fltk” library, there is also a ”fltk forms” library for the XForms compatibility classes, ”fltk gl” for the OpenGL classes, ”fltk images” for the image file classes, and system icon support. As stated above, the “fltk-config” script included with FLTK can be used to get the options that are required by your linker: 

fltk-config --ldflags

Finally, you can use the “fltk-config” script to compile a single source file as a FLTK program. Using the ”screen_size.cxx” source code as an example, the following command line will produce an executable named ”screen_size”.

fltk-config --compile screen_size.cxx


Adding “--post” option to the last command line will create the “screen_size” executable for desktop use. 



GCC Environment Variables

GCC uses the following environment variables:
  • PATH, for searching the executables and run-time shared libraries (.dll, .so).
  • CPATH, for searching the include-paths for headers. It is searched after paths specified in -I<dir> options. 
  • LIBRARY_PATH, for searching library-paths for link libraries. It is searched after paths specified in -L<dir> options.

Header Files and Libraries (-I, -L, and –l)

Header FilesThese are the files that are included at the top of any program. If we use any function inside a program, then the header file containing declaration or definition of that function has to be included.

Library:  A library is a collection of precompiled object files, which can be linked into programs. The most common use of libraries is to provide system functions, such as the square root function sqrt found in the C math library. Libraries are typically stored in special archive files with the extension .a, referred to as static libraries. They are created from object files with a separate tool, the GNU archiver ar.

When compiling the program, the compiler needs the header files to compile the source codes and the linker needs the libraries to resolve external references from other object files or libraries. The compiler and linker will not find the headers/libraries unless you set the appropriate options, which is not obvious for first-time user.

For each of the headers used in your source (via #include directives), the compiler searches the include-paths for these headers, which are specified via -Idir option (or environment variable CPATH). Since the header's filename is known (e.g., iostream.h, stdio.h), the compiler only needs the directories.

The linker searches the library-paths for libraries needed to link the program into an executable. The library-path is specified via -Ldir option (uppercase 'L' followed by the directory path) or environment variable LIBRARY_PATH. In addition, you also have to specify the library name. In UNIX, the library libxxx.a is specified via -lxxx option (lowercase letter “l”, without the prefix "lib" and ".a" extension). In Windows, provide the full name such as -lxxx.lib. The linker needs to know both the directories and the library names. Hence, two options need to be specified.

Some programs can make a call to the external libraries, as is the case with some DGL programs calling FFTW subroutines.  The usage of FFTW, in that case, is the same, except that #include directives and link commands must use the appropriate prefix and the library name. Thus, to inform the linker to use external Fast Fourier library, its name must be included into the “fltk-config” script or the Makefile as shown below.

-lfftw3 for UNIX-like platforms, and

usr/local/lib/libfftw3.a for MS Windows. 

Compiling Programs with Makefiles

The previous section described how to use “fltk-config” to build a program consisting of a single source file from the command line, and this is very convenient for relatively small programs (e.g., DGL routines). But “fltk-config” can also be used to set the compiler and linker options as variables within a Makefile that can be used to build programs out of multiple source files. Please see the FLTK Programming Manual for more instructions on this (http://www.fltk.org/documentation.php).

 

Program Codes/Descriptions

(NOTE: Clicking on the Program links below will automatically download files to your computer.)

 
Visualization utilities for data stored in the plain text files

Program Name Description Language External
Libraries
to Link
Program Input Program Output
PLOT 1D visualization for multicolumn data stored in a plain text file. The program allows any column (curve) to be assigned to either X- or Y-axis. The user is provided with a choice of graph colors, point size, and text labeling. C/C++ FLTK .txt file, GUI Graphical Display
XYZPLOT 2D visualization for X-Y-Z data stored in three columns within a plain text file. The program produces 2D maps with X- and Y-values taken from the first two columns, and Z-values are used for coloring. C/C++ FLTK .txt file, GUI Graphical Display

 

Visualization and analysis utilities for digital well logs stored in LAS format

LAS Format: (http://www.epgeology.com/petrophysics-f23/las-file-standards-t2608.html)

Program Name Description Language External
Libraries
to Link
Program Input Program Output
CROSSLOG

Visualization program for petrophysical well data. Displays a selected curve, plots its histogram, and cross-plots values from any two curves. Cross-plots can be colored and/or filtered with values taken from any curve. The user is provided with a choice of color-maps.

C/C++ FLTK LAS file, GUI Graphical Display
CORRELOLOG

Visualization program for petrophysical well data. Displays selected curves and calculates correlogram between any two curves. Correlogram indicates the strength and direction of a linear relationship between a pair of logs estimated within a sliding window. The results range from -1 (inverse relationship) to +1 (perfect correlation). Zero indicates a lack of correlation.

C/C++ FLTK LAS file, GUI Graphical Display
SPECTROLOG

Visualization program for petrophysical well data. Displays a selected curve and calculates its spectrogram--i.e. a visual representation of instantaneous spectral analysis applied to decompose a well log into the wavelength-depth domain. The method could be used to interpret lithologic boundaries, stratigraphic discontinuities, and the presence of cyclicity in sedimentation rates.

C/C++ FLTK,
FFTW
LAS file, GUI Graphical Display

 

Statistical analysis of digital images for petrography

Program Name Description Language External
Libraries
to Link
Program Input Program Output
PETRO-IMG

Visualization and analysis of thin section images stored in JPEG, BMP, or PNG digital formats. Allows image filtering by passing a band of RGB channel values. Estimates percentage of the passed data. Performs heterogeneity analysis of the filtered image by estimating the coefficient of variation and the Dykstra-Parsons coefficient.

C/C++ FLTK IMAGE file, GUI Graphical Display

 

Reflection Seismic visualization, processing, and analysis utilities

Program Name Description Language External
Libraries
to Link
Program Input Program Output
SEGVIS

2D visualization of seismic attribute sections (amplitude, velocity, frequency, coherency) stored in 4-byte floating point SEG-Y format.

C/C++ FLTK SEG-Y file, GUI Graphical Display
WAVEVIS

2D visualization of seismic sections (amplitude data only) stored in 4-byte floating point SEG-Y format. The program supports interactive picking of seismic horizons.

C/C++ FLTK SEG-Y file, GUI Graphical Display, ASCII TEXT file
FREQAN Performs Fourier spectrum computation, time-frequency decomposition, and band-pass filtering for data stored in SEG-Y format. The program's graphical output allows choosing proper filter parameters to be used in batch processing. C/C++ FLTK,
FFTW
SEG-Y file, GUI Graphical Display
PHASER

2D visualization of seismic reflection data with the ability to apply phase rotation and to overlap seismic traces with instantaneous amplitudes (trace envelope). By scanning the phase rotation angle and watching the match of data peaks with the envelope, one can determine the angle that brings reflections to zero phases.

C/C++ FLTK, FFTW SEG-Y file, GUI Graphical Display
VELAN

Velocity analysis of reflection seismic prestack gathers (w/o normal moveout or NMO corrections) stored in SEG-Y format. Stacking velocities are picked manually on the velocity spectra display. For each individual seismic gather, the picked velocity function is fitted to a power law function

V = V0 + a×t

that can be used as a guide velocity function for a detailed, automatic velocity analysis, or to quality control NMO corrections when using the MOVEOUT application.

C/C++ FLTK SEG-Y file, GUI Graphical Display, parametric velocity function
MOVEOUT

Visualization program for reflection seismic prestack gathers stored in SEG-Y format. Allows choice of quality control parameters for normal moveout (NMO) corrections considering velocity function specified by a power law dependence of velocity on time:

V = V0 + a×t

The program supports correction methods based on both the isotropic-layered media and transversely isotropic media assumptions.

C/C++ FLTK SEG-Y file, GUI Graphical Display
SEGY_CO NVERT Converts 4-byte floating point SEG-Y file (IBM, IEEE, big- or little-Endian) into SEGY-IEEE file with native byte order. Machine endianism and the input file type are determined automatically. C None SEG-Y file, CLI SEG-Y file with native byte order
VEST Detailed stacking velocity computation for 2D-3D gathers without NMO corrections stored in SEG-Y (IEEE) format with a native byte order. Velocities are estimated at every common mid-point (CMP) location and at every time sample. The VEST routine requires the guide velocity function information that can be obtained with the interactive VELAN application. Outputs two SEG-Y files with stacking velocity and the corresponding semblance values in them. C None SEG-Y file, CLI Two separate SEG-Y files with velocity and pre-stack coherency (semblance)
DIX Converts SEG-Y files with stacking velocities to Dix interval velocities. The program allows a trade-off between velocity uncertainty and its vertical resolution. C None SEG-Y file, CLI Two SEG-Y files with interval velocity and its resolution
FILTER Filters seismic data stored in SEG-Y files using ORMSBY band-pass filter. C FFTW SEG-Y file, CLT Filtered SEG-Y file
MIGR3D 3D time-slice migration for seismic data stored in 4-byte floating point SEG-Y format with native byte order. The program allows processing both the stacked volumes and pre-stack common-offset volumes. C FFTW SEG-Y file, CLT Migrated SEG-Y file

 

Visualization and Cluster Analysis of well-log data stored in the plain text files

Program
Name
Description Language External
Libraries
to Link
Program
Input
Program
Output
CLUSTERS Allow to group together data points with similar log responses by applying K-means clustering technique and makes graphical display of clustering results. The user is provided with a choice of different clustering algorithms, number of clusters, and colors to be assigned with the clusters. C/C++ FLTK .txt file, GUI Graphical
Display,
.txt file

*ANNOTATION:
Command-line interface (CLI) is a means of interacting with a computer program by issuing commands or program parameters in the form of successive lines of text in the terminal window.

Graphical user interface (GUI) is an alternative means of interacting with a computer program through graphical widgets and visual indicators as opposed to text-based CLI.

 

---------------------------------------------------------------------
WARRANTY DISCLAIMER:
---------------------------------------------------------------------
THE AUTHOR PROVIDES THIS SOFTWARE "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, THE CARBON MANAGEMENT INSTITUTE, AND/OR THE UNIVERSITY OF WYOMING BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OFUSE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Share This Page:

1000 E. University Ave. Laramie, WY 82071
UW Operators (307) 766-1121 | Contact Us | Download Adobe Reader

Twitter Icon Youtube Icon Instagram Icon Facebook Icon

Accreditation | Emergency Preparedness | Employment at UW | Gainful Employment | Privacy Policy | Accessibility Accessibility information icon