pycsamt.zonge.schema#

pycsamt.zonge.schema

Defines the data schema and column name mappings for Zonge AVG files. This module serves as the single source of truth for translating between legacy (kind-1), modern (kind-2), and the internal canonical column names used throughout the package.

Functions

get_aliases(canonical_name, *[, kind, ...])

Fetch all known aliases for a canonical column name.

get_unit(canonical_name[, formatted])

Fetch the unit string for a canonical variable name.

pycsamt.zonge.schema.get_unit(canonical_name, formatted=True)[source]#

Fetch the unit string for a canonical variable name.

Parameters:
  • canonical_name (str)

  • formatted (bool)

Return type:

str | None

pycsamt.zonge.schema.get_aliases(canonical_name, *, kind='all', custom_aliases=None, normalize=True)[source]#

Fetch all known aliases for a canonical column name.

Parameters:
  • canonical_name (str) – The internal, standardized name for the column.

  • kind ({'qc', 'all'}, default 'all') –

    • ‘qc’: Search only within quality control aliases.

    • ’all’: Search within all known aliases.

  • custom_aliases (dict, optional) – A dictionary to temporarily add or override aliases. Keys are canonical names, values are tuples of aliases.

  • normalize (bool, default True) – If True, the canonical_name and keys in the custom_aliases dictionary are treated as case-insensitive.

Returns:

A tuple of all raw (legacy and modern) names that map to the given canonical name.

Return type:

tuple[str, …]

Examples

>>> get_aliases('pc_emag', kind='qc')
('%Emag', 'E.%err')
>>> get_aliases('rho')
('ARes.mag', 'Resistivity')
>>> get_aliases(
...     'rho',
...     custom_aliases={'rho': ('resistivity_ohm_m',)}
... )
('ARes.mag', 'Resistivity', 'resistivity_ohm_m')