equinor / segyio

Fast Python library for SEGY files.
Other
471 stars 213 forks source link

saving .sgy file #493

Closed Ruaa93 closed 3 years ago

Ruaa93 commented 3 years ago

Hello,

first of all, i would like to thank you for your work. I just have a question regarding saving .sgy file. I'm trying to open a file and applying a flip function (np.fliplr(data)) to the original seismic file (This works fine as shown below). However, I'm not sure how to save the flipped array as .sgy. can you please assist?

d= "./name.sgy" data = segyio.tools.cube(d) new_array= np.fliplr(data)

jokva commented 3 years ago

Make a copy, then update the copy in-place.

with segyio.open('copy.sgy', 'r+') as dst:
    for tr in range(len(data)):
        dst.trace[tr] = data[tr]