mth5.io.phoenix.readers.config

Created on Fri Jun 10 07:52:03 2022

author:

Jared Peacock

license:

MIT

Classes

PhoenixConfig

Phoenix Geophysics configuration file reader and metadata container.

Module Contents

class mth5.io.phoenix.readers.config.PhoenixConfig(fn: str | pathlib.Path | None = None, **kwargs: Any)[source]

Phoenix Geophysics configuration file reader and metadata container.

This class reads and provides access to Phoenix MTU-5C instrument configuration data stored in JSON format. The configuration file contains recording parameters, instrument settings, and metadata used to control data acquisition.

Parameters:
  • fn (str, pathlib.Path, or None, optional) – Path to the Phoenix configuration file (typically config.json). If provided, the file will be validated for existence.

  • **kwargs (Any) – Additional keyword arguments (currently unused).

fn[source]

Path to the configuration file.

Type:

pathlib.Path or None

obj[source]

Parsed configuration object containing all settings.

Type:

Any or None

logger[source]

Logger instance for debugging and error reporting.

Type:

loguru.Logger

Examples

>>> config = PhoenixConfig("config.json")
>>> config.read()
>>> station = config.station_metadata()
>>> print(f"Station ID: {station.id}")
obj: Any = None[source]
logger: loguru.Logger[source]
property fn: pathlib.Path | None[source]

Path to the Phoenix configuration file.

Returns:

The path to the configuration file, or None if not set.

Return type:

pathlib.Path or None

read(fn: str | pathlib.Path | None = None) None[source]

Read and parse a Phoenix configuration file.

Loads and parses a Phoenix MTU-5C configuration file in JSON format. The parsed configuration is stored in the obj attribute and provides access to all recording parameters and instrument settings.

Parameters:

fn (str, pathlib.Path, or None, optional) – Path to the configuration file to read. If None, uses the previously set file path from the fn property.

Raises:
  • ValueError – If no file path is provided and none was previously set.

  • IOError – If the configuration file cannot be read or parsed.

Notes

The configuration file should be in Phoenix JSON format containing recording parameters, instrument settings, and metadata.

has_obj() bool[source]

Check if configuration data has been loaded.

Returns:

True if configuration data is loaded, False otherwise.

Return type:

bool

property auto_power_enabled: Any | None[source]

Auto power enabled setting from configuration.

Returns:

The auto power enabled setting, or None if no configuration is loaded.

Return type:

Any or None

property config: Any | None[source]

Main configuration section from the configuration file.

Returns:

The first configuration object containing recording parameters, or None if no configuration is loaded.

Return type:

Any or None

property empower_version: Any | None[source]

EMPower software version from configuration.

Returns:

The EMPower software version, or None if no configuration is loaded.

Return type:

Any or None

property mtc150_reset: Any | None[source]

MTC150 reset setting from configuration.

Returns:

The MTC150 reset setting, or None if no configuration is loaded.

Return type:

Any or None

property network: Any | None[source]

Network configuration from configuration file.

Returns:

The network configuration settings, or None if no configuration is loaded.

Return type:

Any or None

property receiver: Any | None[source]

Receiver configuration from configuration file.

Returns:

The receiver configuration settings, or None if no configuration is loaded.

Return type:

Any or None

property schedule: Any | None[source]

Recording schedule from configuration file.

Returns:

The recording schedule configuration, or None if no configuration is loaded.

Return type:

Any or None

property surveyTechnique: Any | None[source]

Survey technique setting from configuration file.

Returns:

The survey technique setting, or None if no configuration is loaded.

Return type:

Any or None

property timezone: Any | None[source]

Timezone setting from configuration file.

Returns:

The timezone setting, or None if no configuration is loaded.

Return type:

Any or None

property timezone_offset: Any | None[source]

Timezone offset from configuration file.

Returns:

The timezone offset in hours, or None if no configuration is loaded.

Return type:

Any or None

property version: Any | None[source]

Configuration file version from configuration file.

Returns:

The configuration file version, or None if no configuration is loaded.

Return type:

Any or None

station_metadata() mt_metadata.timeseries.Station[source]

Create a Station metadata object from configuration data.

Extracts station information from the loaded configuration and creates a standardized Station metadata object with basic station parameters.

Returns:

A Station metadata object populated with configuration data including station ID, operator information, company name, and notes.

Return type:

Station

Raises:

AttributeError – If no configuration is loaded or required fields are missing.

Notes

The method extracts the following information from config.layout: - Station_Name -> station.id - Operator -> station.acquired_by.name - Company_Name -> station.acquired_by.organization - Notes -> station.comments

Examples

>>> config = PhoenixConfig("config.json")
>>> config.read()
>>> station = config.station_metadata()
>>> print(f"Station: {station.id}")