Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create base segy faster.. #10

Open
alpapapo opened this issue Dec 17, 2019 · 6 comments
Open

Create base segy faster.. #10

alpapapo opened this issue Dec 17, 2019 · 6 comments

Comments

@alpapapo
Copy link

According to segyio-notebooks/03_basic_segy_editing.ipynb -> Cut all traces, I am creating a minimum size empty segy from a "source" segy file with spec.samples = spec.samples[:1].

def create_initial_segy_from_same_survey_segy(segy, initial_segy_filename):
    spec = segyio.tools.metadata(segy)
    spec.samples = spec.samples[:1]
    logger.info("creating initial segy..")
    with segyio.create(initial_segy_filename, spec) as dst:
        dst.text[0] = segy.text[0]
        dst.bin = segy.bin
        dst.bin.update(hns=len(spec.samples))
        dst.header = segy.header
        dst.trace = segy.trace
    logger.info("Initial segy created!")

The thing is that copying dst.header = src.header takes too long as the "source" segy is huge. Is there any way to create faster the minimal base segy?

@mrava87
Copy link
Contributor

mrava87 commented Dec 17, 2019

Hi,
what are you planning to cut? Time axis or also restrict IL and XL?

@doiko
Copy link

doiko commented Dec 17, 2019

Hi Matteo, only time axis. We need the header for each trace though.

@mrava87
Copy link
Contributor

mrava87 commented Dec 17, 2019

Hi Dimitrios,
then I don't think you can't do anything better than what this notebooks suggests. Make an empty file and fill all header words. As the length of your traces is changed you can't copy the original file and work on a copy, but since you don't want to shrink IL or XL you can't be smarter and try to just to copy a subset of ILs/XLs.

@jokva do you see any other way to make the process faster?

@doiko
Copy link

doiko commented Dec 17, 2019

Thanks Matteo,
Is it possible to loop over the headers and copy them faster one by one?
What we see is that segyio when executing dst.header = segy.header tries to read the complete segy and since the segy is huge the process fails by trying to create a huge swap file.
@alpapapo do you agree on the behavior we notice?

@mrava87
Copy link
Contributor

mrava87 commented Dec 17, 2019

Hi,
have you tried dst.header.iline = segy.header.iline as in
https://github.com/equinor/segyio/blob/master/python/examples/copy-sub-cube.py

If the behavior you notice is real (@jokva ?) this may do the copy line by line. Another way is to do it trace by trace

for i in range(segy.tracecount):    
        dst.header[i] = segy.header[i] 
        dst.trace[i]  = segy.trace[i]

but this one is much slower than dst.header= segy.header.

@doiko
Copy link

doiko commented Dec 17, 2019

Hi Matteo,
Thanks for the suggestion, we will check it tomorrow.
Can this be related to issue equinor/segyio#423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants