Skip to content

Commit 187ca3f

Browse files
authored
Merge pull request #247 from TGSAI/fix/nonzero_calculation
Update logic for finding first non-zero sample index in SEG-Y data
2 parents 5216791 + 9c7c767 commit 187ca3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mdio/segy/_workers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ def trace_worker(
207207
value=tmp_metadata,
208208
)
209209

210-
nonzero_z = tmp_data.sum(axis=tuple(range(n_dim - 1))).nonzero()
210+
# Find first non-zero index in sample (last) dimension
211+
non_sample_axes = tuple(range(n_dim - 1))
212+
nonzero_z = np.where(np.any(tmp_data != 0, axis=non_sample_axes))
213+
211214
if len(nonzero_z[0]) == 0:
212215
return
213216

0 commit comments

Comments
 (0)