mt_metadata.transfer_functions.io.edi

Submodules

Classes

EDI

This class is for .edi files, mainly reading and writing. Has been tested

Package Contents

class mt_metadata.transfer_functions.io.edi.EDI(fn=None, **kwargs)

This class is for .edi files, mainly reading and writing. Has been tested on Winglink and Phoenix output .edi’s, which are meant to follow the archaic EDI format put forward by SEG. Can read impedance, Tipper and/or spectra data.

The Edi class contains a class for each major section of the .edi file.

Frequency and components are ordered from highest to lowest frequency.

Parameters:

fn (string or pathlib.Path) – full path to .edi file to be read in. default is None. If an .edi file is input, it is automatically read in and attributes of Edi are filled

Change Latitude:
>>> from mt_metadata.transfer_functions.io.edi import EDI
>>> edi_obj = EDI(fn=r"/home/mt/mt01.edi")
>>> # change the latitude
>>> edi_obj.lat = 45.7869
>>> new_edi_fn = edi_obj.write()
logger
Header
Info
Measurement
Data
z = None
z_err = None
t = None
t_err = None
frequency = None
rotation_angle = None
residual_covariance = None
signal_inverse_power = None
tf = None
tf_err = None
property fn
property period: numpy.typing.NDArray | None
read(fn=None, get_elevation=False)

Read in an edi file and fill attributes of each section’s classes. Including:

  • Header

  • Info

  • Measurement

  • Data

  • z, z_err

  • t, t_err

Note

Automatically detects if data is in spectra format. All data read in is converted to impedance and Tipper.

Parameters:

fn (string) – full path to .edi file to be read in default is None

Example:
>>> from mt_metadata.transfer_functions.io.edi import EDI
>>> edi_obj = EDI
>>> edi_obj.read(fn=r"/home/mt/mt01.edi")
write(new_edi_fn=None, longitude_format='LON', latlon_format='dms')

Write a new edi file from either an existing .edi file or from data input by the user into the attributes of Edi.

Parameters:
  • new_edi_fn (string) – full path to new edi file. default is None, which will write to the same file as the input .edi with as: r”/home/mt/mt01_1.edi”

  • longitude_format (string) – whether to write longitude as LON or LONG. options are ‘LON’ or ‘LONG’, default ‘LON’

  • latlon_format (string) – format of latitude and longitude in output edi, degrees minutes seconds (‘dms’) or decimal degrees (‘dd’)

Returns:

full path to new edi file

Return type:

string

Example:
>>> import mtpy.core.edi as mtedi
>>> edi_obj = mtedi.Edi(fn=r"/home/mt/mt01/edi")
>>> edi_obj.Header.dataid = 'mt01_rr'
>>> n_edi_fn = edi_obj.write_edi_file()
property lat: float | None

latitude in decimal degrees

property lon: float | None

longitude in decimal degrees

property elev: float

Elevation in elevation units

property station: str | None

station name

property survey_metadata: mt_metadata.timeseries.Survey
property station_metadata: mt_metadata.transfer_functions.tf.Station
property ex_metadata
property ey_metadata
property hx_metadata
property hy_metadata
property hz_metadata
property rrhx_metadata
property rrhy_metadata