SYNOPSIS
PERL PROGRAM NAME:
AUTHOR: Juan Lorenzo (Perl module only)
DATE:
DESCRIPTION:
Version:
USE
NOTES
Examples
SYNOPSIS
SEISMIC UNIX NOTES SEGYREAD - read an SEG-Y tape
segyread > stdout tape=
or
SEG-Y data stream ... | segyread tape=- > stdout
Required parameter:
tape= input tape device or seg-y filename (see notes)
Optional parameters:
buff=1 for buffered device (9-track reel tape drive)
=0 possibly useful for 8mm EXABYTE drives
verbose=0 silent operation
=1 ; echo every 'vblock' traces
vblock=50 echo every 'vblock' traces under verbose option
hfile=header file to store ebcdic block (as ascii)
bfile=binary file to store binary block
xfile=xhdrs file to store extended text block
over=0 quit if bhed format not equal 1, 2, 3, 5, or 8
= 1 ; override and attempt conversion
format=bh.format if over=1 try to convert assuming format value
conv=1 convert data to native format
= 0 ; assume data is in native format
ebcdic=1 perform ebcdic to ascii conversion on 3200 byte textural
header. =0 do not perform conversion
ns=bh.hns number of samples (use if bhed ns wrong)
trcwt=1 apply trace weighting factor (bytes 169-170)
=0, do not apply. (Default is 0 for formats 1 and 5)
trmin=1 first trace to read
trmax=INT_MAX last trace to read
endian=1 set =0 for little-endian machines(PC's,DEC,etc.)
errmax=0 allowable number of consecutive tape IO errors
remap=...,... remap key(s)
byte=...,... formats to use for header remapping
Notes:
Traditionally tape=/dev/rmt0. However, in the modern world tape device
names are much less uniform. The magic name can often be deduced by
"ls /dev". Likely man pages with the names of the tape devices are:
"mt", "sd" "st". Also try "man -k scsi", " man mt", etc.
Sometimes "mt status" will tell the device name.
For a SEG-Y diskfile use tape=filename.
The xfile argument will only be used if the file contains extended
text headers.
Remark: a SEG-Y file is not the same as an su file. A SEG-Y file
consists of three parts: an ebcdic header, a binary reel header, and
the traces. The traces are (usually) in 32 bit IBM floating point
format. An SU file consists only of the trace portion written in the
native binary floats.
Formats supported:
1: IBM floating point, 4 byte (32 bits)
2: two's complement integer, 4 byte (32 bits)
3: two's complement integer, 2 byte (16 bits)
5: IEEE floating point, 4 byte (32 bits)
8: two's complement integer, 1 byte (8 bits)
tape=- read from standard input. Caveat, under Solaris, you will
need to use the buff=1 option, as well.
Header remap:
The value of header word remap is mapped from the values of byte
Map a float at location 221 to sample spacing d1:
segyread <data >outdata remap=d1 byte=221f
Map a long at location 225 to source location sx:
segyread <data >outdata remap=sx byte=225l
Map a short at location 229 to gain constant igc:
segyread <data >outdata remap=igc byte=229s
Or all combined:
segyread <data >outdata remap=d1,sx,igc byte=221f,225l,229s
Segy header words are accessed as Xt where X denotes the byte number
starting at 1 in correspondance with the SEGY standard (1975)
Known types include: f float (4 bytes)
l long int (4 bytes)
s short int (2 bytes)
b byte (1 bytes)
type: sudoc segyread for further information
Note:
If you have a tape with multiple sequences of ebcdic header,
binary header,traces, use the device that
invokes the no-rewind option and issue multiple segyread
commands (making an appropriate shell script if you
want to save all the headers). Consider using >> if
you want a single trace file in the end. Similar
considerations apply for multiple reels of tapes,
but use the standard rewind on end of file.
Note: For buff=1 (default) tape is accessed with 'read', for buff=0
tape is accessed with fread. We suggest that you try buff=1
even with EXABYTE tapes.
Caveat: may be slow on an 8mm streaming (EXABYTE) tapedrive
Warning: segyread or segywrite to 8mm tape is fragile. Allow sufficient
time between successive reads and writes.
Warning: may return the error message "efclose: fclose failed"
intermittently when segyreading/segywriting to 8mm (EXABYTE) tape
even if actual segyread/segywrite is successful. However, this
error message may be returned if your tape drive has a fixed
block size set.
Caution: When reading or writing SEG-Y tapes, the tape
drive should be set to be able to read variable block length
tape files.
Credits:
SEP: Einar Kjartansson
CWP: Jack K. Cohen, Brian Sumner, Chris Liner
: John Stockwell (added 8mm tape stuff)
conv parameter added by:
Tony Kocurko
Department of Earth Sciences
Memorial University of Newfoundland
St. John's, Newfoundland
read from stdin via tape=- added by Tony Kocurko
bhed format = 2,3 conversion by:
Remco Romijn (Applied Geophysics, TU Delft)
J.W. de Bruijn (Applied Geophysics, TU Delft)
bhed format = 8 conversion by: John Stockwell
header remap feature added by:
Matthias Imhof, Virginia Tech
--------------------------
Additional Notes:
Brian's subroutine, ibm_to_float, which converts IBM floating
point to IEEE floating point is NOT portable and must be
altered for non-IEEE machines. See the subroutine notes below.
A direct read by dd would suck up the entire tape; hence the
dancing around with buffers and files.
User's notes (Juan Lorenzo) untested
CHANGES and their DATES
Import packages
instantiation of packages
Encapsulated hash of private variables
sub Step
collects switches and assembles bash instructions by adding the program name
sub note
collects switches and assembles bash instructions by adding the program name
sub clear
sub bfile
sub buff
sub byte
sub conv
sub ebcdic
sub endian
sub errmax
sub file
sub format
sub hfile
sub ns
sub over
sub remap
sub tape
sub trcwt
sub trmax
sub trmin
sub vblock
sub verbose
sub xfile
sub get_max_index
max index = number of input variables -1