segytools.utils

Utility functions for segy data.

Module Contents

Functions

format_textheader_string(textheader)

Format the textheader to have each line be 80 characters long and

read_trace_data(→ numpy.array)

convert an input byte array to a numpy array.

segytools.utils.format_textheader_string(textheader)[source]

Format the textheader to have each line be 80 characters long and return a single string.

Parameters:

textheader (str) – The textual header string after decoding.

Returns:

Textual header with 80 characters per line.

Return type:

str

segytools.utils.read_trace_data(buf: bytes, fmt: segytools.datatypes.DataSampleFormat, byteorder='<') numpy.array[source]

convert an input byte array to a numpy array.

Parameters:
  • buf (bytearray) – input byte array object

  • fmt (DataSampleFormat) – Describes the format of the samples in the buffer

  • byteorder (str) – Either ‘<’ for little endian or ‘>’ for big endian

Returns:

1D array of trace data of length number of samples.

Return type:

numpy.ndarray

Raises:

ValueError