pycsamt.zonge.property#

pycsamt.zonge.property#

Reusable, lightweight property containers for survey-level metadata that are not tied to a particular AVG record. All classes expose a simple set()/get() API, plus helpers to read/write CSAVGW/ASTATIC $keyword=value style headers.

Design goals#

  • Small, explicit data holders (dataclasses).

  • Robust set/get with gentle validation.

  • Round-trip helpers:
    • update_from_keywords(meta) ← dict from parser

    • to_keywords() → dict for writer

  • Tolerate legacy aliases (e.g. XMTRTx.GdpStn).

  • Keep lines short for readability in code reviews.

Classes

Hardware([version, source_file, dated, ...])

Minimal provenance captured from banner / comment lines.

Receiver([station, length_m, gdp_station, ...])

Receiver electrode / coil metadata ($Rx.*).

SkipFlag([value])

Encapsulate Zonge skip-flag quality codes.

SurveyAnnotation([project_name, ...])

Project-level annotation block ($Job.*).

SurveyConfiguration([survey_type, ...])

Survey-level configuration taken from AVG headers.

Transmitter([station, length_m, ...])

Transmitter loop / bipole metadata ($Tx.*).

class pycsamt.zonge.property.SkipFlag(value='2')[source]#

Bases: object

Encapsulate Zonge skip-flag quality codes.

Codes#

2 → good quality 1 → kept but skip on plots 0 → rejected / bad data * → no data (placeholder)

set(value=None)[source]#

Set the flag using {0,1,2,’*’}.

Parameters:

value (str | int | None)

Return type:

None

get()[source]#

Return the label (‘good’, ‘skip’, …).

Return type:

str

property code: str[source]#

Return the raw code as string.

Parameters:

value (str | int | None)

class pycsamt.zonge.property.Hardware(version='7.76', source_file=None, dated=None, processed=None, astatic_ver='v3.60', updated=None, tma_points=None, tma_freq=None, _extra=<factory>)[source]#

Bases: object

Minimal provenance captured from banner / comment lines.

Many of these are informational and may not appear as $keywords. We keep to_keywords minimal to avoid inventing conventions.

Parameters:
  • version (str)

  • source_file (Path | None)

  • dated (str | None)

  • processed (str | None)

  • astatic_ver (str)

  • updated (str | None)

  • tma_points (int | None)

  • tma_freq (float | None)

  • _extra (dict[str, Any])

version: str#
source_file: Path | None#
dated: str | None#
processed: str | None#
astatic_ver: str#
updated: str | None#
tma_points: int | None#
tma_freq: float | None#
KEYMAP: dict[str, str]#
set(**kwargs)[source]#

Set known fields; unknowns land in _extra.

Return type:

None

get(key, default=None)[source]#

Get known field or fallback to _extra.

Parameters:
Return type:

Any

to_json(*, indent=0)[source]#
Parameters:

indent (int)

Return type:

str

update_from_keywords(meta)[source]#

Accept a plain dict (keys may or may not start with ‘$’) and coerce a few well-known banner values to proper types.

Parameters:

meta (dict[str, Any])

Return type:

None

to_keywords()[source]#

Provide a small, stable set for round-trip / tests.

Return type:

dict[str, Any]

class pycsamt.zonge.property.Receiver(station=None, length_m=None, gdp_station=None, hpr=None, comps='ExHy', azimuth_deg=None, latitude=None, longitude=None, elevation=None, unit='m', notes=None)[source]#

Bases: object

Receiver electrode / coil metadata ($Rx.*).

Parameters:
station: int | None#
length_m: float | None#
gdp_station: int | None#
hpr: tuple[float, float, float] | None#
comps: str | None#
azimuth_deg: float | None#
latitude: float | None#
longitude: float | None#
elevation: float | None#
unit: str | None#
notes: str | None#
KEYMAP: dict[str, str]#
ALIASES: dict[str, str]#
set(**kwargs)[source]#

Set any attribute; no hard validation here.

Return type:

None

get(key, default=None)[source]#

Get attribute by name.

Parameters:
Return type:

Any

update_from_keywords(meta)[source]#

Update from parsed $Rx.* / $GPS.* keys with typing.

Parameters:

meta (dict[str, Any])

Return type:

None

to_keywords()[source]#

Export standardized $Rx.* keys with units preserved.

Return type:

dict[str, Any]

class pycsamt.zonge.property.Transmitter(station=None, length_m=None, gdp_station=None, tx_type=None, center=None, hpr=None, current_a=None, frequency_hz=None, latitude=None, longitude=None, notes=None)[source]#

