Skip to content

Conversation

@waldeland
Copy link
Contributor

@waldeland waldeland commented Jun 24, 2025

Fixes this bug:
image

from seismic_zfp.conversion import SegyConverter
import segyio
path_to_segy = 'MC3D-GH2001R02BP-3D-PSTM-FINAL-FAR-VOLUME-STACK.MIG_FIN.10249887981_0000139-0000679.SEGY'
segy = segyio.open(path_to_segy, ignore_geometry=True, strict=False)
il = segy.attributes(segyio.TraceField.INLINE_3D)
print('inlines:',set(il))
with SegyConverter(path_to_segy) as converter:
    converter.run(path_to_segy + '.zfp', bits_per_voxel=4)

Which gives the output:

inlines: {0}
SEG-Y file is unstructured and no geometry provided. Determining this may take some time...
Converting: In=MC3D-GH2001R02BP-3D-PSTM-FINAL-FAR-VOLUME-STACK.MIG_FIN.10249887981_0000139-0000679.SEGY, Out=MC3D-GH2001R02BP-3D-PSTM-FINAL-FAR-VOLUME-STACK.MIG_FIN.10249887981_0000139-0000679.SEGY.zfp
Traceback (most recent call last):
  File "/nr/bamjo/user/andersuw/.pycharm_helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 16, in <module>
  File "/nr/project/common/Statoil-DELI/usr/andersuw/deli_standalone_2/venv_deli_2/lib/python3.10/site-packages/seismic_zfp/conversion.py", line 226, in run
    self.infer_geometry(seismic)
  File "/nr/project/common/Statoil-DELI/usr/andersuw/deli_standalone_2/venv_deli_2/lib/python3.10/site-packages/seismic_zfp/conversion.py", line 164, in infer_geometry
    self.geom = InferredGeometry3d(traces_ref)
  File "/nr/project/common/Statoil-DELI/usr/andersuw/deli_standalone_2/venv_deli_2/lib/python3.10/site-packages/seismic_zfp/utils.py", line 49, in __init__
    self.min_il, self.max_il, self.il_step = self.get_range(il_ids)
  File "/nr/project/common/Statoil-DELI/usr/andersuw/deli_standalone_2/venv_deli_2/lib/python3.10/site-packages/seismic_zfp/utils.py", line 56, in get_range
    return min(ids), max(ids), (max(ids) - min(ids)) // (len(ids) - 1)
ZeroDivisionError: integer division or modulo by zero

@da-wad da-wad self-requested a review June 24, 2025 11:57
@da-wad
Copy link
Collaborator

da-wad commented Jun 24, 2025

Code change is fine, please add a test in tests/test_utils.py which will pass for the updated function and fail for the old version. (Just for this function, no need to make a single-inline 3D SEG-Y file)

@waldeland
Copy link
Contributor Author

Code change is fine, please add a test in tests/test_utils.py which will pass for the updated function and fail for the old version. (Just for this function, no need to make a single-inline 3D SEG-Y file)

Done.

@da-wad
Copy link
Collaborator

da-wad commented Jun 26, 2025

Try again with InferredGeometry3d.get_range() @waldeland ... it's a static method of the InferredGeometry3d class so doesn't come in the same namespace as most of the functions in utils.

Copy link
Collaborator

@da-wad da-wad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now!

@da-wad da-wad merged commit 7c238d1 into equinor:master Jun 27, 2025
21 checks passed
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

Successfully merging this pull request may close these issues.

2 participants