![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Python library to convert SEG-Y files to compressed cubes and retrieve arbitrary sub-volumes from these, fast.
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:
As of v0.2.4 support for compressing 2D SEG-Y files (INLINE_3D and CROSSLINE_3D 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.
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.
pip install seismic-zfp[zgy,vds]
pip install seismic-zfp
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.
Full example code is provided here, but the following reference is useful:
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("out_standard.sgz", bits_per_voxel=4)
# Create a "z-slice optimized" SGZ file
converter.run("out_adv.sgz", bits_per_voxel=2, blockshape=(64, 64, 4))
with ZgyConverter("in_8-int.zgy") as converter:
# 8-bit integer ZGY and 1-bit SGZ have similar quality
converter.run("out_8bit.sgz", bits_per_voxel=1)
with VdsConverter("in.vds") as converter:
# VDS compression is superior, but doesn't permit non-cubic bricks...
converter.run("out.sgz", bits_per_voxel=4, blockshape=(8, 8, 128))
# Convert SGZ to SEG-Y
with SgzConverter("out_standard.sgz") as converter:
converter.convert_to_segy("recovered.sgy")
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)
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
with seismic_zfp.open("in.sgz") as sgz_file:
dt_sgz = seismic_zfp.tools.dt(sgz_file)
cube_sgz = seismic_zfp.tools.cube("in.sgz")
Plus some extended utility functionality:
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)
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
.
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
seismic-zfp zgy2sgz <INPUT FILE PATH> <OUTPUT FILE PATH> --bits-per-voxel 4
To see all options run the command seismic-zfp zgy2sgz --help
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
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
FAQs
Compress and decompress seismic data
We found that seismic-zfp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.