DEPARTMENT OF THE INTERIOR U.S. GEOLOGICAL SURVEY PLOTSEGY V1.0: A DOS Graphics Program to Display SEG-Y Disk-Image Seismic Data by F.N. Zihlman1 Open-File Report 92-349A Although this program has been extensively tested, the Geological Survey can not guarantee that it will give accurate results in all applications nor that it will work on all computer systems. This report is preliminary and has not been reviewed for conformity with U.S Geological Survey editorial standards and stratigraphic nomenclature. Any use of trade names is for descriptive purposes only and does not imply endorsement by the U.S. Geological Survey. 1 U.S. Geological Survey, Box 25046, Denver Federal Center, Denver, CO 80225 1992 CONTENTS Abstract.....................................................1 Introduction.................................................1 System requirements..........................................2 PLOTSEGY Overview............................................3 File information.............................................4 Trace display information....................................6 Seismic data display.........................................7 Data Sample Conversion.......................................8 Trace Amplitude Normalization................................9 Sample data file.............................................9 Disclaimer..................................................10 Reference...................................................11 ILLUSTRATIONS Figure 1a. An example of the File Information entry screen............................................12 1b. An example of the file information returned after opening a SEG-Y file........................12 2. An example of the Trace Information entry screen............................................13 3. An example of a "panel" of seismic data displayed to a user's monitor.....................14 PLOTSEGY V1.0 ABSTRACT PLOTSEGY is an interactive program written in C and designed to display digital seismic data, stored in industry-standard SEG- Y format, using an 80286 or greater personal computer and the MS- DOS or PC-DOS operating system. PLOTSEGY will prompt the user for the file path and file name of the SEG-Y data file to display, the type of trace display to use, the time window and timing lines annotation frequency, the gain to apply to the data, the trace clipping allowed, the first trace in the file to plot, the number of traces per panel to display, and the trace annotation frequency to use in the display. PLOTSEGY will automatically recognize and use EGA, VGA, and Hercules video devices. A screen dump of the seismic data displayed may be sent to an attached printer by issuing the DOS GRAPHICS command before running PLOTSEGY. Screen images are sent to the printer by pressing simultaneously the SHIFT and PRINT SCRN keys INTRODUCTION The combination of low cost, powerful personal computers (PC's) possessing hard disk drives with hundreds of megabytes of storage allows a "mainframe" level of computing on a user's desk. Desktop PC's have increased in processing power to the point that an Intel 80486 processor-based DOS PC running at 25 Mhz was able to execute a computationally intensive seismic data processing algorithm 50% faster than the same source code running on a VAX 11/780 with an attached array processor (Miller, 1992, personal communication). This increase in desktop computing power and disk storage has made the real-time display of seismic data a practical reality. The data are stored in a disk file in industry-standard SEG-Y format. A typical amount of seismic data occupies many megabytes of storage space and thus, for practical purposes, a hard disk or CD-ROM is necessary. PLOTSEGY was written to operate on DOS-based PC's to read any standard SEG-Y format disk or CD-ROM files and display that data in real-time to the user's monitor without the need for any preprocessing of the data. It should be noted that PLOTSEGY normalizes the amplitudes of each sample within each trace against a reference value for that trace. This reference value is determined by calculating the average value of all non-zero samples within a trace. This reference value is set equal to 1/4 of the distance between traces on the screen. Thus the relative amplitudes between traces are not preserved by PLOTSEGY, although relative amplitudes within the same trace are unmodified. The advantage of this normalization technique is that it permits the viewing of data sets having a widely varying average amplitudes between traces (such as raw shot records) on the same screen using the 1 PLOTSEGY V1.0 same gain factor. A future verson of PLOTSEGY is to include an option to preserve relative amplitudes between traces. This open-file report (OF92-349A) describes the PLOTSEGY program and is available in paper copy. The executable image, source code files and a sample SEG-Y data set are available as a separate open-file report, OF92-349B, composed of four high density 5.25 inch diskettes. SYSTEM REQUIREMENTS PLOTSEGY was developed in C using Borland C/C++ 3.0 on an ALR BusinessVEISA with a 33 Mhz Intel 80386 processor, an 80387 math coproccessor, and MS-DOS 4.01. PLOTSEGY requires the following hardware and software requirements: * Intel 80286 or higher processor. An 80386 or greater is strongly recommended. * Video card capable of EGA, VGA, or Hercules displays. * DOS 3.0 or later. * A hard disk drive or CD-ROM containing the input file(s). * A math coprocessor is NOT required, but will be used if available and is strongly recommended. A color monitor is strongly recommended. Monochrome displays may possibly be improved by starting PLOTSEGY using the black and white option: C:\> PLOTSEGY -bw This will also convert a color display to black and white. PLOTSEGY OVERVIEW PLOTSEGY consists of three program sections: entry of SEG-Y data file path and name, entry of seismic trace display information, and the SEG-Y data display itself. PLOTSEGY is started at the DOS command line prompt by typing C:\> PLOTSEGY and prompts the user for input file directory path and name. The user is prompted continuously until the file path and SEG-Y file name have been successfully entered and the corresponding SEG-Y data file opened, or the user enters "exit" or "EXIT". Entering "exit" or "EXIT" to either prompt will halt program execution and return the user to the DOS command level. 2 PLOTSEGY V1.0 After the file directory path and the SEG-Y file name have been entered, PLOTSEGY will display some information about the data file opened (see File Information, below) and then pause until the user presses a key. After a key has been pressed, PLOTSEGY clears the monitor screen and prompts the user for the trace display information: trace type, the seismic trace time window, and the trace display parameters to use for the display (see Trace Display Information, below). Entering "quit" or "QUIT" to any prompt will return the user to the file path/name prompts. Entering "exit" or "EXIT" will halt program execution and return the user to the DOS command level. After the user has successfully entered the File Information and Trace Display Information, PLOTSEGY will access the first trace requested. After the first trace, all traces after that are accessed sequentially. The sample rate and number of samples per trace are determined from each trace header. All samples for each trace are read, regardless of the time window entered, to allow for future processing needs (such as AGC or filtering). Currently a maximum of 6000 samples are allowed per trace. Data sets having more than 6000 samples per trace will cause PLOTSEGY to fail and should be resampled to have 6000 samples per trace or less. PLOTSEGY will produce the seismic data display a "panel", or screen, at a time. The number of traces displayed per panel is set by the user by means of the trace display parameter prompts. At the end of each panel the user may return to the file path/name data entry screen or display the next panel of data, if it exists. If all the data has been displayed the user is returned to the file path/name entry screen. Pressing the escape key (ESC) at any time during the display of data will stop the data display and return the user to the file path/name entry screen. All information entered by the user in response to a program prompt will be kept as the default value for that prompt. Default values are displayed with each prompt enclosed in square brackets. A Default value is selected by pressing the enter key (ENTER) in response to a particular prompt. PLOTSEGY does no extensive error checking on the values entered by the user. Indiscriminate replies to the program's prompts may cause PLOTSEGY to fail. Hardcopy of the screen display, in the form of a "screen dump" is available through the DOS GRAPHICS command and the SHIFT-PRINT SCREEN DOS function. The user must issue the GRAPHICS command at the DOS prompt before running PLOTSEGY. Any seismic display produced may be sent to the attached printer by simultaneously pressing the SHIFT and PRINT SCREEN keys. See the appropriate MS-DOS manual for an explanation of the SHIFT-PRINT SCREEN function. 3 PLOTSEGY V1.0 FILE INFORMATION Figure 1a is an example of the File Information Entry Screen. PLOTSEGY prompts the user for the DOS file path to the directory containing the SEG-Y data file and for a SEG-Y data file name, as described below: DOS File Path - The DOS directory path to the location of the SEG-Y data files. The current working directory (the directory from which the program is invoked) is the first default value with all other user-entered paths as subsequent default values. The user may enter a "-" at the prompt to indicate PLOTSEGY is to use the path of the current working directory as the DOS file path. SEG-Y File Name - The file containing the SEG-Y data to be displayed. These are binary files representing a disk image of a SEG-Y data set obtained in a bit-for- bit copy from tape. The author recommends a .SGY file extension to identify these files as binary SEG-Y disk images. PLOTSEGY will combine the file path and SEG-Y file name entered into a single file specification. PLOTSEGY will continuously prompt for the two items until it successfully opens the specified file or the user enters "exit", which will return the user to the DOS command level. Both the file path and file name entered will be saved as default values for future use during the program session. After successfully opening the specified file, PLOTSEGY will determine and return the following file information: * File name. * Sample interval, in milliseconds. * Number of samples per seismic trace. * Maximum time value per seismic trace, in milliseconds. * Bytes per seismic trace. * Bytes in the file. * Number of seismic traces in the file. This information remains on the screen until the user presses any key. Figure 1b is an example of the File Information Display following successful entry of the file path and name as shown in Figure 1a. 4 PLOTSEGY V1.0 TRACE DISPLAY INFORMATION The Trace Display Information screen is shown in Figure 2. This screen appears after successfully selecting and opening a seismic data file. The prompts are described below: Trace Display Type - wiggle trace, variable area trace, or both. Variable area is recommended for very crowded displays, generally 250 or more traces per "panel" (see Trace Parameters, below). Trace Time Window - determines what portion of the trace will be displayed and how often the time axis will be annotated: Trace Minimum Time - Starting display time, in milliseconds. Trace Maximum Time - Ending display time, in milliseconds. Timing Lines - How often, in milliseconds, to annotate the time axis. Trace Display Parameters - The following parameters describe how the seismic data traces will be displayed per screen "panel": Trace Gain - A floating point scalar value applied to each sample value. This parameter is used to scale up or down trace amplitudes, after trace normalization, as desired. A negative value will reverse the polarity of the traces plotted. Trace Clipping - The number of trace widths beyond which the trace amplitude swing will be truncated, or "clipped". This is used to limit the horizontal excursion of the traces in the resulting display. 1st Trace Number - The number of the first trace to plot, counted sequentially from the first trace in the file. This allows PLOTSEGY to randomly access any starting point within the data file. Traces per Panel - The number of traces to display on the user's monitor. Although each PC will have a physical maximum number of traces which may be displayed at any one time based on the resolution of it's monitor, PLOTSEGY allows the user to specify a number greater than that maximum. PLOTSEGY will then decimate the data in order to plot "all" the traces within that range. For example, if a given monitor allows a maximum of 500 traces per panel and the user specifies 1000 traces per panel, PLOTSEGY will display 5 PLOTSEGY V1.0 every other trace (a "trace increment" of 2), allowing the whole range of data to be displayed. Trace spacing is kept constant for all traces displayed, so different Traces per Panel values will result in display panels of differing widths. The user is encouraged to experiment with different values for Traces per Panel. Generally some integer factor or multiple of the maximum horizontal resolution will work the best. Trace Annotation Frequency - The frequency with which to annotate the displayed traces. All trace locations will have a "tick" mark on the horizontal axis at the top of the seismic display (Figure 3) until a Traces per Panel value greater than 250. For panels with more than 250 traces, only the annotated traces will be "ticked". Entering "quit" or "QUIT" to any Trace Display Information prompt will return the user to the File Information entry screen. Entering "exit" or "EXIT" to any prompt will return the user to the DOS command level. As with the File Information prompts, all Trace Display Information entered by the user in response to the program prompts are saved as default values for future use during the program session. SEISMIC DATA DISPLAY Figure 3 is an example of the Seismic Data Display. After the successful entry of the File and Trace Display Information, the monitor screen will clear and the seismic data display "panel" will be drawn. The upper left corner will display the Trace Gain and Trace Clipping values entered and the trace increment used in displaying the data. The file name is displayed in the upper right corner. The data traces are displayed in a large rectangle with the trace locations along the horizontal axis and time values, in milliseconds, along the y axis. Traces are plotted left-to-right and time values are displayed from low-to-high with the low values starting at the top of the display. Trace spacing is kept constant which will result in displays of varying widths depending on the number of Traces per Panel specified. The seismic data is displayed a screen panel at a time. The trace CDP number, read from the trace header, and the sequential trace number, are displayed along the x axis according to the user-entered Trace Annotation Frequency. PLOTSEGY will beep at the end of each screen panel, alerting the user that particular panel is full, and prompt the user to press any key to continue or press "q" or "Q" to quit. If the user presses "q" or "Q", PLOTSEGY returns to the File Information entry screen. Pressing any other key will cause the screen to clear and the next panel of seismic data to be displayed. PLOTSEGY will beep twice at the end of the input file and prompt the user to press any key to continue. After pressing 6 PLOTSEGY V1.0 a key the user is returned to the File Information Entry Screen. The user may interrupt the display of traces at any time by pressing the "escape" (ESC) key. After pressing the ESC key the user will be returned to the File Information Entry Screen. DATA SAMPLE CONVERSION Each SEG-Y sample is stored as four consecutive bytes in IBM-compatible format as defined in IBM Form GA 22-6821 (Barry, et al, 1975). These four bytes form a 32 bit word as defined by the SEG Committee on Technical Standards for the SEG-Y format (Barry, et al, 1975). Since DOS-based PC's internally represent numbers using the IEEE format, reading the IBM-format sample will result in the byte order being changed. For example, a 32 bit sample value may have the hexidecimal value 459AEAEB in IBM- format representation. Reading this value and assigning it to a long integer variable will convert it into the IEEE-format resulting in a hexidecimal value of EBEA9A45. In order to maintain the proper byte order, each byte of the four byte (32 bit) word must be read as an unsigned character and the sample built by "left-shifting" each byte into it's proper position. Each 32 bit sample is then decomposed into a sign bit (Qs), a 7 bit characteristic (Qc) and a 24 bit fraction (Qf). The corresponding sample value may be calculated by the following: sample value = Qs * 16^(Qc-64) * Qf where 16^(Qc-64) is 16 raised to the (Qc-64) power. TRACE AMPLITUDE NORMALIZATION As mentioned in the Introduction, the amplitude of each trace is normalized such that it's reference value (the average of all non-zero values for that trace) is set to 1/4 of the trace width, in pixels. The trace width, in pixels, is determined by the number of pixels in a panel divided by the number of traces in that panel. Any user-supplied gain is applied after the reference value is determined. All sample value pixel locations are calculated relative to the trace mid-point representing a zero sample value and the pixel location used for the average sample value by Xpixel = Xaverage * (Sample * Gain)/Sampleaverage + Xmid-point where Xpixel = the pixel location of a sample. Xaverage = number of pixels away from the trace mid- point representing the average non-zero sample value. This value is calculated to be 1/4 of the trace width, 7 PLOTSEGY V1.0 in pixels, or 1, whichever is larger (a trace width can not be less than 1 pixel). Sampleaverage = the average non-zero sample value for a trace. Xmid-point = the pixel location of the trace mid-point, representing a zero sample value of zero. Sample value pixel locations may range some number of trace widths from the mid-point with the trace excursion determined by the Trace Clipping value entered by the user. SAMPLE DATA FILE Included with this software publication is the final stacked section for the seismic line 624-79 from the Point Barrow region in the National Petroleum Reserve in Alaska. Line 624-79 has 493 traces of 12 fold data "sliced" onto 3 high density 5.25 inch floppy disks. The data, which requires approximately 3 megabytes of disk space, may be reconstituted by placing sample data disk #1 in a 5.25 inch floppy drive and typing: C:\> SPLICE For example, if the is the 5.25 inch floppy drive A and the destination is the directory C:\DATA, then the command to reconstitute the seismic data would be: C:\> SPLICE A: C:\DATA The program will prompt the user when to place the two remaining floppies in the drive when needed. The reconstituted seismic line will reside in a file named 624-79.SGY. This may be used as an input file name for PLOTSEGY. DISCLAIMER This software publication was prepared by an agency of the United States Government. Neither the United States Government nor any agency thereof, nor any of their employees, make any warranty, expressed or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of the information, apparatus, product, or process disclosed in this report, or represents that its use would not infringe privately owned rights. Reference therein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof. Any views and opinions 8 PLOTSEGY V1.0 of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. Although all data and software have been used by the USGS, no warranty, expressed or implied, is made by the USGS as to the accuracy of the data and related materials and/or functioning of the software. The act of distribution shall not constitute any such warranty and no responsibility is assumed by the USGS in the use of this data, software, or related materials. REFERENCE Barry, K.M., Cavers, D.A., and Kneale, C.W., 1975, Recommended standards for digital tape formats, in Digital Tape Standards; Society of Exploration Geophysicists ["Recommended standards for digital tape formats" reprinted from Geophysics, v. 32, p. 1073 - 1084; v. 37, p. 36-44; v. 40, p. 344 - 352.] p. 22 - 30. 9 ---------------------------------------- SEGY INPUT FILE PARAMETERS ---------------------------------------- CURRENT WORKING DIRECTORY: D:\NPRA\CPGMS\SEGY\P4 CURRENT FILE PATH: D:\NPRA\CPGMS\SEGY\P4\ enter new path, "exit", "-" to use the current working directory or press ENTER to use current file path: ..\DATA CURRENT FILE NAME: enter new name, "exit" or press ENTER to use current: 624-79.SGY Figure 1a: An example of the File Information entry screen. The user has entered a DOS path of ..\DATA which is different from the current working directory. The resulting path will be D:\NPRA\CPGMS\SEGY\DATA. A data file name of 624-79.SGY is entered. ---------------------------------------- INPUT FILE CHARACTERISTICS ---------------------------------------- FILE: 624-79.SGY sample rate: 4.000 msec number of samples: 1500 maximum time: 6000 msec bytes per trace: 6240 bytes in file: 3079920 traces in file: 493 Press any key to continue... Figure 1b: An example of the file information returned upon the successful opening of SEG-Y input file 624-79.SGY. 10 ---------------------------------------- TRACE PLOTTING TYPES ---------------------------------------- TRACE TYPES: (1) wiggle (2) variable area (3) both trace type [3]: ---------------------------------------- PLOT DISPLAY TIMES ---------------------------------------- minimum time [0]: maximum time [6000]: 1000 timing lines [1000]: 100 ---------------------------------------- TRACE PARAMETERS ---------------------------------------- trace gain [1.000]: 1.5 trace clipping [3]: 1 1st trace number [1]: Maximum horizontal resolution is 550 traces per panel. Best displays result by using either an integer factor or multiple of this value. traces per panel [125]: trace annotation frequency [10]: Figure 2: An example of the Trace Information entry screen. 11 Figure 3: An example of a "panel" of seismic data displayed to a user's monitor. 12