When reading the headers of .seg files I get the following error:
Traceback (most recent call last):
File "A:\Nansena\SVR\sgy .py", line 37, in
main()
File "A:\Nansena\SVR\sgy .py", line 22, in main
with segyio.open(file, 'r') as f:
File "C:\Python38-32\lib\site-packages\segyio\open.py", line 187, in open
return infer_geometry(f, metrics, iline, xline, strict)
File "C:\Python38-32\lib\site-packages\segyio\open.py", line 7, in infer_geometry
cube_metrics = f.xfd.cube_metrics(iline, xline)
RuntimeError: unable to find sorting.
import segyio
import numpy as np
import sys
import os
np.set_printoptions(threshold=sys.maxsize)
def get_sgy(files):
res = []
for i in files:
if i.endswith('.sgy'):
res.append(i)
return res
def main():
directory = '.'
files = get_sgy(os.listdir(directory))
print(files)
for file in files:
with segyio.open(file, 'r') as f:
CDP_X = f.attributes(segyio.TraceField.CDP_X)[:]
CDP_Y = f.attributes(segyio.TraceField.CDP_Y)[:]
HourOfDay = f.attributes(segyio.TraceField.HourOfDay)[:]
MinuteOfHour = f.attributes(segyio.TraceField.MinuteOfHour)[:]
rez = zip(CDP_X, CDP_Y, HourOfDay, MinuteOfHour)
with open('rez2.txt', 'a', encoding='utf-8') as f:
f.write("-------------------\n")
f.write(file + "\n")
f.write("-------------------\n")
for i, j, q, z in rez:
f.write(str(i) +' '+str(j)+' '+str(q)+' '+str(z)+ ' '+ '\n')
When reading the headers of .seg files I get the following error: Traceback (most recent call last): File "A:\Nansena\SVR\sgy .py", line 37, in
main()
File "A:\Nansena\SVR\sgy .py", line 22, in main
with segyio.open(file, 'r') as f:
File "C:\Python38-32\lib\site-packages\segyio\open.py", line 187, in open
return infer_geometry(f, metrics, iline, xline, strict)
File "C:\Python38-32\lib\site-packages\segyio\open.py", line 7, in infer_geometry
cube_metrics = f.xfd.cube_metrics(iline, xline)
RuntimeError: unable to find sorting.
def get_sgy(files): res = [] for i in files: if i.endswith('.sgy'): res.append(i) return res
def main():
if name == 'main': main()