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

conversion from float32 to int16 issue #560

Open
ivan-marroquin opened this issue Oct 31, 2023 · 1 comment
Open

conversion from float32 to int16 issue #560

ivan-marroquin opened this issue Oct 31, 2023 · 1 comment

Comments

@ivan-marroquin
Copy link

Hi

Thanks a lot for such great package! I am using Python 3.10.0 with numpy 1.23.3 and segyio 1.9.11

I get the following warning message when I initialize a volume with 0s: C:\Temp\Python 3.10.0\lib\site-packages\segyio\utils.py:23: RuntimeWarning: Implicit conversion from float32 to int16 (narrowing)
warnings.warn(msg.format(x.dtype, dtype), RuntimeWarning)

Here is the code to show this issue:

input_file= 'amplitude.segy'
stack= segyio.open(working_dir + input_file, 'r')
stack.mmap()

attr_1= 'amplitude_square.segy'
copyfile(stack, working_dir + attr_1)

attr_1= segyio.open(attr_1, 'r+', iline= 9, xline= 13)
avo_attr_1.mmap()

crosslines= len(avo_attr_1.xlines)
samples= len(avo_attr_1.trace[0])

zero_out= np.zeros((crosslines, samples), dtype= np.float32)

for kline in avo_attr_1.ilines:
attr_1.iline[kline]= zero_out.copy()

Any suggestions?

Ivan

@da-wad
Copy link

da-wad commented Oct 31, 2023

Yes, your segy may not be filled with floats.

Get the format code from by running attr_1.bin[segyio.BinField.Format]

Then check Table 2 on page 6 here: https://library.seg.org/pb-assets/technical-standards/seg_y_rev1-1686080991247.pdf

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

2 participants