Skip to content

parseSEG 0.8.0: keysAt, failed-row reads, chunk window origin, SEG-Y from TraceKeys - #1

Merged
xrfez merged 9 commits into
mainfrom
processseg-integration
Nov 11, 2026
Merged

xrfez merged 9 commits into
mainfrom
processseg-integration

Conversation

@xrfez

@xrfez xrfez commented Nov 11, 2026

Copy link
Copy Markdown
Owner

What a processing library built on parseSEG (processSEG) needed from it, developed and tested against that library before being offered here.

New

  • TraceRows.keysAt(row): the non-raising form of traceKeys(rows, row), for callers that checked hasKeys once, so {.raises: [].} kernels and prefetch transform hooks can read keys.
  • readTracesInto(f, traces[, samples], dst, failedRows, row = 0): fills a caller's seq[int] with the rows that failed to decode (cleared, capacity kept, no log), as PrefetchChunk.failedRows does.
  • PrefetchChunk.firstSample: the prefetcher's window origin, so a windowed chunk's columns can be placed on the time axis.
  • SEG-Y written from TraceKeys: openSeismicWriter(path, SegyOutputOptions(...)) opens a SEG-Y file with no input to model; writeTrace(w, keys, samples, overrides) builds the trace headers from TraceKeys in the standard layout (Rev 2: also the f64 values of Trace Header Extension 1). A stack of SEG-D or SEG-2 input can now be written as SEG-Y, and openSeismic reads the same keys back. The stored trace code is kept only when its status agrees with the keys' (a trace killed in the keys is written dead).

Hardened after review: template traces are refused on a writer opened from SegyOutputOptions; a delay within 1 ns of a whole ms keeps time scalar 1; component is not written as a trace code; Rev 0/1 output refuses intervals over 65535 µs.

Compatibility

No breaking changes: everything above is additive. The SEG-Y encoders shared with the converter moved to private/segyencode (internal). Version bumped to 0.8.0.

Tests

New tests/twritekeys.nim (SEG-D and SEG-2 demos to Rev 2.1, Rev 1, little-endian f64, a 70 000-sample stack line, time scalars, refusals), additions to ttracerows and tprefetchrows; the whole suite passes (nim test), and processSEG's suite passes against this branch (debug, release, danger, ASan). docs/api.md and the processing guide are updated.

🤖 Generated with Claude Code

xrfez and others added 9 commits November 11, 2026 05:28
`traceKeys(rows, row)` raises ValueError when the view has no keys, so a
`{.raises: [].}` kernel or a prefetch ChunkTransform cannot call it.
`keysAt` is for callers that checked `hasKeys` once: no keys is an
AssertionDefect with bound checks on. Tests in ttracerows (also from a
raises: [] proc and in a transform).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- readTracesInto(f, traces[, samples], dst, failedRows, row = 0) fills a
  caller's seq[int] with the rows that failed to decode (cleared, capacity
  kept, no log), as PrefetchChunk.failedRows does; the other forms report
  failures only through a DiagLog, which allocates per failure;
- PrefetchChunk.firstSample: the prefetcher's window origin, so a consumer
  can place a windowed chunk's columns on the time axis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- openSeismicWriter(path, SegyOutputOptions): a SEG-Y file with no input
  to model (revision, byte order, format, textual header lines, trace
  sorting, measurement system); validated at open, the first trace sets
  the binary interval and sample count;
- writeTrace(w, keys, samples, overrides): trace headers from TraceKeys in
  the standard layout (Rev 2: also the f64 values of Trace Header
  Extension 1), so a stack of SEG-D or SEG-2 input can be written as SEG-Y;
  openSeismic reads the same keys back;
- the encoders shared with the converter moved to private/segyencode.
Tests in twritekeys; docs/api.md and the processing guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ields to it

A trace read live (code 1) and then killed in the keys was written back
live; the stored code is now kept only when its status agrees.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for whole delays, no component as trace code, Rev 0/1 interval limit

- writeTrace(w, src, trace, ...) on a writer opened from SegyOutputOptions
  is refused: its binary header (interval, Ext1 count) is made for traces
  from keys, and kept a placeholder interval of 1000 us;
- a delay within 1 ns of a whole ms gets time scalar 1, so readers that
  ignore bytes 215-216 read 4, not 4000;
- the trace identification code no longer comes from `component` (a group
  index or sensor type outside SEG-Y; a SEG-Y code is in traceCode);
- Rev 0/1 output refuses intervals over 65535 us (was clamped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New since 0.7.0: TraceRows.keysAt; readTracesInto failed-row lists;
PrefetchChunk.firstSample; SEG-Y written from TraceKeys
(openSeismicWriter(path, SegyOutputOptions), writeTrace(w, keys,
samples, overrides)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xrfez
xrfez merged commit 7be5c47 into main Nov 11, 2026
3 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.

1 participant