equinor / segyio

Fast Python library for SEGY files.
Other
476 stars 214 forks source link

I can not arrange pairwise coordinate output CDP_X, CDP_Y. It turns out the output of the entire array CDP_X then CDP_Y #429

Closed aleran84 closed 4 years ago

aleran84 commented 4 years ago

import segyio import numpy as np import sys np.set_printoptions(threshold=sys.maxsize) import os directory = 'G:\segy' files = os.listdir(directory) i = 0 while (i < len(files)): if (files[i].endswith('.sgy')): with segyio.open(directory + '/' + files[i],"r") as f: CDP_X = f.attributes(segyio.TraceField.CDP_X)[:] CDP_Y = f.attributes(segyio.TraceField.CDP_Y)[:] a=[[CDP_X],[CDP_Y]] for i in range(len(a)): print(CDP_X[:],CDP_Y[:])

i += 1

else: i += 1

jokva commented 4 years ago

You want to stack them np.column_stack([CDP_X, CDP_Y]), or a function called zip [1]. Like your previous issue, this is not really segyio related, but rather general python programming. Do you maybe need additional resources for learning details of python and numpy?

[1] https://docs.python.org/3.3/library/functions.html#zip