Open ivan-marroquin opened 3 years ago
Any comments/suggestions?
Hi,
My best guess is that you have a bug when you create your own CDP lookup table, rather than just copying the header as-is. I'd start by simplifying that as you don't really benefit from creating the headers from scratch.
Hi @jokva
Many thanks for the suggestion. So, I decided to follow the Python code in https://github.com/equinor/segyio/blob/master/python/examples/copy-sub-cube.py
Here is my new script: ########################################## import numpy as np import segyio import os
def generate_sub_volume(inline, xline, filename, outfile): path= "E:\My_Python_Scripts\Labels_Volume\"
os.chdir(path)
with segyio.open(filename, "r") as source:
# gather information from input segy file
print('Inlines', np.amin(source.ilines), ' ', np.amax(source.ilines))
print('Xlines ', np.amin(source.xlines), ' ', np.amax(source.xlines))
print('Steps inlines/xlines', source.ilines[1] - source.ilines[0], ' ', source.xlines[1] - source.xlines[0])
print('Start/End times', source.samples[0]/1000, source.samples[-1]/1000)
print('Samples', len(source.samples))
print('Sampling rate', abs(source.samples[1] - source.samples[0]))
# set specifications of output sub-volume following format of input segy file
spec= segyio.spec()
spec.sorting= int(source.sorting)
spec.format= int(source.format)
spec.samples= source.samples
step_inlines= source.ilines[1] - source.ilines[0]
step_xlines= source.xlines[1] - source.xlines[0]
# define indices of sub-volume of traces to extract from input volume, add 1 to acount for edge factor when slicing in Python
range_ilines= np.arange((inline[0] - source.ilines[0])/step_inlines, (inline[1] - source.ilines[0])/step_inlines + 1, step_inlines).astype(int)
range_xlines= np.arange((xline[0] - source.xlines[0])/step_xlines, (xline[1] - source.xlines[0])/step_xlines + 1, step_xlines).astype(int)
spec.ilines= source.ilines[range_ilines]
spec.xlines= source.xlines[range_xlines]
# generate output sub-volume
with segyio.create(outfile, spec) as dest:
# copy text header
for itext in range(1 + source.ext_headers):
dest.text[itext]= source.text[itext]
# copy binary header
dest.bin= source.bin
# inster modifications needed for new shape
num_traces= (max(range_ilines) - min(range_ilines) + 1) * (max(range_xlines) - min(range_xlines) + 1)
dest.bin= {segyio.BinField.Traces: num_traces}
# copy headers in the new inlines
dest.header.iline= source.header.iline
# copy traces (inline mode)
dest.iline= source.iline
if name == 'main':
inline= [1000, 1010]
xline= [950, 960]
# provide name of input segy file
filename= 'test.segy'
# provide name of output sub-volume
outfile= 'toto.segy'
generate_sub_volume(inline, xline, filename, outfile)
##########################################
Unfortunately, the segy generated cannot be imported into my interpretation package.
What am I missing? Do you have other suggestions?
Best regards, Ivan
Hi,
Thanks for such great package!
I wanted to extract a sub-volume from a 3D survey. The sub-volume is defined by a range of inlines and crosslines. For that, I followed your examples. Although the sub-volume gets generated, once I export the segy file into my interpretation package. I notice that the sub-volume is miss-positioned with respect to the input 3D survey. Please refer to attached screen shot, in which I illustrate the issue. Also, you will find a copy of the script that I used to extract the sub-volume.
Many thanks for your suggestions,
Ivan
Extracted_sub_volume.zip