Bases: object

Transmitter loop / bipole metadata ($Tx.*).

Parameters:
station: int | None#
length_m: float | None#
gdp_station: int | None#
tx_type: str | None#
center: tuple[float, float, float] | None#
hpr: tuple[float, float, float] | None#
current_a: float | None#
frequency_hz: float | None#
latitude: float | None#
longitude: float | None#
notes: str | None#
KEYMAP: dict[str, str]#
ALIASES: dict[str, str]#
set(**kwargs)[source]#

Set any attribute; no hard validation here.

Return type:

None

get(key, default=None)[source]#

Get attribute by name.

Parameters:
Return type:

Any

update_from_keywords(meta)[source]#

Update from $Tx.* (and legacy XMTR) with typing.

Parameters:

meta (dict[str, Any])

Return type:

None

to_keywords()[source]#

Export standardized $Tx.* keys.

Return type:

dict[str, Any]

class pycsamt.zonge.property.SurveyConfiguration(survey_type='CSAMT', array_type=None, line_name=None, line_number=None, line_azim_deg=None, stn_gdp_beg=None, stn_gdp_inc=None, stn_beg=None, stn_inc=None, stn_left=None, stn_right=None, unit_length='m', unit_emag='nV/Am', unit_hfield='pT/A', unit_phase='mrad', utm_zone=None, created=<factory>, _extra=<factory>)[source]#

Bases: object

Survey-level configuration taken from AVG headers.

Parameters:
  • survey_type (str)

  • array_type (str | None)

  • line_name (str | None)

  • line_number (float | None)

  • line_azim_deg (float | None)

  • stn_gdp_beg (float | None)

  • stn_gdp_inc (float | None)

  • stn_beg (float | None)

  • stn_inc (float | None)

  • stn_left (float | None)

  • stn_right (float | None)

  • unit_length (str)

  • unit_emag (str)

  • unit_hfield (str)

  • unit_phase (str)

  • utm_zone (int | None)

  • created (str)

  • _extra (dict[str, Any])

survey_type: str#
array_type: str | None#
line_name: str | None#
line_number: float | None#
line_azim_deg: float | None#
stn_gdp_beg: float | None#
stn_gdp_inc: float | None#
stn_beg: float | None#
stn_inc: float | None#
stn_left: float | None#
stn_right: float | None#
unit_length: str#
unit_emag: str#
unit_hfield: str#
unit_phase: str#
utm_zone: int | None#
created: str#
KEYMAP: dict[str, str]#
ALIASES: dict[str, str]#
set(**kwargs)[source]#

Set known fields; unknowns are stored in _extra so nothing is lost on round-trip.

Return type:

None

get(key, default=None)[source]#

Get known field or fallback to _extra.

Parameters:
Return type:

Any

update_from_keywords(meta)[source]#

Populate from $… header dict (keys without ‘$’). Coerce numeric fields so tests don’t see strings.

Parameters:

meta (dict[str, Any])

Return type:

None

to_keywords()[source]#

Export standardized $Survey.*, $Line.*, $Stn.*.

Return type:

dict[str, Any]

to_json(*, indent=0)[source]#
Parameters:

indent (int)

Return type:

str

class pycsamt.zonge.property.SurveyAnnotation(project_name='CSAMTSurvey', project_area=None, customer_name='Zonge Engineering', contractor_name='Zonge', project_label='pyCSAMT', acq_date=<factory>, _extra=<factory>)[source]#

Bases: object

Project-level annotation block ($Job.*).

Parameters:
  • project_name (str)

  • project_area (str | None)

  • customer_name (str)

  • contractor_name (str)

  • project_label (str)

  • acq_date (str)

  • _extra (dict[str, Any])

project_name: str#
project_area: str | None#
customer_name: str#
contractor_name: str#
project_label: str#
acq_date: str#
KEYMAP: dict[str, str]#
ALIASES: dict[str, str]#
set(**kwargs)[source]#

Set known fields; unknowns land in _extra.

Return type:

None

get(key, default=None)[source]#

Get known field or fallback to _extra.

Parameters:
Return type:

Any

update_from_keywords(meta)[source]#

Update from parsed $Job.* keys (with alias support).

Parameters:

meta (dict[str, Any])

Return type:

None

to_keywords()[source]#

Export standardized $Job.* keys.

Return type:

dict[str, Any]

to_json(*, indent=0)[source]#
Parameters:

indent (int)

Return type:

str