seisio API documentation
Description: I/O of seismic files …

# Package `seisio`

I/O of seismic files.

The seisio Python module provides basic input/output operations for seismic data in typical standard formats such as SEG-Y or SU.

In this module, data and trace headers are handled as Numpy structured arrays, i.e., the full spectrum of functions coming along with Numpy and related modules can be used. Simplicity and user-friendliness have priority in this module and its intended use compared to achieving the best performance or highest throughput. The classes and methods provided are kept deliberately simple to get students participating our lectures and exercises going with Python and seismic data in standard industry formats. The classes are not meant to offer all functionality required in a commercial production processing environment. Having said that, the module tries to keep performance in mind (e.g., using memory-mapped files where possible) and also offers functionality not readily available in other packages that are available in the Python ecosystem.

Author & Copyright: Dr. Thomas Hertweck, geophysics@email.de

License: GNU Lesser General Public License, Version 3 https://www.gnu.org/licenses/lgpl-3.0.html

## Sub-modules

`seisio.reader`

  Abstract reader for seismic files.

`seisio.seg2`

  I/O of seismic files in SEG2 format.

`seisio.segy`

  I/O of seismic files in SEG-Y format.

`seisio.seisio`

  SeisIO abstract base class.

`seisio.su`

  I/O of seismic files in SU format.

`seisio.tools`

  Tools to handle seismic trace headers as Numpy structured arrays.

`seisio.writer`

  Abstract writer for seismic files.

## Functions

`def check_thdef_validity(file)`

  Check the validity of a custom trace header definition table.

  ## Parameters

  `file` :`str`
    The name of the trace header definition JSON file to be checked.

  ## Returns

  `bool`
    True if definition file is valid, otherwise False.
`def input(file, *args, **kwargs)`

  Open a seismic file for reading.

  ## Parameters

  `file` :`str` or `pathlib.Path`
    The name of the file to read.
  `filetype` :`str`
    Force a specific file type if file suffix is unknown.

  All other arguments are passed to the underlying class once the type of input file is determined.

`def log_sgy_default_thdef()`

  Print default SEG-Y trace header definition table.

  ## Returns

  `list`
    A list of the trace header mnemonics.
`def log_su_default_thdef()`

  Print default SU trace header definition table.

  ## Returns

  `list`
    A list of the trace header mnemonics.
`def log_thstat(traces, zero=False)`

  Print statistics for each trace header mnemonic.

  ## Parameters

  `traces` :`Numpy structured array`
    The seismic traces (trace headers plus data) or the seismic trace headers (as provided by the 'read_all_headers' function).
  `zero` :`bool`, optional `(default: False)`
    Do not print entries that have a value of zero (False) or print all min/max entries, independent of values (True).
`def output(file, **kwargs)`

  Open a seismic file for writing.

  ## Parameters

  `file` :`str` or `pathlib.Path`
    The name of the file to write.
  `filetype` :`str`
    Force a specific file type if file suffix is unknown.

  All other arguments are passed to the underlying class once the type of output file is determined.

`def segy_bhdef_template(outfile)`

  Get a template to be used as SEG-Y binary header definition table.

  The template can be adjusted for binary header mnemonic names, types, byte offsets etc. and then used later on to allow for a custom-made binary header definition table.

  ## Parameters

  `outfile` :`str`
    Target name (or directory) for JSON.
`def segy_thdef1_template(outfile)`

  Get a template to be used as SEG-Y trace header ext. 1 definition table.

  The template can be adjusted for header mnemonic names, types, byte offsets etc. and then used later on to allow for a custom-made trace header extension 1 definition table.

  ## Parameters

  `outfile` :`str`
    Target name (or directory) for the JSON.
`def segy_thdef_template(outfile)`

  Get a template to be used as SEG-Y trace header definition table.

  The template can be adjusted for trace header mnemonic names, types, byte offsets etc. and then used later on to allow for a custom-made trace header definition table.

  ## Parameters

  `outfile` :`str`
    Target name (or directory) for the JSON.
`def segy_txthead_template(major_version=1, minor_version=0, fill=True)`

  Get a template for a SEG-Y textual file header.

  ## Parameters

  `major_version` :`int`, optional `(default: 1)`
    Major SEG-Y revision number.
  `minor_version` :`int`, optional `(default: 0)`
    Minor SEG-Y revision number.
  `fill` :`boolean`, optional `(default: True)`
    Fill the individual strings with Cxx convention (True) or not.

  ## Returns

  `list`
    A list of strings, 40 card images (strings), each of 80 characters.
`def su_thdef_template(outfile)`

  Get a template to be used as SU trace header definition table.

  The template can be adjusted for trace header mnemonic names, types, byte offsets etc. and then used later on to allow for a custom-made trace header definition table.

  ## Parameters

  `outfile` :`str`
    Target name (or directory) for the JSON.