App-SeismicUnixGui
view release on metacpan or search on metacpan
lib/App/SeismicUnixGui/developer/Stripped/data/segyread.c.hold.su.main.data_conversion view on Meta::CPAN
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.
( run in 0.513 second using v1.01-cache-2.11-cpan-39bf76dae61 )