seismic-zfp

Compress and decompress seismic data

https://github.com/equinor/seismic-zfp

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: researchgate.net
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Compress and decompress seismic data

Basic Info
  • Host: GitHub
  • Owner: equinor
  • License: lgpl-3.0
  • Language: Python
  • Default Branch: master
  • Size: 1.39 MB
Statistics
  • Stars: 72
  • Watchers: 10
  • Forks: 16
  • Open Issues: 3
  • Releases: 25
Created over 6 years ago · Last pushed 8 months ago
Metadata Files
Readme License Code of conduct Citation Security

README.md

seismic-zfp

LGPLv3 License Run Tests codecov SCM Compliance PyPi Version

Python library to convert SEG-Y files to compressed cubes and retrieve arbitrary sub-volumes from these, fast.

Motivation

Reading whole SEG-Y volumes to retrieve, for example, a single time-slice is wasteful.

Copying whole SEG-Y files uncompressed over networks is also wasteful.

This library addresses both issues by implementing the seismic-zfp (.SGZ) format. This format is based on ZFP compression from Peter Lindstrom's paper using the official Python bindings, distributed as zfpy.

ZFP compression enables smoothly varying d-dimensional data in 4d subvolumes to be compressed at a fixed bitrate. The 32-bit floating point values in 4x4x4 units of a 3D post-stack SEG-Y file are well suited to this scheme.

Decomposing an appropriately padded 3D seismic volume into groups of these units which exactly fill one 4KB disk block, compressing these groups, and writing them sequentially to disk yields a file with the following properties: - Compression ratio of 2n:1 compression, typically a bitrate of 4 works well, implying a ratio of 8:1 - The location of any seismic sample is known - Arbitrary subvolumes can be read with minimal redundant I/O, for example: - Padding IL/XL dimensions with 4, and the z-dimension depending on bitrate - Padding IL/XL dimensions with 64 and the z-dimension with 4 (16:1 compression)

Using IL/XL optimized layout

  • Groups of 4 inlines or crosslines can be read with no redundant I/O
  • A single inline can be read and with no additional I/O compared to the SEG-Y best-case scenario (provided at least 4:1 compression ratio)
  • A z-slice can be read by accessing ntraces/16 disk blocks, compared to ntraces disk blocks for SEG-Y #### Using z-slice optimized layout ####
  • A z-slice can be read by accessing just ntraces/4096 disk blocks, compared to ntraces disk blocks for SEG-Y #### 2D SEG-Y Support #### As of v0.2.4 support for compressing 2D SEG-Y files (INLINE3D and CROSSLINE3D always zero) is included. Compression and reading follows the same pattern as 3D files, but segyio emulation only provides the following attributes: trace, header, samples, bin & text. However an additional funciton read_subplane() is available for extracting horizontally and vertically contrained data.

Headers

The seismic-zfp (.SGZ) format also allows for preservation of information in SEG-Y file and trace headers, with compression code identifying constant and varying trace header values and storing these appropriately.

For further explanation of the design and implementation of seismic-zfp, please refer to publications.

NOTE: Previously the extension .sz was used for seismic-zfp, but has been replaced with .sgz to avoid confusion around the compression algorithm used.

Get seismic-zfp

  • Wheels from PyPI with zgy and vds support: pip install seismic-zfp[zgy,vds]
  • Wheels from PyPI without zgy or vds support: pip install seismic-zfp
  • Source from Github: git clone https://github.com/equinor/seismic-zfp.git

Note that seismic-zfp depends on the Python package ZFPY, which is a binary distribution on PyPI built for Linux and Windows.

The optional dependency pyvds - requires openvds package from Bluware which is *not** open-source*

The optional dependency of zgy2sgz has been replaced with pyzgy - a pure-Python alternative.

Examples

Full example code is provided here, but the following reference is useful:

Create SGZ files from SEG-Y, ZGY or VDS

