Dym Patsiliandra
Dym Patsiliandra

Reputation: 11

Decode SEGD file and plot any trace from it

There is a SEGD file with some seismic data. How to decode any trace ?

The python script can read and decode headers according SEGD Rev 2.1 documentation. How to decode and plot any trace. Have tried to use 1 byte quatery exponebt data recording method. But having wrong result. The Data Body:

'10111110', '00101001', '11001111', '00010010', '10111101', '10100110', '00110010', '00100100', '10111100', '10010000', '10000100', '10010101', '00111101', '10101001', '00010110', '00100010', '00111110', '00001000', '10010001', '11011010', '00111101', '10101001', '00010110', '00100010', '00111100', '10011100', '00010100', '10001011',

expecting to get something like

    1.000e+00,  1.000e+00,  1.000e+00,  1.000e+00,  3.125e-02,
    1.000e+00,  1.000e+00,  1.000e+00,  1.000e+00,  1.000e+00,
    1.000e+00,  1.000e+00,  1.000e+00,  3.125e-02,  3.125e-02,
    3.125e-02,  3.125e-02,  3.125e-02,  3.125e-02,  3.125e-02,
    3.125e-02,  3.125e-02,  3.125e-02,  3.125e-02,  3.125e-02,
    3.125e-02,  3.125e-02,  3.125e-02,  3.125e-02,  3.125e-02,
    3.125e-02,  3.125e-02, -1.000e+00, -1.000e+00, -1.000e+00,
   -1.000e+00, -1.000e+00, -1.000e+00, -1.000e+00, -1.000e+00,
    3.125e-02,  3.125e-02,  3.125e-02,  3.125e-02,  7.000e+00,
    2.600e+01,  4.100e+01,  6.100e+01,  7.500e+01,  7.400e+01,
    5.900e+01,  3.600e+01,  1.500e+01,  1.000e+00, -7.000e+00,
   -1.200e+01, -1.300e+01, -1.400e+01, -1.200e+01, -1.000e+01,

Upvotes: 1

Views: 1709

Answers (1)

wingnut
wingnut

Reputation: 111

Use a struct. Create a format, and use it to read the file at the start of the trace, viz.

    tracedataformat = '!' + str('f' * ns)
    f.seek(pos)
    tr = np.zeros(ns, np.float)
    tr = np.array(struct.unpack(format, f.read(4 * ns)))
  • Read 32-bit floats in IEEE format
  • ns - the number of samples to read (get it from the channels descriptor)
  • pos - the position in bytes relative to the start of the file of the start of the trace.

Upvotes: 0

Related Questions