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

Head

Header()

Aggregate facade for header-level metadata components.

HeaderComponentBase()

Minimal base for header components that serialize to $keyword=value lines (no CSV tables).

class pycsamt.zonge.heads.Header[source]#

Bases: HeaderComponentBase

Aggregate 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.

Parameters:
Return type:

None

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.

Parameters:

lines (Sequence[str])

Return type:

Header

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.

Return type:

Sequence[str]

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.

Parameters:

meta (dict[str, Any])

Return type:

None

to_keywords()[source]#

Aggregate all $keyword=value pairs from sub-components.

This collects keywords from annotation, config, tx, and rx into a single dictionary suitable for writing to a file.

Return type:

dict[str, Any]

asdict()[source]#

Plain dict view of all sub-components.

Return type:

dict[str, Any]

pycsamt.zonge.heads.Head#

alias of Header