```python from seismic_zfp.conversion import SegyConverter, ZgyConverter, VdsConverter

with SegyConverter("in.sgy") as converter: # Create a "standard" SGZ file with 8:1 compression, using in-memory method converter.run("outstandard.sgz", bitspervoxel=4) # Create a "z-slice optimized" SGZ file converter.run("outadv.sgz", bitspervoxel=2, blockshape=(64, 64, 4))

with ZgyConverter("in8-int.zgy") as converter: # 8-bit integer ZGY and 1-bit SGZ have similar quality converter.run("out8bit.sgz", bitspervoxel=1)

with VdsConverter("in.vds") as converter: # VDS compression is superior, but doesn't permit non-cubic bricks... converter.run("out.sgz", bitspervoxel=4, blockshape=(8, 8, 128)) ```

Convert SGZ files to SEG-Y

```python

Convert SGZ to SEG-Y

with SgzConverter("outstandard.sgz") as converter: converter.convertto_segy("recovered.sgy") ```

Read an SGZ file

python from seismic_zfp.read import SgzReader with SgzReader("in.sgz") as reader: inline_slice = reader.read_inline(LINE_IDX) crossline_slice = reader.read_crossline(LINE_IDX) z_slice = reader.read_zslice(LINE_IDX) sub_vol = reader.read_subvolume(min_il=min_il, max_il=max_il, min_xl=min_xl, max_xl=max_xl, min_z=min_z, max_z=max_z)

Use segyio-like interface to read SGZ files

python import seismic_zfp with seismic_zfp.open("in.sgz")) as sgzfile: il_slice = sgzfile.iline[sgzfile.ilines[LINE_NUMBER]] xl_slices = [xl for xl in sgzfile.xline] zslices = sgzfile.depth_slice[:5317] trace = sgzfile.trace[TRACE_IDX] trace_header = sgzfile.header[TRACE_IDX] binary_file_header = sgzfile.bin text_file_header = sgzfile.text[0] Including equivalents to segyio.tools ```python with seismiczfp.open("in.sgz") as sgzfile: dtsgz = seismiczfp.tools.dt(sgz_file)

cubesgz = seismiczfp.tools.cube("in.sgz") ```

Plus some extended utility functionality: python with seismic_zfp.open("in.sgz")) as sgzfile: subvolume = sgzfile.subvolume[IL_NO_START:IL_NO_STOP:IL_NO_STEP, XL_NO_START:XL_NO_STOP:XL_NO_STEP, SAMP_NO_START:SAMP_NO_STOP:SAMP_NO_STEP] header_arr = sgzfile.get_tracefield_values(segyio.tracefield.TraceField.NStackedTraces)

Command Line Interface

A simple command line interface for converting from SEGY or ZGY to SGZ is also bundled with seismic-zfp. This is available using the command seismic-zfp.

Converting from SEG-Y to SGZ and back

bash seismic-zfp sgy2sgz <INPUT FILE PATH> <OUTPUT FILE PATH> --bits-per-voxel 4 seismic-zfp sgz2sgy <INPUT FILE PATH> <OUTPUT FILE PATH> To see all options run the command seismic-zfp sgy2sgz --help

Converting from ZGY to SGZ

bash seismic-zfp zgy2sgz <INPUT FILE PATH> <OUTPUT FILE PATH> --bits-per-voxel 4 To see all options run the command seismic-zfp zgy2sgz --help

Contributing

Contributions welcomed, whether you are reporting or fixing a bug, implementing or requesting a feature. Either make a github issue or fork the project and make a pull request. Please extend the unit tests with relevant passing/failing tests, run these as: python -m pytest

Publications

Wade, David (2020): Seismic-ZFP: Fast and Efficient Compression and Decompression of Seismic Data, First EAGE Digitalization Conference and Exhibition, Nov 2020, Volume 2020, p.1-5 - Full-Text PDF (without EAGE formatting) - EarthDoc Link (N.B. paywall protected)

Owner

  • Name: Equinor
  • Login: equinor
  • Kind: organization

Citation (CITATION)


