Skip to content

Python scripts to read SEG2 format seismic/radar files

License

Notifications You must be signed in to change notification settings

natstoik/seg2_files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

seg2_files

Simple file reading tools

seg2_files is a basic tool for reading binary SEG2 format seismic and ground-penetrating radar data files. It improves on other implementations by having few non-standard library dependencies (only numpy) and being able to read file headers containing any field supported by the SEG2 standard.

Using this library

First, import the function "seg2_load" from the seg2load module in the library:

from seg2_files.seg2load import seg2_load

Next, load the trace data as a numpy array with traces as columns, and header as a dictionary from a SEG2 file:

traces, header = seg2_load('example_file.seg2')

The header is a nested dictionary, with the following structure:

header

  • Key:'tr' Value: dictionary of trace headers
    • Key: trace header field e.g. 'SAMPLE_INTERVAL' for trace timestep (more are detailed on page 7 of the SEG2 specification), Value: List of values of the key field for each trace in the file in order
  • Key: 'rec' Value: Dictionary with field names as keys (found in SEG2 standard, pages 8-11) containing information about the entire recording (file)

For an explanation of the field names (keys for the second level in the dictionary) see pages 7-11 of the SEG2 standard: https://www.seg.org/Portals/0/SEG/News%20and%20Resources/Technical%20Standards/seg_2.pdf

As an example, to get the timestep (dt) between samples of the 3rd trace in a file, you can use:

seis_data, seis_header = seg2_load('example_file.seg2')
dt = seis_header['tr']['SAMPLE_INTERVAL'][2]

And that's all there is to it! This library is simple but hopefully should cover most basic use cases. Don't hesitate to contact me if you have an additional feature idea that you think would be useful or if I missed part of the standard implementation.

Note that this is library is supposed to be pretty bare-bones - it reads SEG2 files (maybe SEGY in the future) and turns them into Python data types. That's it. Processing, plotting, etc. are up to other libraries or you.

About

Python scripts to read SEG2 format seismic/radar files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages