Skip to content

Commit

Permalink
handle singleton edge case when trace_range only has 1 trace.
Browse files Browse the repository at this point in the history
  • Loading branch information
tasansal committed Dec 6, 2024
1 parent eb3b35d commit 2592341
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mdio/segy/_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def header_scan_worker(
non_void_fields = [(name, dtype) for name, (dtype, _) in fields.items()]
new_dtype = np.dtype(non_void_fields)

# Allocate empty memory and assign non-void fields
trace_header_filtered = np.empty_like(trace_header, dtype=new_dtype)
trace_header_filtered[:] = trace_header
# Copy to non-padded memory, ndmin is to handle the case where there is
# 1 trace in block (singleton) so we can concat and assign stuff later.
trace_header_filtered = np.array(trace_header, dtype=new_dtype, ndmin=1)

return cast(HeaderArray, trace_header_filtered)

Expand Down

0 comments on commit 2592341

Please sign in to comment.