技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
segysak【数据与研究】Read SEG-Y as labelled xarray datasets with SEGY-SAK, inspect header-defined survey dimensions and process seismic volumes lazily. Use for SEG-Y/xarray/Dask workflows; use segyio for exact low-level trace and header editing.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Map trace headers to labelled dimensions without losing the original survey geometry. Header byte assignments are evidence to inspect, not safe guesses.
Inspect format/endian, trace count, sample count/interval, delay recording time, inline/crossline or CDP headers, coordinate units and scalar. SEG-Y sample intervals are stored in microseconds; the backend's vertical samples use milliseconds for ordinary time sections. A depth section needs an explicit depth convention. Confirm actual data units before labelling an axis.
Check dimension key uniqueness and missing traces. Sparse or irregular geometry may not form a complete rectangular cube. Keep the original trace index for exports. A dimension byte offset is one-based SEG-Y numbering (CDP ensemble is 21, inline is 189, crossline is 193); some upstream old examples use a wrong CDP offset. Use the actual file's header convention.
This fragment needs an existing, verified rectangular post-stack file. It uses
the 0.5 backend API; old segy_loader tutorials describe a different interface.
# example: labelled-segy
import xarray as xr
import segysak # registers accessors; the installed distribution provides the backend
with xr.open_dataset(
seismic_path,
engine="sgy_engine",
dim_byte_fields={"iline": 189, "xline": 193},
) as seismic:
inline_labels = seismic.iline.values.copy()
crossline_labels = seismic.xline.values.copy()
sample_coordinate = seismic.samples.values.copy()
amplitudes = seismic["data"].load().copy(deep=True)
For large surveys, open with Dask chunks chosen for the access pattern and retain
lazy operations until the selected result fits memory. Avoid .load() on a
whole production cube. Inspect coordinate variables before .sel() and use
.isel() only for integer positions.
Compare several labelled traces against original trace samples using segyio,
including the last sample and nonzero start time. Verify shape, orientation,
missing-trace behavior and coordinate scalars. Round-trip any export and compare
headers as well as amplitudes; xarray labels alone do not preserve every SEG-Y
header or prove geographic CRS. Keep source hash, byte mapping and transforms.
Use the current documentation and backend source.