equinor / segyio

Fast Python library for SEGY files.
Other
476 stars 214 forks source link

How to read minimum and maximum values of time (ms) (Z range) from .sgy files using segyio or any other seismic reader library? #473

Closed SoumiC closed 3 years ago

SoumiC commented 3 years ago

Hi, Earlier I dealt with Seismic data distributed from t=0ms to t= 2500 ms or t=3600ms. So, I checked the number of samples in a trace and number of sampling intervals from the .sgy files and created a time-vector using these. Let say for a sampling interval of 10ms and the number of samples in a trace of 251, the time vector would be = [0,10,20,30,...,2500] ms. But now I have got a seismic amplitude file where time (depth from the surface through the subsurface) varies from t=1500ms to t=2500 ms. I need to detect these minimum and maximum t values from the .sgy file itself using Python.

Kindly help me out to find the command (or field in the segy readers) or if you know any other library to do it.

Thanks a lot in advance!

Regards, Soumi

SoumiC commented 3 years ago

Hi, twt vector extracted in https://notebooks.gesis.org/binder/jupyter/user/equinor-segyio-notebooks-s22dijos/notebooks/notebooks/basic/02_segy_quicklook.ipynb notebook.

with segyio.open(filename, ignore_geometry=True) as f:

Get basic attributes

n_traces = f.tracecount
sample_rate = segyio.tools.dt(f) / 1000
n_samples = f.samples.size
twt = f.samples

Regards, Soumi

jokva commented 3 years ago

Varying sample intervals can be read by scanning all the headers, and reading the 'Interval' or Seismic Unix 'ns' word.

for header in f.header:
    print(header[segyio.su.ns])

The sample rate and interval stored on the file handle is based on the assumption that the sampling interval is uniform in the file, which it sometimes is not.