pycsamt.seg.schema#

SEG-EDI schema (keywords, options, ordering).

This module centralizes tags (block keywords), families, allowed options, and the top-level BNF skeleton for SEG-EDI files. It is intentionally light-weight and import-safe: there is no I/O here — just constants and a couple of helpers. Use it from readers/writers (e.g. pycsamt.seg.edi).

Notes

  • Keywords and option names are UPPERCASE in the standard. We keep tags exactly as they appear (e.g. ">ZXXR").

  • Sets are frozenset to make them hashable and safe for reuse in dataclasses and default arguments.

  • The schema aggregates both MT and EMAP blocks, including filtered EMAP forms (F*) and auxiliary diagnostics.

  • The option tables here are non-exhaustive for some of the highly system-dependent blocks (>TSERIES, spectra). They list the stable core options we validate against; the reader may accept extras as opaque KEY=VALUE pairs.

References

SEG MT/EMAP EDI v1.0 (1991) — consolidated into pycsamt.seg.schema as constants for reuse.

Functions

normalize_tag(tag)

Return canonical upper-case tag with leading '>' preserved.

tag_family(tag)

Return family/category name for tag if known.

pycsamt.seg.schema.normalize_tag(tag)[source]#

Return canonical upper-case tag with leading ‘>’ preserved.

Accepts things like "zxxr" or ">Zxxr" and returns ">ZXXR". Does not try to normalize section openers (">=...") beyond case.

Parameters:

tag (str)

Return type:

str

pycsamt.seg.schema.tag_family(tag)[source]#

Return family/category name for tag if known.

Parameters:

tag (str)

Return type:

str | None