Package: tilesegy
tilesegyTilesegy is a small MIT licensed Python library for easy interaction with seismic
data, powered byTileDB. It combines an
intuitive,segyio-like API with a powerful
storage engine.Feature summaryAvailable featuresConverting from SEG-Y and Seismic Unix formatted seismic data to TileDB arrays.Simple and powerful read-only API, closely modeled after segyio.100% unit test coverage.Fully type-annotated.Currently missing featuresAPI for write operations.Converting back to SEG-Y.TileDB configuration and performance tuning.Comprehensive documentation.Real-world usage.InstallationTilesegy can be installedfromPyPIbypip:pip install tilesegyfrom source by cloning theGitrepository:git clone https://github.com/gsakkis/tilesegy.git
cd tilesegy
python setup.py installYou may run the test suite with:python setup.py testConverting from SEG-YTilesegy comes with a commandline interface (CLI) calledsegy2tiledbfor converting
SEG-Y and Seismic Unix formatted files to TileDB formatted arrays. At minimum it takes
an input file and generates a tilesegy directory at the same parent directory with the
input and extension.tsgy:$ segy2tiledb a123.segy
$ du -sh a123.*
73M a123.sgy
55M a123.tsgyTo see the full list of options run:$ segy2tiledb -h
usage: segy2tiledb [-h] [-o] [-g {auto,structured,unstructured}] [--su]
                   [--iline ILINE] [--xline XLINE]
                   [--endian {big,msb,little,lsb}] [-s TILE_SIZE]
                   [--consolidation-buffersize CONSOLIDATION_BUFFERSIZE]
                   input [output]

Convert a segy file to tilesegy format

positional arguments:
  input                 Input segy file path
  output                Output tilesegy directory path (default: None)

optional arguments:
  -h, --help            show this help message and exit
  -o, --overwrite       Overwrite the output directory if it already exists (default: False)
  -g {auto,structured,unstructured}, --geometry {auto,structured,unstructured}
                        Geometry of the converted tilesegy:
                        - auto: same as the input segy.
                        - structured: same as `auto` but abort if a geometry cannot be inferred.
                        - unstructured: opt out on building geometry information.
                         (default: auto)

segyio options:
  --su                  Open a seismic unix file instead of SEG-Y (default: False)
  --iline ILINE         Inline number field in the trace headers (default: 189)
  --xline XLINE         Crossline number field in the trace headers (default: 193)
  --endian {big,msb,little,lsb}
                        File endianness, big/msb (default) or little/lsb (default: big)

tiledb options:
  -s TILE_SIZE, --tile-size TILE_SIZE
                        Tile size in bytes.
                        Larger tile size improves disk access time at the cost of higher memory (default: 4000000)
  --consolidation-buffersize CONSOLIDATION_BUFFERSIZE
                        The size in bytes of the attribute buffers used during consolidation (default: 5000000)APITilesegy generally follows the segyio API so you may consult its excellentdocumentationto learn about
the public attributes (ilines,xlines,offsets,samples) and addressing modes
(trace,header,attributes',iline,xline,fast,slow,depth_slice,gather,text,bin).You can find usage examples in the includedJupyter notebook.The following list outlines the main differences from segyio:Probably the biggest difference is that addressing modes that return a generator of
numpy arrays in segyio, in tilesegy return a single numpy array of higher dimension(s).
For example, in a SEG-Y with 50 ilines, 20 xlines, 100 samples, and 3 offsets:f.iline[0:5]:segyioreturns a generator that yields 5 2D numpy arrays of (20, 100) shapetilesegyreturns a 3D numpy array of (5, 20, 100) shapef.iline[0:5, :]:segyioreturns a generator that yields 15 2D numpy arrays of (20, 100) shapetilesegyreturns a 4D numpy array of (5, 3, 20, 100) shapeThe mappings returned bybin,headerandattributes(name)have string keys
instead ofsegyio.TraceFieldenums or integers.tilesegy.open(dir_path), thesegyio.open(file_path)equivalent, does not currently
take any optional parameters (e.g.strictorignore_geometry).tilesegyexposes two classes,TileSegyfor unstructured SEG-Y andStructuredTileSegyfor structured.StructuredTileSegyextendsTileSegy, so the whole unstructured API is inherited
by the structured.All attributes and addressing modes specific to structured files (e.g.ilinesorgather) are available only toStructuredTileSegy. In contrastsegyioreturnsNoneor raises an exception if these properties are accessed on unstructured files.There is nounstructuredattibute; usenot isinstance(f, StructuredTileSegy)instead.There is notracecountattribute; uselen(trace)instead.There is noext_headersattribute; uselen(text[1:])instead.