mth5.io.zen.z3d_metadata
Created on Wed Aug 24 11:35:59 2022
@author: jpeacock
Classes
Read metadata information from a Z3D file and make each metadata entry an attribute. |
Module Contents
- class mth5.io.zen.z3d_metadata.Z3DMetadata(fn: str | pathlib.Path | None = None, fid: BinaryIO | None = None, **kwargs: Any)[source]
Read metadata information from a Z3D file and make each metadata entry an attribute.
The attributes are left in capitalization of the Z3D file format.
- Parameters:
fn (str or pathlib.Path, optional) – Full path to Z3D file.
fid (BinaryIO, optional) – File object (e.g., open(Z3Dfile, ‘rb’)).
**kwargs (dict) – Additional keyword arguments to set as attributes.
- board_cal[source]
Board calibration array with frequency, rate, amplitude, phase.
- Type:
np.ndarray or None
Examples
>>> from mth5.io.zen import Z3DMetadata >>> Z3Dfn = r"/home/mt/mt01/mt01_20150522_080000_256_EX.Z3D" >>> header_obj = Z3DMetadata(fn=Z3Dfn) >>> header_obj.read_metadata()
- read_metadata(fn: str | pathlib.Path | None = None, fid: BinaryIO | None = None) None[source]
Read metadata from Z3D file.
Parses the metadata blocks in a Z3D file and populates the object’s attributes with the extracted values. Also reads calibration data for both board and coil calibrations.
- Parameters:
fn (str or pathlib.Path, optional) – Full path to file. If None, uses the instance’s fn attribute.
fid (BinaryIO, optional) – Open file object. If None, uses the instance’s fid attribute or opens the file specified by fn.
- Raises:
UnicodeDecodeError – If metadata blocks cannot be decoded as text.
Notes
This method reads metadata blocks sequentially from the Z3D file, starting after the header and schedule metadata sections. It processes:
Standard metadata records with key=value pairs
Board calibration data (cal.brd format)
Coil calibration data (cal.ant format)
Calibration data blocks (caldata format)
The method automatically determines the station name from available metadata fields in the following priority: 1. line_name + rx_xyz0 (first coordinate) 2. rx_stn 3. ch_stn