bcnv

NAME
SYNOPSIS
DESCRIPTION
SEG-Y REVISIONS
DYNAMIC RANGE
FILES
SEE ALSO
BUGS
COPYRIGHT
AUTHOR

NAME

bcnv - BSU program converts BSU’s BSEGY format data (*.seg) to SEG-Y format (*.sgy)

SYNOPSIS

bcnv [ -h | infile | endian | compliance | idirec | idfc | iunits | hedfil ]

DESCRIPTION

Basic Seismic Utilities (BSU) converts back and forth between BSU’s BSEGY data format (file names *.seg) and SEG-Y data format (file names *.sgy). The SEG-Y format is a digital exchange format for seismic data defined by the Society of Exploration Geophysicists (SEG). Originally designed for magnetic tape, it has been adapted for use on disk files (with some interpretational variations). As with Seismic Unix (SU), BSU’s BSEGY format is derived from SEG-Y, with the most notable difference being the absence of a "Reel Header". In short, SEG-Y data begin with a 3200 byte EBCDIC portion to the reel header (80 characters per line, 40 lines, but no end of line characters), followed by a 400 byte Binary portion of the reel header. Together, this gives a 3600 byte Reel Header. After the Reel Header, the traces follow as a sequence of [240 byte trace header + binary data]. The data (seismic samples), may be 2 byte integer, 4 byte integer, or 4 byte floating point (IBM floating point format not IEEE). The BSEGY format omits the Reel Header, and uses a 240 byte trace header (see c_bsegy.h) with data in the 4 byte IEEE floating point format. The Seismic Unix (see Colorado School of Mines, CWP) is very similar to BSEGY, except in the optional byte definitions (bytes 181-240). An SU program comparable to BSU’s bcnv would be segyread or segywrite. The endian option is for the host computer. The SEGY order is Big Endian. Most PC’s running linux will be Little Endian. BSU has a separate program for byte swapping (bswp). C-Language Version.

SEG-Y REVISIONS

At the time of this writing, SEG-Y has had 2 revisions. Versions are 0, 1, and 2. Old SEG-Y files that are floating point will likely be using IBM 370 floats (idfc = 1). Today’s computers are likely to use IEEE floats (idfc =5). The current version of this software will work with either data format. This code assumes BigEndian SEG-Y byte order for compliant files, even if later revisions permit LittleEndian order. This code assumes that the host computer is LittleEndian.

DYNAMIC RANGE

Perhaps the most troubling aspect of conversions and exchange formats is the potential loss of dynamic range. For example, consider converting from 4 byte floating point BSEGY data to 2 byte SEG-Y data, and then converting back to BSEGY or SU 4 byte floating point. The 2 byte integer simply doesn’t have the range, and a number of possible problems occur. This program addresses this issue by scanning the entire data set for the maximum absolute value in the BSEGY data, and then rescaling the trace to a maximum value of 2^15 for 2byte integer (2^31 for 4 byte integer, BUT ONLY IF NEEDED). The scaling factor is stored in trace header hd.twf (bytes 169-170). In addition, the preampifier (K-gain) scaling is backed in before the conversion to 2 byte integer. Thus, if bcnv is used for both forward and reverse conversions, you should preserve the data scaling without clipping (but you will loose some fine detail due to the change in quantization that the rescaling required). In general, it is better to produce SEG-Y data that are either 4 byte integer or 4 byte floating point. The listing files also indicate the hd.twf factor, and in general, this will be unity if 4 byte SEG-Y data are produced. A good way to check on degradation of the data is to run traplt, and look at the samples. A loss of significant figures should be avoided. The basic BSEGY philosophy is that BSEGY data (*.seg files) have samples amplitudes in microvolts, and the SEG-Y values are variably scaled according to the K-gain (c_bsegy.h header value hd.gidb). This will be the case for Bison and EGG seismographs that this author has used. RECOMMENDATION: Always do your own calibration test with a signal generator, since different seismographs have different scale factors to get to microvolts.

Options

-h

Online help giving details on command line arguments

infile

Input file name (if idirec=0, *.seg file, if idirec=1, *.sgy file)

endian

Byte order of host computer

0= Little Endian (use this for Workstations running Linux, with few exceptions)

1= Big Endian (like an IBM main frame computer)
compliance

Strict SEGY compliance

1= output SEGY data compliant (EBCDIC rather than ASCII, IBM format if floats)

0= native host format (not true SEGY, ASCII reel header, native floats)

idirec

Conversion direction

0= From BSEGY to SEG-Y (file names *.seg to *.sgy)

1= From SEG-Y to BSEGY (file names *.sgy to *.seg)

NOTE: idfc, iunits and hedfil below Only required if idirec=0
If reading SEG-Y to convert to BSEGY (idirec=1), they are read from file header.

idfc

Data format code (will be in reel header)

1= 4 byte IBM floating point SEG-Y

2= 4 byte integer SEG-Y

3= 2 byte integer SEG-Y (NOT RECOMMENDED, see Dynamic Range above)

5= 4 byte IEEE floating point SEG-Y

iunits

Specifies the type of units used to record spatial positions.

1= Meters

2= Feet

hedfil Name of the character portion of the reel header file to be input (for idirec=0 ONLY). This should be 40 lines, 80 characters per line max. The end of line character is dropped when read. The first character of each line will be the letter "C", regardless of what you type. If you type "none" or "NONE", then blank lines will be created (and no ascii header file will be read).

NOTE:
If invoked with no options, will prompt user for input parameters.

EXAMPLE:
bcnv wave.seg 0 1 0 2 1 head.txt

File file wave.seg is converted to bcnvwave.sgy, 4 byte integer SEG-Y with the units being in meters. The file, head.txt is read for the ascii portion of the header, converted to EBCDIC on output *.sgy file since compliance is set. Since host is little endian, output integer data will be byte swapped to satisfy compliance.

FILES

bcnvxxxx.sgy or bcnvxxxx.seg

named according to input file first 8 characters (see example above).

standard output

produces a progress bar

bcnvxxxx.lst

Listing of header contents and options.

SEE ALSO

bhelp(1), egg2seg(1), topcon2(1), bis2seg(1), c_bsegy(5)

BUGS

Tested only on little endian platform, unknown if will work on a big endian machine. SEGY files created with bcnv convert back to Seismic Unix (SU) format using CWP’s segyread correctly for both 4 byte float and 2 byte integer. The SU program segyread did not work with 4 byte integer. However, bcnv was able to convert SEGY back to BSEGY. This result was for SU compiled without XDR. Recommend use floating point unless a really good reason to use integer to retain maximum portability.

COPYRIGHT

Copyright © 2021 by Paul Michaels

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The IBM float conversion is IBM software, converted from EBCDIC source code. License is IBM made free to public. See libIBM directory in source code for complete license statement. Also see http://www-03.ibm.com/systems/z/os/zos/features/unix/libascii.html

AUTHOR

P. Michaels, PE. <paulmichaels@boisestate.edu>