next up previous [pdf]

Next: Reading and writing ASCII Up: Compatibility with other file Previous: Compatibility with SEPlib

Reading and writing SEG-Y and SU files

The SEG-Y format is based on the proposal of Barry et al. (1975). It was revised in 2002[*]. The SU format is a modification of SEG-Y used in Seismic Unix (Stockwell, 1997).

To convert files from SEG-Y or SU format to RSF, use the sfsegyread program. Let us first manufacture an example file using SU utilities (Stockwell, 1999):

bash$ suplane > plane.su
bash$ segyhdrs < plane.su | segywrite tape=plane.segy
To convert it to RSF, use either
bash$ sfsuread < plane.su tfile=tfile.rsf endian=0 > plane.rsf
or
bash$ sfsegyread < plane.segy tfile=tfile.rsf \
hfile=hfile bfile=bfile endian=0 > plane.rsf
The endian flag is needed if the SU file originated from a little-endian machine such as Linux PC.

Several files are generated. The standard output contains an RSF file with the data (32 traces with 64 samples each):

bash$ sfin plane.rsf
plane.rsf:
    in="/tmp/plane.rsf@"
    esize=4 type=float form=native
    n1=64          d1=0.004       o1=0
    n2=32          d2=?           o2=?
        2048 elements 8192 bytes
The contents of this file are displayed in Figure 3. The tfile is an RSF integer-type file with the trace headers (32 headers with 71 traces each):
bash$ sfin tfile.rsf
tfile.rsf:
    in="/tmp/tfile.rsf@"
    esize=4 type=int form=native
    n1=71          d1=?           o1=?
    n2=32          d2=?           o2=?
        2272 elements 9088 bytes
The contents of trace headers can be quickly examined with the sfheaderattr program. The hfile is the ASCII header file for the whole record.
bash$ head -c 242 hfile
C      This tape was made at the
C                                                                              
C      Center for Wave Phenomena
The bfile is the binary header file.

plane
plane
Figure 3.
The output of suplane, converted to RSF and displayed with sfwiggle.
[pdf] [png] [scons]

To convert files back from RSF to SEG-Y or SU, use the sfsegywrite program and reverse the input and output:

bash$ sfsuwrite > plane.su tfile=tfile.rsf endian=0 < plane.rsf
or
bash$ sfsegywrite > plane.segy tfile=tfile.rsf \
hfile=hfile bfile=bfile endian=0 < plane.rsf

If hfile= and bfile= are not supplied to sfsegywrite, the corresponding headers will be either picked from the default locations (files named header and binary) or generated on the fly. The trace header file can be generated with sfsegyheader. Here is an example:

bash$ rm header binary
bash$ sfheadermath < plane.rsf output=N+1 | sfdd type=int > tracl.rsf
bash$ sfsegyheader < plane.rsf tracl=tracl.rsf > tfile.rsf
bash$ sfsegywrite  < plane.rsf tfile=tfile.rsf > plane.segy


next up previous [pdf]

Next: Reading and writing ASCII Up: Compatibility with other file Previous: Compatibility with SEPlib

2012-07-19