@article{eage:/content/papers/10.3997/2214-4609.202032080,
   author = "Wade, D.",
   title = "Seismic-ZFP: Fast and Efficient Compression and Decompression of Seismic Data", 
   journal= "",
   year = "2020",
   volume = "2020",
   number = "1",
   pages = "1-5",
   doi = "https://doi.org/10.3997/2214-4609.202032080",
   url = "https://www.earthdoc.org/content/papers/10.3997/2214-4609.202032080",
   publisher = "European Association of Geoscientists &amp; Engineers",
   issn = "2214-4609",
   type = "",
  }

GitHub Events

Total
  • Create event: 14
  • Issues event: 2
  • Release event: 6
  • Watch event: 6
  • Delete event: 2
  • Issue comment event: 7
  • Push event: 25
  • Pull request review event: 30
  • Pull request review comment event: 28
  • Pull request event: 19
  • Fork event: 1
Last Year
  • Create event: 14
  • Issues event: 2
  • Release event: 6
  • Watch event: 6
  • Delete event: 2
  • Issue comment event: 7
  • Push event: 25
  • Pull request review event: 30
  • Pull request review comment event: 28
  • Pull request event: 19
  • Fork event: 1

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 385
  • Total Committers: 11
  • Avg Commits per committer: 35.0
  • Development Distribution Score (DDS): 0.366
Past Year
  • Commits: 35
  • Committers: 5
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.429
Top Committers
Name Email Commits
David Wade d****d@e****m 244
dawad d****d@s****m 94
Thomas Otto Ryschawy t****y@e****m 20
snyk-bot s****t@s****o 8
Fredrik Mellemstrand f****l@e****m 8
Olav Vatne o****n@e****m 3
Sindre Osnes s****n@e****m 2
Øistein Haaland (IT SI SIS0) o****a@a****o 2
fahaddilib f****b@g****m 2
Øyvind Skjæveland 4****l 1
Daniel Martin Lewis Barker b****r@n****o 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 17
  • Total pull requests: 86
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 1 month
  • Total issue authors: 7
  • Total pull request authors: 13
  • Average comments per issue: 1.71
  • Average comments per pull request: 0.19
  • Merged pull requests: 77
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 12
  • Average time to close issues: 1 day
  • Average time to close pull requests: 15 days
  • Issue authors: 1
  • Pull request authors: 4
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.17
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • da-wad (8)
  • olavvatne (3)
  • jcrivenaes (2)
  • SindreOsnes (1)
  • VitaminORA (1)
  • tforgaard (1)
  • fmell (1)
Pull Request Authors
  • da-wad (65)
  • ThomasRyschawyEquinor (7)
  • jafr67 (6)
  • TovTyvold (3)
  • fmell (3)
  • olavvatne (3)
  • SindreOsnes (2)
  • snyk-bot (2)
  • dmlbarker (2)
  • oyskjaevel (1)
  • oihaa (1)
  • fahaddilib (1)
  • waldeland (1)
Top Labels
Issue Labels
bug (1) good first issue (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 2,211 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 3
    (may contain duplicates)
  • Total versions: 78
  • Total maintainers: 4
proxy.golang.org: github.com/equinor/seismic-zfp
  • Versions: 41
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
pypi.org: seismic-zfp

Compress and decompress seismic data

  • Versions: 37
  • Dependent Packages: 0
  • Dependent Repositories: 3
  • Downloads: 2,211 Last month
Rankings
Downloads: 8.3%
Stargazers count: 8.8%
Dependent repos count: 9.0%
Average: 9.3%
Dependent packages count: 10.0%
Forks count: 10.5%
Last synced: 6 months ago

Dependencies

gui/requirements.txt pypi
  • pyinstaller *
  • seismic-zfp *
  • tkinter *
requirements-dev.txt pypi
  • matplotlib *
  • mock *
  • pillow *
  • pytest *
requirements.txt pypi
  • azure-storage-blob *
  • click *
  • numpy >=1.20
  • psutil *
  • pyvds *
  • pyzgy *
  • segyio *
  • xarray >=0.20.2
  • zfpy *
setup.py pypi
  • click *
  • numpy >=1.20
  • psutil *
  • segyio *
  • zfpy *
.github/workflows/codecov.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/publish-to-pypi.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/run_tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite