mth5.io.zen.z3d_metadata

Created on Wed Aug 24 11:35:59 2022

@author: jpeacock

Classes

Z3DMetadata

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.

_header_length[source]

Length of header in bits (512).

Type:

int

_metadata_length[source]

Length of metadata blocks (512).

Type:

int

_schedule_metadata_len[source]

Length of schedule meta data (512).

Type:

int

board_cal[source]

Board calibration array with frequency, rate, amplitude, phase.

Type:

np.ndarray or None

cal_ant[source]

Antenna calibration information.

Type:

str or None

cal_board[source]

Board calibration dictionary.

Type:

dict or None

cal_ver[source]

Calibration version.

Type:

str or None

ch_azimuth[source]

Channel azimuth.

Type:

str or None

ch_cmp[source]

Channel component.

Type:

str or None

ch_length[source]

Channel length (or number of coils).

Type:

str or None

ch_number[source]

Channel number on the ZEN board.

Type:

str or None

ch_xyz1[source]

Channel xyz location.

Type:

str or None

ch_xyz2[source]

Channel xyz location.

Type:

str or None

ch_cres[source]

Channel resistance.

Type:

str or None

coil_cal[source]

Coil calibration array (frequency, amplitude, phase).

Type:

np.ndarray or None

fid[source]

File object.

Type:

BinaryIO or None

find_metadata[source]

Boolean flag for finding metadata.

Type:

bool

fn[source]

Full path to Z3D file.

Type:

str or pathlib.Path or None

gdp_operator[source]

Operator of the survey.

Type:

str or None

gdp_progver[source]

Program version.

Type:

str or None

gdp_temp[source]

GDP temperature.

Type:

str or None

gdp_volt[source]

GDP voltage.

Type:

str or None

job_by[source]

Job performed by.

Type:

str or None

job_for[source]

Job for.

Type:

str or None

job_name[source]

Job name.

Type:

str or None

job_number[source]

Job number.

Type:

str or None

line_name[source]

Survey line name.

Type:

str or None

m_tell[source]

Location in the file where the last metadata block was found.

Type:

int

notes[source]

Additional notes from metadata.

Type:

str or None

rx_aspace[source]

Electrode spacing.

Type:

str or None

rx_sspace[source]

Receiver spacing.

Type:

str or None

rx_xazimuth[source]

X azimuth of electrode.

Type:

str or None

rx_xyz0[source]

Receiver xyz coordinates.

Type:

str or None

rx_yazimuth[source]

Y azimuth of electrode.

Type:

str or None

rx_zpositive[source]

Z positive direction (default ‘down’).

Type:

str

station[source]

Station name.

Type:

str or None

survey_type[source]

Type of survey.

Type:

str or None

unit_length[source]

Length units (m).

Type:

str or None

count[source]

Counter for metadata blocks read.

Type:

int

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()
logger[source]
fn: str | pathlib.Path | None = None[source]
fid: BinaryIO | None = None[source]
find_metadata: bool = True[source]
board_cal: list | numpy.ndarray | None = None[source]
coil_cal: list | numpy.ndarray | None = None[source]
m_tell: int = 0[source]
cal_ant: str | None = None[source]
cal_board: Dict[str, Any] | None = None[source]
cal_ver: str | None = None[source]
ch_azimuth: str | None = None[source]
ch_cmp: str | None = None[source]
ch_length: str | None = None[source]
ch_number: str | None = None[source]
ch_xyz1: str | None = None[source]
ch_xyz2: str | None = None[source]
ch_cres: str | None = None[source]
gdp_operator: str | None = None[source]
gdp_progver: str | None = None[source]
gdp_volt: str | None = None[source]
gdp_temp: str | None = None[source]
job_by: str | None = None[source]
job_for: str | None = None[source]
job_name: str | None = None[source]
job_number: str | None = None[source]
rx_aspace: str | None = None[source]
rx_sspace: str | None = None[source]
rx_xazimuth: str | None = None[source]
rx_xyz0: str | None = None[source]
rx_yazimuth: str | None = None[source]
rx_zpositive: str = 'down'[source]
line_name: str | None = None[source]
survey_type: str | None = None[source]
unit_length: str | None = None[source]
station: str | None = None[source]
count: int = 0[source]
notes: str | None = None[source]
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