TraceHeaderSpec

class segfast.trace_header_spec.TraceHeaderSpec(name=None, start_byte=None, dtype=None, byteorder=None)[source]

Trace header class to store its name, byte position and dtype (including endianness). By default, byte position is defined by name according to SEG-Y specification.

Parameters:
  • name (str) – Name of the header.

  • start_byte (int, optional) – Byte position of the header, by default None. If None, default byte position from the spec will be used.

  • dtype (int, str or dtype, optional) – dtype for header (e.g. 'i2', '>f4', numpy.float32) or its length in bytes (then is interpreted as integer type).

  • byteorder ('>' or '<', optional) – Endianness to use, if it’s not defined by dtype. If None and dtype doesn’t specify it, architecture default will be used.

TRACE_HEADER_SIZE = 240
STANDARD_HEADER_TO_BYTE

Mapping from standard header name to its start byte.

STANDARD_BYTE_TO_HEADER

Mapping from start byte to header name accordingly to standard.

START_BYTES

List bytes positions for standard headers

STANDARD_BYTE_TO_LEN

Mapping from start byte to length of header in bytes accordingly to standard.

property byte_len

The number of bytes for a header.

property is_standard

Whether the header matches the specification.

property has_standard_location

Whether the header matches the specification, except maybe the name.

property standard_name

The name from the specification for the header (if has_standard_location is True).

property has_default_byteorder

Whether default byteorder is defined.

property has_byteorder

Whether byteorder is defined.

property byteorder

Header byteorder (if defined).

set_default_byteorder(byteorder)[source]

Set byteorder to use as a default, if not specified by dtype.

to_tuple()[source]

Make a tuple of input params of the header.

to_dict()[source]

Make a dict of input params of the header.