Closed KirillSimonov closed 4 years ago
Hi Kirill,
segyio does not have any native export functionality, which is a conscious decision as it's out-of-scope for the project. As such, there's no "one-button" export.
However, segyio is perfectly capable of delivering data to such an export. I'm not 100% sure if I got it right, but you want to plot and export an inline, right? Well, if so, you can pretty much read directly from segyio into matplotlib and have it work - something like matplotlib.pyplot.imshow(f.iline[il].T, cmap = 'seismic')
Dear @jokva ,
I want to extract data from SEG-Y in form of 2D images like one I attached ( to the left).
I will try your method and report a result.
You can refer to this example, and the others in https://mybinder.org/v2/gh/equinor/segyio-notebooks/master
Dear @jokva ,
Thank you!
1) I managed to do it but there is issue concerning the way I get image using matplotlib.pyplot.imshow
option as xline/iline gets rotated (without a priori knowing it, one will not understand it). I will attach image for clear picture. Is there a way to get image in correct configuration/
2) Could please explain or follow me to certaind docs on difference in opening segyfile in different manner:
with segyio.open(filename) as f:
seismic = segyio.tools.cube(filename)
segyfile = segyio.open(filename, 'r+')
I want try to modify initial segfiles by cutting depth slices at some degree. I saw that I can modify suing twt option, but I want to try editing addressing depth slices and after cutting, try to write gained file as segfile with geometryand other metadata from initial segfile.
I hope that I am clear.
Thank you.Sincerely, Kirill
I will attach image for clear picture. Is there a way to get image in correct configuration/
Your seismic uses axes differently than your image, which is completely expected. Transpose your data, i.e. plt.imshow(seismic[:, 100, :].T, cmap = 'gray', resample = None)
with segyio.open(filename) as f:
This is just opening the file (in a context manager), and builds an index of the in/crosslines. The file is read-only.
seismic = segyio.tools.cube(filename)
This is just a short-hand for reading all the data into a numpy array, assuming it's a proper 3D cube.
segyfile = segyio.open(filename, 'r+')
This should be with segyio.open(filename, 'r+') as f
, and is the same as the regular open, except now the file is in writable mode.
Thank you very much!
I want to import data with SEGY format and extract, tiff(.tif)
There are plenty of ways to do this, but here's one which should work fine:
import segyio
from PIL import Image
import numpy as np
from matplotlib import cm
with segyio.open('my_file.sgy') as segyfile:
slice_segy = segyfile.iline[segyfile.ilines[len(segyfile.ilines)//2]]
abs_max = np.max(np.abs(slice_segy))
scale = 1.0/(2.0*abs_max)
im = Image.fromarray(np.uint8(cm.seismic((slice_segy.T.clip(-abs_max, abs_max) + abs_max) * scale)*255))
im.save('out_inline-sgy.tif')
Dear authors,
Thank you for your excellent library! I am now trying to do project and want to export xlines and inlines from SEG-Y as TIFF images (or other image format). I tried to do in Petrel, but could not do it (the only export I see is export again in SEG-Y). I want to do it using "segyio", but at now I continously fail.
Could you please tell if I am correct in my pursue (may be this is inadequate operation) and if yes, please tell if this can be realized using segyio and how? Thank you.
Sincerely, Kirill