Code Monkey home page Code Monkey logo

seg2_files's Introduction

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.

seg2_files's People

Contributors

natstoik avatar

Stargazers

Jean-Sébastien Gosselin avatar  avatar ives avatar

Watchers

 avatar

seg2_files's Issues

Not working for files from ABEM seismographs

seg2_load fails for .sg2 files from ABEM seismographs. Files from Mark VI seismographs simply never load (attempted for tens of minutes, while files from Geometrics seismographs load in under 5 milliseconds on same system), and those from Terraloc 2 fail when attempting to read free strings, with error code UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte.

May be the result of a non-standard implementation of the SEG-2 format.

Issue was detected on Windows with multiple files - will test on Linux.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.