Skip to main content

SEG-Y Seismic Data Inspection and Manipulation Tools using Xarray

Project description

Build status Python versions code style: black license Documentation Status help

https://img.shields.io/badge/swung-slack-blueviolet?link=https://softwareunderground.org/&link=swung.slack.com/

Access the full documentation for SEGY-SAK from readthedocs

LOGO

SEGY-SAK aims to be your Python Swiss Army Knife for Seismic Data.

To do this SEGY-SAK offers two things; a commandline interface (CLI) for inspecting and converting SEGY data to a more friendly format called NETCDF4, and by providing convienience functions for the data using xarray. We try hard to load the data the same way everytime so your functions will work no-matter which cube/line you load. The xarray conventions we use are outlined in the documentation.

Why NETCDF4? Well, NETCDF4 is a fancy type of enclosed file binary format that allows for faster indexing and data retreival than SEGY. We try our best to scan in the header information and to make it easy (or easier) to load SEGY in different formats, different configuration (2D, 2D gathers, 3D, 3D gathers). We do all this with the help of segyio which is a lower level interface to SEGY. If you stick to our xarray format of files we also offer utility functions to return to SEGY so you can export to other software.

Current Capabilities

  • CLI:

    • Convert 2D, 3D and gathers type SEGY to NETCDF4 and back. The NETCDF4 files are one line open with xarray.open_dataset.

    • Extract sub-volumes via cropping xline and inline.

    • Read EBCIDC header.

    • Perform a limited header scan.

  • Xarray and Python API:

    • Load 2D, 3D and gathers type SEGY to a xarray.Dataset.

    • Access header information and text headers in Python with conveience functions.

    • Select traces by UTM X and Y coordinates.

Installation

SEGY-SAK can be installed by using pip or python setuptools, we also provide an environment.yml for use with conda.

Python Package Index via pip

From the command line run the pip package manager

pip install segysak

Install from source

Clone the SEGY-SAK Github repository and in the top level directory run setuptools via

python setup.py install

CLI Quick Start

The command line interface (CLI) provides an easy tool to convert or manipulate SEG-Y data. In your Python command-line environment it can be accessed by calling segysak.

For a full list of options run

segysak --help

Any SEG-Y files converted using the convert command. For example

segysak convert test.segy

Can be loaded into Python using xarray.

test = xarray.open_dataset('test.SEISNC')

xarray seismic specification seisnc

The xarray seismic specification termed seisnc can be used by segysak to output NETCDF4 files is more performant for Python operations than standard SEG-Y. Unlike SEG-Y, xarray compatable files fit neatly into the Python scientific stack providing operations like lazy loading, easy slicing, compatability with multi-core and multi-node operations using dask as well as important features such as labelled axes and coordinates.

This specification is not meant to be prescriptive but outlines some basic requirements for xarray datasets to work with SEGYSAK functionality.

SEGY-SAK uses the convention .seisnc for the suffix on NETCDF4 files it creates. These files are datasets with specific 1D and 2D coordiates and have a single variable called data. The data variable contains the seismic cube volume or 2D line traces. Attributes can be used to provide further metadata about the cube.

3D and 3D Gathers

SEGY-SAK uses the convention labels of iline, xline and offset to describe the bins of 3D data. Vertical dimensions are twt and depth. A typical xarray dataset created by SEGY-SAK will return for example

>>> seisnc_3d = segysak.segy_loader('test3d.sgy', iline=189, xline=193)
>>> seisnc_3d.dims

Frozen(SortedKeysDict({'iline': 61, 'xline': 202, 'twt': 850}))

2D and 2D Gathers

For 2D data SEGY-SAK uses the dimensino labels cdp and offset. This allows the package to distinguish between 2D and 3D data to allow automation on saving and convience wrappers. The same vertical dimensions apply as for 3D. A typical xarray in 2D format would return

>>> seisnc_2d = segysak.segy_loader('test2d.sgy', cdp=21)
>>> seisnc_2d.dims

Frozen(SortedKeysDict({'cdp': 61, 'twt': 850}))

Coordinates

If the cdpx and cdpy byte locations are specified during loading the SEGY the coordinates will be populated from the headers with the variable names cdp_x and cdp_y. These will have dimensions equivalent to the horizontal dimensions of the data (iline, xline for 3D and cdp for 2D).

Attributes

Any number of attributes can be added to a siesnc file. Currently the following attributes are extracted or reserved for use by SEGY-SAK.

  • ns number of samples per trace

  • ds sample interval

  • text ebcidc header as ascii text

  • d3_units vertical units of the data

  • d3_domain vertical domain of the data

  • epsg data epsg code

  • corner_points corner points of the dataset in grid coordinates

  • corner_points_xy corner points of the dataset in xy

  • source_file name of the file the dataset was created from

  • srd seismic reference datum of the data in vertical units d3_units and d3_domain

  • datatype the data type e.g. amplitude, velocity, attribute

Complete Documentation

The complete documentation for SEGY-SAK can be found at readthedocs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

segysak-0.2.4.dev20.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

segysak-0.2.4.dev20-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file segysak-0.2.4.dev20.tar.gz.

File metadata

  • Download URL: segysak-0.2.4.dev20.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for segysak-0.2.4.dev20.tar.gz
Algorithm Hash digest
SHA256 76bf3b5eb459191f2e7f5caa0bdfcef6c83bfe9bf37b0d6bea65024bd955f70b
MD5 470a114c7231c17b562e685066e4b539
BLAKE2b-256 59384a9061de8a96fbdadda75a56cfdf3fe9ada2536204f2617040c0ec5f494e

See more details on using hashes here.

File details

Details for the file segysak-0.2.4.dev20-py3-none-any.whl.

File metadata

  • Download URL: segysak-0.2.4.dev20-py3-none-any.whl
  • Upload date:
  • Size: 45.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

File hashes

Hashes for segysak-0.2.4.dev20-py3-none-any.whl
Algorithm Hash digest
SHA256 f2652e789875f793103899ffef191b820904afc226ed283d6975c09f24c11db9
MD5 9bcb0f77195e0cbf13a7e45afa47c125
BLAKE2b-256 381cd4c56835ee89db3b126d643e9efee4133bd8c52a689e5ba5d93cee5b9ab5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page