obspy.io.segy.core._read_segy

_read_segy(filename, headonly=False, byteorder=None, textual_header_encoding=None, unpack_trace_headers=False, **kwargs)[source]

Reads a SEG Y file and returns an ObsPy Stream object.

Warning

This function should NOT be called directly, it registers via the ObsPy read() function, call this instead.

Parameters:
  • filename (str) SEG Y rev1 file to be read.
  • headonly (bool, optional) If set to True, read only the header and omit the waveform data.
  • byteorder (str or None) Determines the endianness of the file. Either '>' for big endian or '<' for little endian. If it is None, it will try to autodetect the endianness. The endianness is always valid for the whole file. Defaults to None.
  • textual_header_encoding (str or None) The encoding of the textual header. Can be 'EBCDIC', 'ASCII' or None. If it is None, autodetection will be attempted. Defaults to None.
  • unpack_trace_headers (bool, optional) Determines whether or not all trace header values will be unpacked during reading. If False it will greatly enhance performance and especially memory usage with large files. The header values can still be accessed and will be calculated on the fly but tab completion will no longer work. Look in the headers.py for a list of all possible trace header values. Defaults to False.
Returns:

A ObsPy Stream object.

Example

>>> from obspy import read
>>> st = read("/path/to/00001034.sgy_first_trace")
>>> st  
<obspy.core.stream.Stream object at 0x...>
>>> print(st)  
1 Trace(s) in Stream:
Seq. No. in line:    1 | 2009-06-22T14:47:37.000000Z - ... 2001 samples