Coverage for C: \ Users \ peaco \ OneDrive \ Documents \ GitHub \ mt_metadata \ mt_metadata \ transfer_functions \ __init__.py: 100%
15 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-10 00:11 -0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-10 00:11 -0800
1# -*- coding: utf-8 -*-
2"""
3===============================
4Transfer Functions Metadata
5===============================
7This module provides a central container (TF) for magnetotelluric transfer functions,
8which represent the electromagnetic response of the Earth. Transfer functions relate
9the measured magnetic and electric fields and are fundamental to magnetotelluric
10interpretation.
12The primary goal is to create a unified transfer function object that can read from
13and write to various industry-standard file formats through the io module, enabling
14seamless data interchange and analysis across different MT software packages.
16MetadataBase Objects
17--------------------
18* TF - Main transfer function container with impedance, tipper, and associated metadata
19* Station - Station-level metadata specific to transfer function processing
20* TransferFunction - Core transfer function metadata (impedance, tipper, processing info)
21* StatisticalEstimate - Statistical quality metrics and error estimates for transfer functions
23Supported File Formats (io module)
24----------------------------------
25The io module supports reading and writing the following transfer function formats:
27* **EDI** - SEG (Society of Exploration Geophysicists) EDI format, the most common
28 MT interchange format
29* **EMTFXML** - EMTF (Electromagnetic Transfer Function) XML format with extended
30 metadata support
31* **ZMM** - BIRRP processing output format (impedance and vertical field data)
32* **JFile** - EMTF/BIRRP .j format for transfer function coefficients
33* **ZongeMTAvg** - Zonge International averaged MT data format
35Channel Nomenclature
36--------------------
37The module supports multiple channel naming conventions from different acquisition
38systems (default, LEMI, Phoenix, Musgraves, NIMS), with automatic mapping between
39standard channel names (hx, hy, hz, ex, ey) and system-specific labels.
41Usage
42-----
43The TF object serves as a central repository that:
44- Stores transfer functions in an xarray.Dataset for efficient computation
45- Provides helper methods to access impedance, tipper, errors, and covariances
46- Reads/writes to multiple file formats transparently
47- Maintains full metadata provenance and processing history
48- Supports coordinate rotations and datum transformations
50"""
52# Define allowed sets of channel labellings
53STANDARD_INPUT_CHANNELS = [
54 "hx",
55 "hy",
56]
57STANDARD_OUTPUT_CHANNELS = [
58 "ex",
59 "ey",
60 "hz",
61]
63# channel nomenclature mappings
64CHANNEL_MAPS = {
65 "default": {"hx": "hx", "hy": "hy", "hz": "hz", "ex": "ex", "ey": "ey"},
66 "lemi12": {"hx": "bx", "hy": "by", "hz": "bz", "ex": "e1", "ey": "e2"},
67 "lemi34": {"hx": "bx", "hy": "by", "hz": "bz", "ex": "e3", "ey": "e4"},
68 "phoenix123": {"hx": "h1", "hy": "h2", "hz": "h3", "ex": "e1", "ey": "e2"},
69 "musgraves": {"hx": "bx", "hy": "by", "hz": "bz", "ex": "ex", "ey": "ey"},
70}
71CHANNEL_MAPS["nims"] = CHANNEL_MAPS[
72 "default"
73] # Alias NIMS system to use same config as default
76def get_allowed_channel_names(standard_names):
77 """
78 :param standard_names: one of STANDARD_INPUT_NAMES, or STANDARD_OUTPUT_NAMES
79 :type standard_names: list
80 :return: allowed_names: list of channel names that are supported
81 :rtype: list
82 """
83 allowed_names = []
84 for ch in standard_names:
85 for _, channel_map in CHANNEL_MAPS.items():
86 allowed_names.append(channel_map[ch])
87 allowed_names = list(set(allowed_names))
88 return allowed_names
91ALLOWED_INPUT_CHANNELS = get_allowed_channel_names(STANDARD_INPUT_CHANNELS)
92ALLOWED_OUTPUT_CHANNELS = get_allowed_channel_names(STANDARD_OUTPUT_CHANNELS)
94from .core import TF
97__all__ = ["TF"]