equinor / segyio

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

The problem is to read the entire header with all coordinates of the CDP_X CDP_Y seismic trace #428

Closed aleran84 closed 4 years ago

aleran84 commented 4 years ago

import segyio import numpy as np import os directory = 'G:\segy' files = os.listdir(directory) i = 0 while (i < len(files)): if (files[i].endswith('.sgy')): with segyio.open(directory + '/' + files[i],"r") as f: CDP_X = f.attributes(segyio.TraceField.CDP_X)[:] print(CDP_X) CDP_Y = f.attributes(segyio.TraceField.CDP_Y)[:] print(CDP_Y)

    i += 1
else:
    i += 1
jokva commented 4 years ago

What is the problem, exactly?

aleran84 commented 4 years ago

I need to get the entire list of coordinates CDP_X and CDP_Y from the segy file. The method CDP_X = f.attributes(segyio.TraceField.CDP_X)[:] specified in the script gives only the first and last three coordinates. While in the file (trace) there are 1300

jokva commented 4 years ago

Have you tried manually extracting the same fields from f.header, or verified your CDPX/Y from other sources? Your code looks fine, and should give you all different CDPX/Y. Can you post the output?

aleran84 commented 4 years ago

image

In the middle column, the selection of the same file by a third-party geophysical program on CDP_X CDP_Y

jokva commented 4 years ago

Try np.unique(CDP_Y), it looks like a print-abbreviation issue. Or increase the print limit in numpy.

aleran84 commented 4 years ago

CDP_X = f.attributes(segyio.TraceField.CDP_X)[:] np.unique(print(CDP_X)) CDP_Y = f.attributes(segyio.TraceField.CDP_Y)[:] np.unique(print(CDP_Y)) ========================= RESTART: D:\Pyhton\import.py ========================= [46387610 46387620 46387630 ... 46381910 46381940 46381970] [824465030 824464870 824464720 ... 824222190 824222040 824221880] The result is the same (((

jokva commented 4 years ago

print(np.unique(CDP_X))

aleran84 commented 4 years ago

CDP_X = f.attributes(segyio.TraceField.CDP_X)[:] print(np.unique(CDP_X)) CDP_Y = f.attributes(segyio.TraceField.CDP_Y)[:] print(np.unique(CDP_Y)) [46380728 46380732 46380739 ... 46388308 46388309 46388310] [824221880 824222040 824222190 ... 824464720 824464870 824465030

Similarly ...

jokva commented 4 years ago
import sys
np.set_printoptions(threshold=sys.maxsize)

The problem is that the print is truncated.

aleran84 commented 4 years ago

WORKING !!! A little later I will check the correspondence between the headers and the actual data. I am very grateful to you!

jokva commented 4 years ago

Splendid.