sixty-north / segpy

A Python package for reading and writing SEG Y files.
Other
102 stars 54 forks source link

how to get data #89

Open data-inversion opened 5 years ago

data-inversion commented 5 years ago

hi,l want to get the 3D seismic data in python env.but l search for long time ,l don't find the method ,l have get the file. image

rob-smallshire commented 5 years ago

The error message tells you that data is an array.array. This is a collection type from the Python Standard Library. You can read about it in the Python documentation. As the error says, the array type does not have a an attributes called type. You can get the type code using the typecode attribute

SoumiC commented 5 years ago

Hi, You can find the number of traces and run a for loop to extract signal at each trace by finding out index at particular inline/xline. Then, use the index to extract data from the location.

total_inL=segy_reader.num_inlines() #total number of inlines total_xL=segy_reader.num_xlines() #total number of xlines inL_range = segy_reader.inline_numbers() #inline range xL_range = segy_reader.xline_numbers() #xline range inL = np.array(inL_range) # Inline numbers xL = np.array(xL_range) #xL numbers trace_num = segy_reader.num_traces() #Total number of traces

for loop start

    indx_temp = segy_reader.trace_index(inl_xl_tuple_temp)
    sample_temp = segy_reader.trace_samples(indx_temp)

for loop end

rob-smallshire commented 5 years ago

You can also use the inline_xline_numbers() method to give an iterator which generates all the valid (inline, xline) tuples:

for inline_xline in segy_reader.inline_xline_numbers():
    index = segy_reader.trace_index(inline_xline)
    samples = segy_reader.trace_samples(index)
    # Do something with the samples array