pycsamt.zonge.heads#
Header facade that aggregates survey-level property containers (Hardware, Annotation, Configuration, Tx, Rx, Skip) and exposes a uniform read/write API based on $keyword=value lines.
This module is intentionally key/value oriented, not tabular. Use AVGComponentBase elsewhere for row/column data blocks.
Classes
|
Aggregate facade for header-level metadata components. |
|
Minimal base for header components that serialize to $keyword=value lines (no CSV tables). |
- class pycsamt.zonge.heads.Header[source]#
Bases:
HeaderComponentBaseAggregate facade for header-level metadata components. It reads/writes $keyword=value lines and keeps a compact, human-friendly banner for legacy context.
- Composition:
hardware : Hardware
annotation : SurveyAnnotation
config : SurveyConfiguration
tx : Transmitter
rx : Receiver
skip : SkipFlag
- Typical usage:
>>> hdr = Header() >>> hdr.read(meta=kv_mapping) >>> lines = hdr.write() >>> print("\n".join(lines))
- read(df_unused=None, meta=None)[source]#
Populate all sub-components from a meta mapping. - hardware is populated best-effort if banner fields
are present in meta (rare) or provided via from_lines(…).
annotation/config/tx/rx rely on their KEYMAP/ALIASES to consume $Job.*, $Survey.*, $Tx.*, $Rx.* keys.
- classmethod from_lines(lines)[source]#
Parse raw header lines. This is primarily for legacy files where the banner comes as comment lines plus a $keyword section. We parse both.
- write()[source]#
- Emit a tidy header section:
legacy banner (comment lines) synthesized from Hardware (if any fields are known),
$Job.* lines (annotation),
$Survey.* + $Unit.* + $Stn.* lines (config),
$Tx.* and $Rx.* lines,
a $Written UTC stamp.
- update_from_keywords(meta)[source]#
Populate all sub-components from a keyword mapping. This method dispatches keys to the appropriate component (annotation, config, tx, rx) based on their prefix.