Skip to content

Commit

Permalink
Merge pull request #247 from TGSAI/fix/nonzero_calculation
Browse files Browse the repository at this point in the history
Update logic for finding first non-zero sample index in SEG-Y data
  • Loading branch information
tasansal authored Jul 24, 2023
2 parents 5216791 + 9c7c767 commit 187ca3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mdio/segy/_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ def trace_worker(
value=tmp_metadata,
)

nonzero_z = tmp_data.sum(axis=tuple(range(n_dim - 1))).nonzero()
# Find first non-zero index in sample (last) dimension
non_sample_axes = tuple(range(n_dim - 1))
nonzero_z = np.where(np.any(tmp_data != 0, axis=non_sample_axes))

if len(nonzero_z[0]) == 0:
return

Expand Down

0 comments on commit 187ca3f

Please sign in to comment.